svn commit: r585802 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: DelegatorInterface.java GenericDelegator.java

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

svn commit: r585802 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: DelegatorInterface.java GenericDelegator.java

doogie-3
Author: doogie
Date: Wed Oct 17 19:43:54 2007
New Revision: 585802

URL: http://svn.apache.org/viewvc?rev=585802&view=rev
Log:
Add single-arg variants of makeValue, makePK, and clearCacheLine,
that take just an entityName.  Also add removeAll(entityName).

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java?rev=585802&r1=585801&r2=585802&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java Wed Oct 17 19:43:54 2007
@@ -67,12 +67,16 @@
 
     Collection getEntityFieldTypeNames(ModelEntity entity) throws GenericEntityException;
 
+    GenericValue makeValue(String entityName);
+
     GenericValue makeValue(String entityName, Map fields);
 
     GenericValue makeValueSingle(String entityName, Object singlePkValue);
 
     GenericValue makeValidValue(String entityName, Map fields);
 
+    GenericPK makePK(String entityName);
+
     GenericPK makePK(String entityName, Map fields);
 
     GenericPK makePKSingle(String entityName, Object singlePkValue);
@@ -210,6 +214,8 @@
 
     int storeByCondition(String entityName, Map fieldsToSet, EntityCondition condition, boolean doCacheClear) throws GenericEntityException;
 
+    int removeAll(String entityName) throws GenericEntityException;
+
     int removeAll(List dummyPKs) throws GenericEntityException;
 
     int removeAll(List dummyPKs, boolean doCacheClear) throws GenericEntityException;
@@ -217,6 +223,8 @@
     void clearAllCaches();
 
     void clearAllCaches(boolean distribute);
+
+    void clearCacheLine(String entityName);
 
     void clearCacheLine(String entityName, Map fields);
 

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=585802&r1=585801&r2=585802&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Wed Oct 17 19:43:54 2007
@@ -434,6 +434,17 @@
     }
 
     /** Creates a Entity in the form of a GenericValue without persisting it */
+    public GenericValue makeValue(String entityName) {
+        ModelEntity entity = this.getModelEntity(entityName);
+        if (entity == null) {
+            throw new IllegalArgumentException("[GenericDelegator.makeValue] could not find entity for entityName: " + entityName);
+        }
+        GenericValue value = GenericValue.create(entity);
+        value.setDelegator(this);
+        return value;
+    }
+
+    /** Creates a Entity in the form of a GenericValue without persisting it */
     public GenericValue makeValue(String entityName, Map fields) {
         ModelEntity entity = this.getModelEntity(entityName);
         if (entity == null) {
@@ -469,6 +480,18 @@
     }
 
     /** Creates a Primary Key in the form of a GenericPK without persisting it */
+    public GenericPK makePK(String entityName) {
+        ModelEntity entity = this.getModelEntity(entityName);
+        if (entity == null) {
+            throw new IllegalArgumentException("[GenericDelegator.makePK] could not find entity for entityName: " + entityName);
+        }
+        GenericPK pk = GenericPK.create(entity);
+
+        pk.setDelegator(this);
+        return pk;
+    }
+
+    /** Creates a Primary Key in the form of a GenericPK without persisting it */
     public GenericPK makePK(String entityName, Map fields) {
         ModelEntity entity = this.getModelEntity(entityName);
         if (entity == null) {
@@ -1240,6 +1263,10 @@
         }
     }
 
+    public int removeAll(String entityName) throws GenericEntityException {
+        return removeByAnd(entityName, (Map) null);
+    }
+
     /** Remove the Entities from the List from the persistent store.
      *  <br/>The List contains GenericEntity objects, can be either GenericPK or GenericValue.
      *  <br/>If a certain entity contains a complete primary key, the entity in the datasource corresponding
@@ -2252,6 +2279,13 @@
         if (distribute && this.distributedCacheClear != null) {
             this.distributedCacheClear.clearAllCaches();
         }
+    }
+
+    /** Remove all CACHED Generic Entity (List) from the cache
+     *@param entityName The Name of the Entity as defined in the entity XML file
+     */
+    public void clearCacheLine(String entityName) {
+        cache.remove(entityName);
     }
 
     /** Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All