svn commit: r639022 - in /ofbiz/trunk/framework/webtools: src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java webapp/webtools/artifactinfo/ArtifactInfo.ftl

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

svn commit: r639022 - in /ofbiz/trunk/framework/webtools: src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java webapp/webtools/artifactinfo/ArtifactInfo.ftl

jonesde
Author: jonesde
Date: Wed Mar 19 14:13:30 2008
New Revision: 639022

URL: http://svn.apache.org/viewvc?rev=639022&view=rev
Log:
Added some stuff for entity information in the artifact info class to gather data and in the page to show it

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
    ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=639022&r1=639021&r2=639022&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Wed Mar 19 14:13:30 2008
@@ -265,6 +265,7 @@
         if (curInfo == null) {
             curInfo = new EntityArtifactInfo(entityName, this);
             this.allEntityInfos.put(entityName, curInfo);
+            curInfo.populateAll();
         }
         return curInfo;
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java?rev=639022&r1=639021&r2=639022&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java Wed Mar 19 14:13:30 2008
@@ -18,12 +18,15 @@
  */
 package org.ofbiz.webtools.artifactinfo;
 
+import java.util.List;
 import java.util.Set;
 
 import javolution.util.FastSet;
 
+import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelRelation;
 import org.ofbiz.entityext.eca.EntityEcaRule;
 
 /**
@@ -32,11 +35,26 @@
 public class EntityArtifactInfo extends ArtifactInfoBase {
     protected ModelEntity modelEntity;
     
+    protected Set<EntityArtifactInfo> entitiesRelatedOne = FastSet.newInstance();
+    protected Set<EntityArtifactInfo> entitiesRelatedMany = FastSet.newInstance();
+    
     public EntityArtifactInfo(String entityName, ArtifactInfoFactory aif) throws GenericEntityException {
         super(aif);
         this.modelEntity = this.aif.getModelEntity(entityName);
     }
     
+    public void populateAll() throws GeneralException {
+        List<ModelRelation> relationOneList = modelEntity.getRelationsOneList();
+        for (ModelRelation relationOne: relationOneList) {
+            this.entitiesRelatedOne.add(this.aif.getEntityArtifactInfo(relationOne.getRelEntityName()));
+        }
+        
+        List<ModelRelation> relationManyList = modelEntity.getRelationsManyList();
+        for (ModelRelation relationMany: relationManyList) {
+            this.entitiesRelatedMany.add(this.aif.getEntityArtifactInfo(relationMany.getRelEntityName()));
+        }
+    }
+    
     public ModelEntity getModelEntity() {
         return this.modelEntity;
     }
@@ -66,15 +84,11 @@
     }
     
     public Set<EntityArtifactInfo> getEntitiesRelatedOne() {
-        Set<EntityArtifactInfo> entitySet = FastSet.newInstance();
-        // TODO: implement this
-        return entitySet;
+        return this.entitiesRelatedOne;
     }
 
     public Set<EntityArtifactInfo> getEntitiesRelatedMany() {
-        Set<EntityArtifactInfo> entitySet = FastSet.newInstance();
-        // TODO: implement this
-        return entitySet;
+        return this.entitiesRelatedMany;
     }
     
     /** Get the Services that use this Entity */
@@ -96,14 +110,10 @@
     }
     
     public Set<FormWidgetArtifactInfo> getFormsUsingEntity() {
-        Set<FormWidgetArtifactInfo> formSet = FastSet.newInstance();
-        // TODO: implement this
-        return formSet;
+        return this.aif.allFormInfosReferringToEntityName.get(this.modelEntity.getEntityName());
     }
     
     public Set<ScreenWidgetArtifactInfo> getScreensUsingEntity() {
-        Set<ScreenWidgetArtifactInfo> screenSet = FastSet.newInstance();
-        // TODO: implement this
-        return screenSet;
+        return this.aif.allScreenInfosReferringToEntityName.get(this.modelEntity.getEntityName());
     }
 }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl?rev=639022&r1=639021&r2=639022&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Wed Mar 19 14:13:30 2008
@@ -20,13 +20,31 @@
 
 <#if artifactInfo?exists>
     <h1>Artifact Info (${artifactInfo.getDisplayType()}): ${artifactInfo.getDisplayName()}</h1>
-    
+
     <#if artifactInfo.getType() == "entity">
+        <h2>Entities Related (One)</h2>
+        <#list artifactInfo.getEntitiesRelatedOne()?if_exists as entityArtifactInfo>
+            <@displayEntityArtifactInfo entityArtifactInfo=entityArtifactInfo/>
+        </#list>
+        <h2>Entities Related (Many)</h2>
+        <#list artifactInfo.getEntitiesRelatedMany()?if_exists as entityArtifactInfo>
+            <@displayEntityArtifactInfo entityArtifactInfo=entityArtifactInfo/>
+        </#list>
+        
         <h2>Services Using This Entity</h2>
         <#list artifactInfo.getServicesUsingEntity()?if_exists as serviceArtifactInfo>
             <@displayServiceArtifactInfo serviceArtifactInfo=serviceArtifactInfo/>
         </#list>
         
+        <h2>Forms Using This Entity</h2>
+        <#list artifactInfo.getFormsUsingEntity()?if_exists as formWidgetArtifactInfo>
+            <@displayFormWidgetArtifactInfo formWidgetArtifactInfo=formWidgetArtifactInfo/>
+        </#list>
+        
+        <h2>Screens Using This Entity</h2>
+        <#list artifactInfo.getScreensUsingEntity()?if_exists as screenWidgetArtifactInfo>
+            <@displayScreenWidgetArtifactInfo screenWidgetArtifactInfo=screenWidgetArtifactInfo/>
+        </#list>
     <#elseif artifactInfo.getType() == "service"/>
         <h2>Entities Used By This Service</h2>
         <#list artifactInfo.getEntitiesUsedByService()?if_exists as entityArtifactInfo>