svn commit: r679456 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/entity/EntityMaint.bsh entity/EntityMaint.ftl

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

svn commit: r679456 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/entity/EntityMaint.bsh entity/EntityMaint.ftl

jacopoc
Author: jacopoc
Date: Thu Jul 24 09:40:18 2008
New Revision: 679456

URL: http://svn.apache.org/viewvc?rev=679456&view=rev
Log:
Added select box to filter entities by group, for example useful ootb to quickly see all the entities related to the BI component.

Modified:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityMaint.ftl

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh?rev=679456&r1=679455&r2=679456&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh Thu Jul 24 09:40:18 2008
@@ -16,13 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import javolution.util.FastList;
+
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.model.ModelGroupReader;
 import org.ofbiz.entity.model.ModelReader;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelViewEntity;
 
 delegator = request.getAttribute("delegator");
 
+ModelGroupReader mgr = delegator.getModelGroupReader();
+Iterator groupMapIt = mgr.getGroupNames(delegator.getDelegatorName()).iterator();
+List entityGroups = FastList.newInstance();
+
+while (groupMapIt.hasNext()) {
+    entityGroups.add(groupMapIt.next());
+}
+
+filterByGroupName = parameters.get("filterByGroupName");
+context.put("filterByGroupName", filterByGroupName);
+
 ModelReader reader = delegator.getModelReader();
 Collection ec = reader.getEntityNames();
 TreeSet entities = new TreeSet(ec);
@@ -33,7 +48,11 @@
 List entitiesList = new ArrayList();
 while (classNamesIterator != null && classNamesIterator.hasNext()) {
     ModelEntity entity = reader.getModelEntity((String)classNamesIterator.next());
-    
+
+    if (UtilValidate.isNotEmpty(filterByGroupName) && !filterByGroupName.equals(delegator.getEntityGroupName(entity.getEntityName()))) {
+     continue;
+    }
+
     String viewEntity = "N";
     if (entity instanceof ModelViewEntity) {
         viewEntity = "Y";
@@ -65,4 +84,5 @@
 
     entitiesList.add(entityMap);
 }
+context.put("entityGroups", entityGroups);
 context.put("entitiesList", entitiesList);

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityMaint.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityMaint.ftl?rev=679456&r1=679455&r2=679456&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityMaint.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityMaint.ftl Thu Jul 24 09:40:18 2008
@@ -24,6 +24,18 @@
     <br class="clear"/>
   </div>
   <div class="screenlet-body">
+    <p>
+       <form target="<@ofbizUrl>/entitymaint</@ofbizUrl>">
+          <b>${uiLabelMap.CommonGroup}:</b>
+          <select name="filterByGroupName">
+             <option value="">${uiLabelMap.CommonAll}</option>
+             <#list entityGroups as group>
+                <option value="${group}" <#if filterByGroupName?exists><#if group = filterByGroupName>selected</#if></#if>>${group}</option>
+             </#list>
+          </select>
+          <input type="submit"/>
+       </form>
+    </p>
     <p><b><u>${uiLabelMap.CommonNote}</u></b></p>
     <p>
        <b>${uiLabelMap.WebtoolsCreate}</b> = ${uiLabelMap.CommonCreateNew}&nbsp;&nbsp;