You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/10/26 21:51:59 UTC

svn commit: r708036 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Author: jleroux
Date: Sun Oct 26 13:51:59 2008
New Revision: 708036

URL: http://svn.apache.org/viewvc?rev=708036&view=rev
Log:
A simplified patch from Marco Risaliti "Errors listing entity in Webtools" (https://issues.apache.org/jira/browse/OFBIZ-1944) - OFBIZ-1944

Modified:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy?rev=708036&r1=708035&r2=708036&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy Sun Oct 26 13:51:59 2008
@@ -22,6 +22,8 @@
 import org.ofbiz.security.Security;
 import org.ofbiz.entity.model.ModelReader;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.model.ModelFieldType;
 import org.ofbiz.entity.GenericEntity;
@@ -40,12 +42,27 @@
 import java.sql.Time;
 import javolution.util.FastList;
 import javolution.util.FastMap;
+import javolution.util.FastSet;
 
 entityName = parameters.entityName;
 
 ModelReader reader = delegator.getModelReader();
 ModelEntity modelEntity = reader.getModelEntity(entityName);
 
+groupByFields = FastList.newInstance();
+functionFields = FastList.newInstance();
+
+if (modelEntity instanceof ModelViewEntity) {    
+    aliases = modelEntity.getAliasesCopy()
+    for (ModelAlias alias : aliases) {
+        if (alias.getGroupBy()) {
+            groupByFields.add(alias.getName());        
+        } else if (alias.getFunction()) {
+            functionFields.add(alias.getName());
+        }
+    }
+}
+
 context.entityName = modelEntity.getEntityName();
 context.plainTableName = modelEntity.getPlainTableName();
 
@@ -143,7 +160,21 @@
             EntityFindOptions efo = new EntityFindOptions();
             efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
             EntityListIterator resultEli = null;
-            resultEli = delegator.find(entityName, condition, null, null, null, efo);
+            fieldsToSelect = [];
+            
+            if (groupByFields || functionFields) {
+                fieldsToSelect = FastSet.newInstance();
+
+                for (ModelField groupByField : groupByFields) {
+                    fieldsToSelect.add(groupByField);
+                }
+
+                for (String functionField : functionFields) {
+                    fieldsToSelect.add(functionField)
+                }
+            }
+            
+            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, null, efo);
             resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1);
             
             arraySize = resultEli.getResultsSizeAfterPartialList();



Re: svn commit: r708036 -/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks for report Bilgin,

Fixed in revision 708157.
Jacques

From: "Bilgin Ibryam" <bi...@iguanait.com>
> Jacques,
> 
> There is something wrong in this commit, I get errors when try to see an
> entity from webtools:
> 
> Bilgin
> 
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://webtools/widget/EntityScreens.xml#FindGeneric]:
> groovy.lang.MissingMethodException: No signature of method:
> org.ofbiz.entity.GenericDelegator.find() is applicable for argument
> types:
> (java.lang.String, org.ofbiz.entity.condition.EntityConditionList, null,
> java.util.ArrayList, null, org.ofbiz.entity.util.EntityFindOptions)
> values:
> {"AcctgTransTypeAttr", , null, [], null,
> org.ofbiz.entity.util.EntityFindOptions@1fe9d5f} (No signature of
> method:
> org.ofbiz.entity.GenericDelegator.find() is applicable for argument
> types:
> (java.lang.String, org.ofbiz.entity.condition.EntityConditionList, null,
> java.util.ArrayList, null, org.ofbiz.entity.util.EntityFindOptions)
> values:
> {"AcctgTransTypeAttr", , null, [], null,
> org.ofbiz.entity.util.EntityFindOptions@1fe9d5f})
>

Re: svn commit: r708036 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Posted by Bilgin Ibryam <bi...@iguanait.com>.
Jacques,

There is something wrong in this commit, I get errors when try to see an
entity from webtools:

Bilgin

org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
[component://webtools/widget/EntityScreens.xml#FindGeneric]:
groovy.lang.MissingMethodException: No signature of method:
org.ofbiz.entity.GenericDelegator.find() is applicable for argument
types:
(java.lang.String, org.ofbiz.entity.condition.EntityConditionList, null,
java.util.ArrayList, null, org.ofbiz.entity.util.EntityFindOptions)
values:
{"AcctgTransTypeAttr", , null, [], null,
org.ofbiz.entity.util.EntityFindOptions@1fe9d5f} (No signature of
method:
org.ofbiz.entity.GenericDelegator.find() is applicable for argument
types:
(java.lang.String, org.ofbiz.entity.condition.EntityConditionList, null,
java.util.ArrayList, null, org.ofbiz.entity.util.EntityFindOptions)
values:
{"AcctgTransTypeAttr", , null, [], null,
org.ofbiz.entity.util.EntityFindOptions@1fe9d5f})