svn commit: r1444370 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java

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

svn commit: r1444370 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java

jleroux@apache.org
Author: jleroux
Date: Sat Feb  9 14:39:29 2013
New Revision: 1444370

URL: http://svn.apache.org/r1444370
Log:
A patch from Chatree Srichart for "Ignore "tenant" data files if the multitenant property is "N"" https://issues.apache.org/jira/browse/OFBIZ-4934

The system does not need to load tenant data files if the multitenant property in general.properties is "N". I created a patch to ignore the tenant data files when run ./ant load-demo command.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=1444370&r1=1444369&r2=1444370&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Sat Feb  9 14:39:29 2013
@@ -32,6 +32,7 @@ import org.ofbiz.base.config.GenericConf
 import org.ofbiz.base.config.MainResourceHandler;
 import org.ofbiz.base.config.ResourceHandler;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
@@ -99,6 +100,11 @@ public class EntityDataLoader {
                     throw new IllegalArgumentException("Reader name list does not contain String(s) or Element(s)");
                 }
                 readerName = readerName.trim();
+                
+                // ignore the "tenant" reader if the multitenant property is "N"
+                if ("tenant".equals(readerName) && "N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+                    continue;
+                }
 
                 // get all of the main resource model stuff, ie specified in the entityengine.xml file
                 EntityDataReaderInfo entityDataReaderInfo = EntityConfigUtil.getEntityDataReaderInfo(readerName);
@@ -200,6 +206,12 @@ public class EntityDataLoader {
             } else {
                 throw new IllegalArgumentException("Reader name list does not contain String(s) or Element(s)");
             }
+            
+            // ignore the "tenant" reader if the multitenant property is "N"
+            if ("tenant".equals(readerName) && "N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+                continue;
+            }
+            
             readerNames.add(readerName);
         }
         return getUrlByComponentList(helperName, components, readerNames);