svn commit: r903801 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: cache/AbstractEntityConditionCache.java model/ModelEntity.java

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

svn commit: r903801 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: cache/AbstractEntityConditionCache.java model/ModelEntity.java

doogie-3
Author: doogie
Date: Wed Jan 27 19:51:47 2010
New Revision: 903801

URL: http://svn.apache.org/viewvc?rev=903801&view=rev
Log:
Similiar to the last commit, don't maintain back-links to view entities;
instead, just the names of the entities are stored.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java?rev=903801&r1=903800&r2=903801&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java Wed Jan 27 19:51:47 2010
@@ -165,10 +165,9 @@
             //Debug.logInfo("In storeHook calling sub-storeHook for entity name [" + entityName + "] for the oldEntity: " + oldEntity, module);
         }
         storeHook(entityName, isPK, UtilMisc.toList(oldEntity), UtilMisc.toList(newEntity));
-        Iterator<Map.Entry<String, ModelViewEntity>> it = model.getViewConvertorsIterator();
+        Iterator<String> it = model.getViewConvertorsIterator();
         while (it.hasNext()) {
-            Map.Entry<String, ModelViewEntity> entry = it.next();
-            String targetEntityName = entry.getKey();
+            String targetEntityName = it.next();
             storeHook(targetEntityName, isPK, convert(isPK, targetEntityName, oldEntity), convert(false, targetEntityName, newEntity));
         }
     }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=903801&r1=903800&r2=903801&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Wed Jan 27 19:51:47 2010
@@ -32,6 +32,7 @@
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
+import javolution.util.FastSet;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
@@ -101,7 +102,7 @@
     protected List<ModelIndex> indexes = FastList.newInstance();
 
     /** map of ModelViewEntities that references this model */
-    protected Map<String, ModelViewEntity> viewEntities = FastMap.newInstance();
+    protected Set<String> viewEntities = FastSet.newInstance();
 
     /** An indicator to specify if this entity requires locking for updates */
     protected boolean doLock = false;
@@ -760,29 +761,25 @@
         return this.viewEntities.size();
     }
 
-    public ModelViewEntity getViewEntity(String viewEntityName) {
-        return this.viewEntities.get(viewEntityName);
-    }
-
-    public Iterator<Map.Entry<String, ModelViewEntity>> getViewConvertorsIterator() {
-        return this.viewEntities.entrySet().iterator();
+    public Iterator<String> getViewConvertorsIterator() {
+        return this.viewEntities.iterator();
     }
 
     public void addViewEntity(ModelViewEntity view) {
-        this.viewEntities.put(view.getEntityName(), view);
+        this.viewEntities.add(view.getEntityName());
     }
 
     public List<? extends Map<String, Object>> convertToViewValues(String viewEntityName, GenericEntity entity) {
         if (entity == null || entity == GenericEntity.NULL_ENTITY || entity == GenericValue.NULL_VALUE) return UtilMisc.toList(entity);
-        ModelViewEntity view = this.viewEntities.get(viewEntityName);
+        ModelViewEntity view = (ModelViewEntity) entity.getDelegator().getModelEntity(viewEntityName);
         return view.convert(getEntityName(), entity);
     }
 
-    public ModelViewEntity removeViewEntity(String viewEntityName) {
+    public boolean removeViewEntity(String viewEntityName) {
         return this.viewEntities.remove(viewEntityName);
     }
 
-    public ModelViewEntity removeViewEntity(ModelViewEntity viewEntity) {
+    public boolean removeViewEntity(ModelViewEntity viewEntity) {
        return removeViewEntity(viewEntity.getEntityName());
     }