svn commit: r679331 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/ entity/src/org/ofbiz/entity/model/ webtools/webapp/webtools/WEB-INF/actions/entity/ webtools/webapp/webtools/entity/

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

svn commit: r679331 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/ entity/src/org/ofbiz/entity/model/ webtools/webapp/webtools/WEB-INF/actions/entity/ webtools/webapp/webtools/entity/

jacopoc
Author: jacopoc
Date: Thu Jul 24 02:43:27 2008
New Revision: 679331

URL: http://svn.apache.org/viewvc?rev=679331&view=rev
Log:
The default-group-name is now returned by the group name methods of ModelGroupReader.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelGroupWriter.jsp
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/minervaObjects.ftl

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Thu Jul 24 02:43:27 2008
@@ -208,11 +208,7 @@
         }
 
         // initialize helpers by group
-        Set groupNames = getModelGroupReader().getGroupNames();
-        if (groupNames != null) {
-            // Always add the default group name
-            groupNames.add(getDelegatorInfo().defaultGroupName);
-        }
+        Set groupNames = getModelGroupReader().getGroupNames(delegatorName);
         Iterator<String> groups = UtilMisc.toIterator(groupNames);
         while (groups != null && groups.hasNext()) {
             String groupName = groups.next();
@@ -348,12 +344,7 @@
      *@return String with the helper name that corresponds to this delegator and the specified entityName
      */
     public String getEntityGroupName(String entityName) {
-        String groupName = getModelGroupReader().getEntityGroupName(entityName);
-        if (UtilValidate.isEmpty(groupName)) {
-            groupName = this.getDelegatorInfo().defaultGroupName;
-        }
-
-        return groupName;
+        return getModelGroupReader().getEntityGroupName(entityName, getDelegatorName());
     }
 
     /** Gets a Map of entity name & entity model pairs that are in the named group
@@ -367,7 +358,7 @@
             // add all entities with no group name to the Set
             Set<String> allEntityNames = this.getModelReader().getEntityNames();
             for (String entityName: allEntityNames) {
-                if (UtilValidate.isEmpty(getModelGroupReader().getEntityGroupName(entityName))) {
+                if (this.getDelegatorInfo().defaultGroupName.equals(getModelGroupReader().getEntityGroupName(entityName, getDelegatorName()))) {
                     entityNameSet.add(entityName);
                 }
             }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Thu Jul 24 02:43:27 2008
@@ -171,11 +171,15 @@
      * @param entityName The entityName of the Entity Group definition to use.
      * @return A group name
      */
-    public String getEntityGroupName(String entityName) {
+    public String getEntityGroupName(String entityName, String delegatorName) {
         Map<String, String> gc = getGroupCache();
 
         if (gc != null) {
-            return gc.get(entityName);
+            String groupName = gc.get(entityName);
+            if (groupName == null) {
+                groupName = EntityConfigUtil.getDelegatorInfo(delegatorName).defaultGroupName;
+            }
+            return groupName;
         } else {
             return null;
         }
@@ -184,10 +188,11 @@
     /** Creates a Set with all of the groupNames defined in the specified XML Entity Group Descriptor file.
      * @return A Set of groupNames Strings
      */
-    public Set<String> getGroupNames() {
+    public Set<String> getGroupNames(String delegatorName) {
         getGroupCache();
         if (this.groupNames == null) return null;
         Set<String> newSet = FastSet.newInstance();
+        newSet.add(EntityConfigUtil.getDelegatorInfo(delegatorName).defaultGroupName);
         newSet.addAll(this.groupNames);
         return newSet;
     }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh Thu Jul 24 02:43:27 2008
@@ -32,7 +32,7 @@
 ArrayList records = new ArrayList();
 ArrayList groups = new ArrayList();
 ModelGroupReader mgr = delegator.getModelGroupReader();
-Iterator groupMapIt = mgr.getGroupNames().iterator();
+Iterator groupMapIt = mgr.getGroupNames(delegator.getDelegatorName()).iterator();
 
 while (groupMapIt.hasNext()) {
     groups.add(groupMapIt.next());

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp Thu Jul 24 02:43:27 2008
@@ -311,7 +311,7 @@
   <TR>
     <TD>Group</TD>
     <TD>
-      <INPUT type="text" class='inputBox' size='60' name='entityGroup' value='<%=UtilFormatOut.checkNull(delegator.getModelGroupReader().getEntityGroupName(entityName))%>'>
+      <INPUT type="text" class='inputBox' size='60' name='entityGroup' value='<%=UtilFormatOut.checkNull(delegator.getEntityGroupName(entityName))%>'>
       <BR>(This group is for the "<%=delegator.getDelegatorName()%>" delegator)
     </TD>
   </TR>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelGroupWriter.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelGroupWriter.jsp?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelGroupWriter.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelGroupWriter.jsp Thu Jul 24 02:43:27 2008
@@ -114,7 +114,7 @@
     Iterator i = entities.iterator();
     while (i.hasNext()) {
       String entityName = (String)i.next();
-      String groupName = groupReader.getEntityGroupName(entityName);
+      String groupName = groupReader.getEntityGroupName(entityName, delegator.getDelegatorName());
       if (groupName == null) groupName = "";
 %>
     <entity-group group="<%=groupName%>" entity="<%=entityName%>" /><%

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/minervaObjects.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/minervaObjects.ftl?rev=679331&r1=679330&r2=679331&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/minervaObjects.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/minervaObjects.ftl Thu Jul 24 02:43:27 2008
@@ -23,7 +23,7 @@
     <a href="<@ofbizUrl>minervainfo</@ofbizUrl>" class="smallSubmit">Refresh</a>
 </div>
 
-<#assign groups = delegator.getModelGroupReader().getGroupNames()?if_exists/>
+<#assign groups = delegator.getModelGroupReader().getGroupNames(delegator.getDelegatorName())?if_exists/>
 <table class="basic-table light-grid hover-bar" cellspacing="0">
     <tr class="header-row">
         <td>Helper Name</td>