svn commit: r639464 - in /ofbiz/trunk/framework: webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java widget/src/org/ofbiz/widget/form/ModelForm.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r639464 - in /ofbiz/trunk/framework: webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java widget/src/org/ofbiz/widget/form/ModelForm.java

jacopoc
Author: jacopoc
Date: Thu Mar 20 14:24:02 2008
New Revision: 639464

URL: http://svn.apache.org/viewvc?rev=639464&view=rev
Log:
Implemented artifact information about services used by forms.

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java?rev=639464&r1=639463&r2=639464&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java Thu Mar 20 14:24:02 2008
@@ -64,9 +64,9 @@
     
     /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allFormInfos in ArtifactInfoFactory.getFormWidgetArtifactInfo */
     public void populateAll() throws GeneralException {
-        // TODO: populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (and reverse in aif.allFormInfosExtendingForm)
+        // populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (TODO) (and reverse in aif.allFormInfosExtendingForm)
         this.populateUsedEntities();
-        //this.populateUsedServices();
+        this.populateUsedServices();
     }
     protected void populateUsedEntities() throws GeneralException {
         // populate entitiesUsedInThisForm and for each the reverse-associate cache in the aif
@@ -91,7 +91,7 @@
     }
     protected void populateUsedServices() throws GeneralException {
         // populate servicesUsedInThisForm and for each the reverse-associate cache in the aif
-        Set<String> allServiceNameSet = null;//TODO JACOPOthis.modelScreen.getAllServiceNamesUsed();
+        Set<String> allServiceNameSet = this.modelForm.getAllServiceNamesUsed();
         populateServicesFromNameSet(allServiceNameSet);
     }
     protected void populateServicesFromNameSet(Set<String> allServiceNameSet) throws GeneralException {

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=639464&r1=639463&r2=639464&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu Mar 20 14:24:02 2008
@@ -2700,7 +2700,7 @@
                 allEntityNamesUsed.add(modelFormField.getEntityName());
             }
             if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) {
-                
+                allEntityNamesUsed.add(((ModelFormField.DisplayEntityField)modelFormField).entityName);
             }
             if (modelFormField.getFieldInfo() instanceof ModelFormField.FieldInfoWithOptions) {
                 for (ModelFormField.OptionSource optionSource: ((ModelFormField.FieldInfoWithOptions)modelFormField.getFieldInfo()).optionSources) {
@@ -2711,5 +2711,32 @@
             }
         }
         return allEntityNamesUsed;
+    }
+
+    public Set<String> getAllServiceNamesUsed() {
+        Set<String> allServiceNamesUsed = FastSet.newInstance();
+        for (AutoFieldsService autoFieldsService: this.autoFieldsServices) {
+            allServiceNamesUsed.add(autoFieldsService.serviceName);
+        }
+        if (this.actions != null) {
+            for (ModelFormAction modelFormAction: this.actions) {
+                if (modelFormAction instanceof ModelFormAction.Service) {
+                    allServiceNamesUsed.add(((ModelFormAction.Service)modelFormAction).serviceNameExdr.getOriginal());
+                }
+            }
+        }
+        if (this.rowActions != null) {
+            for (ModelFormAction modelFormAction: this.rowActions) {
+                if (modelFormAction instanceof ModelFormAction.Service) {
+                    allServiceNamesUsed.add(((ModelFormAction.Service)modelFormAction).serviceNameExdr.getOriginal());
+                }
+            }
+        }
+        for (ModelFormField modelFormField: this.fieldList) {
+            if (UtilValidate.isNotEmpty(modelFormField.getServiceName())) {
+                allServiceNamesUsed.add(modelFormField.getServiceName());
+            }
+        }
+        return allServiceNamesUsed;
     }
 }