You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/09/22 10:28:59 UTC
svn commit: r1173994 - in /ofbiz/trunk/framework:
entity/src/org/ofbiz/entity/util/EntityDataLoader.java
entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
Author: hansbak
Date: Thu Sep 22 08:28:59 2011
New Revision: 1173994
URL: http://svn.apache.org/viewvc?rev=1173994&view=rev
Log:
correcting the ordering of loading the data for tenants
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.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=1173994&r1=1173993&r2=1173994&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 Thu Sep 22 08:28:59 2011
@@ -25,6 +25,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
+import javolution.util.FastList;
+
import org.ofbiz.base.component.ComponentConfig;
import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.config.MainResourceHandler;
@@ -176,23 +178,33 @@ public class EntityDataLoader {
return urlList;
}
- public static <E> List<URL> getUrlByComponentList(String helperName, List<String> components, List<E> readerNames) {
- String paths = getPathsString(helperName);
+ public static List<URL> getUrlByComponentList(String helperName, List<String> components, List<String> readerNames) {
List<URL> urlList = new LinkedList<URL>();
- for (String component : components) {
- urlList.addAll(getUrlList(helperName, component, readerNames));
+ for (String readerName: readerNames) {
+ List<String> loadReaderNames = FastList.newInstance();
+ loadReaderNames.add(readerName);
+ for (String component : components) {
+ urlList.addAll(getUrlList(helperName, component, loadReaderNames));
+ }
}
return urlList;
}
public static List<URL> getUrlByComponentList(String helperName, List<String> components) {
DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName);
- List<URL> urlList = new LinkedList<URL>();
- for (String component : components) {
- urlList.addAll(getUrlList(helperName, component));
+ List<String> readerNames = FastList.newInstance();
+ for (Object readerInfo : datasourceInfo.readDatas) {
+ String readerName = null;
+ if (readerInfo instanceof Element) {
+ readerName = ((Element) readerInfo).getAttribute("reader-name");
+ } else {
+ throw new IllegalArgumentException("Reader name list does not contain String(s) or Element(s)");
+ }
+ readerNames.add(readerName);
}
- return urlList;
+ return getUrlByComponentList(helperName, components, readerNames);
}
+
public static int loadData(URL dataUrl, String helperName, Delegator delegator, List<Object> errorMessages) throws GenericEntityException {
return loadData(dataUrl, helperName, delegator, errorMessages, -1);
}
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1173994&r1=1173993&r2=1173994&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Thu Sep 22 08:28:59 2011
@@ -313,7 +313,7 @@ public class EntityDataLoadContainer imp
List<EntityExpr> exprs = FastList.newInstance();
exprs.add(EntityCondition.makeCondition("rootLocation", EntityOperator.NOT_LIKE, "%hot-deploy%"));
EntityCondition cond = EntityCondition.makeCondition(exprs);
- List<GenericValue> components = delegator.findList("Component", cond , null, null, null, false);
+ List<GenericValue> components = delegator.findList("Component", cond , null, UtilMisc.toList("lastUpdatedStamp"), null, false);
Debug.logInfo("===== Begin load specify components", module);
if (UtilValidate.isEmpty(this.component)) {
for (GenericValue component : components) {