Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java Mon Jan 5 08:50:30 2015 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.string.Flexib import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.MiniLangValidate; import org.ofbiz.minilang.SimpleMethod; @@ -76,7 +77,6 @@ public final class FindByAnd extends Ent boolean useCache = "true".equals(useCacheFse.expandString(methodContext.getEnvMap())); boolean useIterator = "true".equals(useIteratorFse.expandString(methodContext.getEnvMap())); List<String> orderByNames = orderByListFma.get(methodContext.getEnvMap()); - Collection<String> fieldsToSelectList = fieldsToSelectListFma.get(methodContext.getEnvMap()); Delegator delegator = getDelegator(methodContext); try { EntityCondition whereCond = null; @@ -85,9 +85,20 @@ public final class FindByAnd extends Ent whereCond = EntityCondition.makeCondition(fieldMap); } if (useIterator) { - listFma.put(methodContext.getEnvMap(), delegator.find(entityName, whereCond, null, UtilMisc.toSet(fieldsToSelectList), orderByNames, null)); + listFma.put(methodContext.getEnvMap(), EntityQuery.use(delegator) + .select(UtilMisc.toSet(fieldsToSelectListFma.get(methodContext.getEnvMap()))) + .from(entityName) + .where(whereCond) + .orderBy(orderByNames) + .queryList()); } else { - listFma.put(methodContext.getEnvMap(), delegator.findList(entityName, whereCond, UtilMisc.toSet(fieldsToSelectList), orderByNames, null, useCache)); + listFma.put(methodContext.getEnvMap(), EntityQuery.use(delegator) + .select(UtilMisc.toSet(fieldsToSelectListFma.get(methodContext.getEnvMap()))) + .from(entityName) + .where(whereCond) + .orderBy(orderByNames) + .cache(useCache) + .queryList()); } } catch (GenericEntityException e) { String errMsg = "Exception thrown while performing entity find: " + e.getMessage(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java Mon Jan 5 08:50:30 2015 @@ -29,6 +29,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.MiniLangRuntimeException; import org.ofbiz.minilang.MiniLangValidate; @@ -88,7 +89,7 @@ public final class FindByPrimaryKey exte if (fieldsToSelectList != null) { valueFma.put(methodContext.getEnvMap(), delegator.findByPrimaryKeyPartial(delegator.makePK(entityName, inMap), UtilMisc.toSet(fieldsToSelectList))); } else { - valueFma.put(methodContext.getEnvMap(), delegator.findOne(entityName, inMap, useCache)); + valueFma.put(methodContext.getEnvMap(), EntityQuery.use(delegator).from(entityName).where(inMap).cache(useCache).queryOne()); } } catch (GenericEntityException e) { String errMsg = "Exception thrown while performing entity find: " + e.getMessage(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java Mon Jan 5 08:50:30 2015 @@ -20,7 +20,6 @@ package org.ofbiz.minilang.method.entity import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.MiniLangException; @@ -40,8 +39,6 @@ public final class RefreshValue extends public static final String module = RemoveValue.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleMapAccessor<GenericValue> valueFma; public RefreshValue(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -53,7 +50,6 @@ public final class RefreshValue extends MiniLangValidate.noChildElements(simpleMethod, element); } valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -62,7 +58,6 @@ public final class RefreshValue extends if (value == null) { throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this); } - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { value.getDelegator().refresh(value); } catch (GenericEntityException e) { @@ -78,9 +73,6 @@ public final class RefreshValue extends public String toString() { StringBuilder sb = new StringBuilder("<refresh-value "); sb.append("value-field=\"").append(this.valueFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java Mon Jan 5 08:50:30 2015 @@ -41,8 +41,6 @@ import org.w3c.dom.Element; public final class RemoveByAnd extends EntityOperation { public static final String module = RemoveByAnd.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleStringExpander entityNameFse; private final FlexibleMapAccessor<Map<String, ? extends Object>> mapFma; @@ -56,20 +54,18 @@ public final class RemoveByAnd extends E } entityNameFse = FlexibleStringExpander.getInstance(element.getAttribute("entity-name")); mapFma = FlexibleMapAccessor.getInstance(element.getAttribute("map")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override public boolean exec(MethodContext methodContext) throws MiniLangException { @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); String entityName = entityNameFse.expandString(methodContext.getEnvMap()); if (entityName.isEmpty()) { throw new MiniLangRuntimeException("Entity name not found.", this); } try { Delegator delegator = getDelegator(methodContext); - delegator.removeByAnd(entityName, mapFma.get(methodContext.getEnvMap()), doCacheClear); + delegator.removeByAnd(entityName, mapFma.get(methodContext.getEnvMap())); } catch (GenericEntityException e) { String errMsg = "Exception thrown while removing entities: " + e.getMessage(); Debug.logWarning(e, errMsg, module); @@ -89,9 +85,6 @@ public final class RemoveByAnd extends E StringBuilder sb = new StringBuilder("<remove-by-and "); sb.append("entity-name=\"").append(this.entityNameFse).append("\" "); sb.append("map=\"").append(this.mapFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java Mon Jan 5 08:50:30 2015 @@ -22,7 +22,6 @@ import java.util.List; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -41,8 +40,6 @@ import org.w3c.dom.Element; public final class RemoveList extends EntityOperation { public static final String module = RemoveList.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleMapAccessor<List<GenericValue>> listFma; public RemoveList(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -54,7 +51,6 @@ public final class RemoveList extends En MiniLangValidate.noChildElements(simpleMethod, element); } listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -63,8 +59,6 @@ public final class RemoveList extends En if (values == null) { throw new MiniLangRuntimeException("Entity value list not found with name: " + listFma, this); } - @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { Delegator delegator = getDelegator(methodContext); delegator.removeAll(values); @@ -81,9 +75,6 @@ public final class RemoveList extends En public String toString() { StringBuilder sb = new StringBuilder("<remove-list "); sb.append("list=\"").append(this.listFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java Mon Jan 5 08:50:30 2015 @@ -40,8 +40,6 @@ import org.w3c.dom.Element; public final class RemoveRelated extends MethodOperation { public static final String module = RemoveRelated.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleStringExpander relationNameFse; private final FlexibleMapAccessor<GenericValue> valueFma; @@ -55,7 +53,6 @@ public final class RemoveRelated extends } valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field")); relationNameFse = FlexibleStringExpander.getInstance(element.getAttribute("relation-name")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -65,8 +62,6 @@ public final class RemoveRelated extends throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this); } String relationName = relationNameFse.expandString(methodContext.getEnvMap()); - @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { value.getDelegator().removeRelated(relationName, value); } catch (GenericEntityException e) { @@ -88,9 +83,6 @@ public final class RemoveRelated extends StringBuilder sb = new StringBuilder("<remove-related "); sb.append("value-field=\"").append(this.valueFma).append("\" "); sb.append("relation-name=\"").append(this.relationNameFse).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java Mon Jan 5 08:50:30 2015 @@ -20,7 +20,6 @@ package org.ofbiz.minilang.method.entity import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.MiniLangException; @@ -39,8 +38,6 @@ import org.w3c.dom.Element; public final class RemoveValue extends MethodOperation { public static final String module = RemoveValue.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleMapAccessor<GenericValue> valueFma; public RemoveValue(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -52,7 +49,6 @@ public final class RemoveValue extends M MiniLangValidate.noChildElements(simpleMethod, element); } valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -61,8 +57,6 @@ public final class RemoveValue extends M if (value == null) { throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this); } - @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { value.getDelegator().removeValue(value); } catch (GenericEntityException e) { @@ -78,9 +72,6 @@ public final class RemoveValue extends M public String toString() { StringBuilder sb = new StringBuilder("<remove-value "); sb.append("value-field=\"").append(this.valueFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java Mon Jan 5 08:50:30 2015 @@ -22,7 +22,6 @@ import java.util.List; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -41,8 +40,6 @@ import org.w3c.dom.Element; public final class StoreList extends EntityOperation { public static final String module = StoreList.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleMapAccessor<List<GenericValue>> listFma; public StoreList(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -54,7 +51,6 @@ public final class StoreList extends Ent MiniLangValidate.noChildElements(simpleMethod, element); } listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -63,8 +59,6 @@ public final class StoreList extends Ent if (values == null) { throw new MiniLangRuntimeException("Entity value list not found with name: " + listFma, this); } - @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { Delegator delegator = getDelegator(methodContext); delegator.storeAll(values); @@ -81,9 +75,6 @@ public final class StoreList extends Ent public String toString() { StringBuilder sb = new StringBuilder("<store-list "); sb.append("list=\"").append(this.listFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java Mon Jan 5 08:50:30 2015 @@ -20,7 +20,6 @@ package org.ofbiz.minilang.method.entity import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.MiniLangException; @@ -39,8 +38,6 @@ import org.w3c.dom.Element; public final class StoreValue extends MethodOperation { public static final String module = StoreValue.class.getName(); - @Deprecated - private final FlexibleStringExpander doCacheClearFse; private final FlexibleMapAccessor<GenericValue> valueFma; public StoreValue(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -52,7 +49,6 @@ public final class StoreValue extends Me MiniLangValidate.noChildElements(simpleMethod, element); } valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field")); - doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear")); } @Override @@ -61,8 +57,6 @@ public final class StoreValue extends Me if (value == null) { throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this); } - @Deprecated - boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap())); try { value.getDelegator().store(value); } catch (GenericEntityException e) { @@ -78,9 +72,6 @@ public final class StoreValue extends Me public String toString() { StringBuilder sb = new StringBuilder("<store-value "); sb.append("value-field=\"").append(this.valueFma).append("\" "); - if (!doCacheClearFse.isEmpty()) { - sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" "); - } sb.append("/>"); return sb.toString(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/security/src/org/ofbiz/security/SecurityFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/security/src/org/ofbiz/security/SecurityFactory.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/security/src/org/ofbiz/security/SecurityFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/security/src/org/ofbiz/security/SecurityFactory.java Mon Jan 5 08:50:30 2015 @@ -38,6 +38,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; /** @@ -104,7 +105,7 @@ public final class SecurityFactory { @Override public Iterator<GenericValue> findUserLoginSecurityGroupByUserLoginId(String userLoginId) { try { - List<GenericValue> collection = EntityUtil.filterByDate(delegator.findByAnd("UserLoginSecurityGroup", UtilMisc.toMap("userLoginId", userLoginId), null, true)); + List<GenericValue> collection = EntityUtil.filterByDate(EntityQuery.use(delegator).from("UserLoginSecurityGroup").where("userLoginId", userLoginId).cache(true).queryList()); return collection.iterator(); } catch (GenericEntityException e) { Debug.logWarning(e, module); @@ -197,7 +198,7 @@ public final class SecurityFactory { if (hasEntityPermission(application + "_ROLE", action, userLogin)) { // we have the permission now, we check to make sure we are allowed access try { - List<GenericValue> roleTest = delegator.findList(entityName, condition, null, null, null, false); + List<GenericValue> roleTest = EntityQuery.use(delegator).from(entityName).where(condition).queryList(); if (!roleTest.isEmpty()) { return true; } @@ -263,7 +264,7 @@ public final class SecurityFactory { @Override public boolean securityGroupPermissionExists(String groupId, String permission) { try { - return delegator.findOne("SecurityGroupPermission", UtilMisc.toMap("groupId", groupId, "permissionId", permission), true) != null; + return EntityQuery.use(delegator).from("SecurityGroupPermission").where("groupId", groupId, "permissionId", permission).cache(true).queryOne() != null; } catch (GenericEntityException e) { Debug.logWarning(e, module); return false; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelService.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelService.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelService.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelService.java Mon Jan 5 08:50:30 2015 @@ -63,7 +63,7 @@ import org.ofbiz.base.metrics.Metrics; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.ObjectType; -import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -584,7 +584,7 @@ public class ModelService extends Abstra if (context.get(modelParam.name) != null && ("String".equals(modelParam.type) || "java.lang.String".equals(modelParam.type)) && !"any".equals(modelParam.allowHtml) && ("INOUT".equals(modelParam.mode) || "IN".equals(modelParam.mode))) { String value = (String) context.get(modelParam.name); - StringUtil.checkStringForHtmlStrictNone(modelParam.name, value, errorMessageList); + UtilCodec.checkStringForHtmlStrictNone(modelParam.name, value, errorMessageList); } } if (errorMessageList.size() > 0) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java Mon Jan 5 08:50:30 2015 @@ -45,7 +45,6 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; -import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.security.Security; @@ -399,12 +398,6 @@ public class ServiceUtil { EntityCondition finished = EntityCondition.makeCondition(finExp); EntityCondition doneCond = EntityCondition.makeCondition(UtilMisc.toList(cancelled, finished), EntityOperator.OR); - EntityCondition mainCond = EntityCondition.makeCondition(UtilMisc.toList(doneCond, pool)); - - // configure the find options - EntityFindOptions findOptions = new EntityFindOptions(); - findOptions.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE); - findOptions.setMaxRows(1000); // always suspend the current transaction; use the one internally Transaction parent = null; @@ -426,7 +419,13 @@ public class ServiceUtil { EntityListIterator foundJobs = null; try { - foundJobs = delegator.find("JobSandbox", mainCond, null, UtilMisc.toSet("jobId"), null, findOptions); + foundJobs = EntityQuery.use(delegator) + .select("jobId") + .from("JobSandbox") + .where(EntityCondition.makeCondition(UtilMisc.toList(doneCond, pool))) + .cursorScrollInsensitive() + .maxRows(1000) + .queryIterator(); curList = foundJobs.getPartialList(1, 1000); } finally { if (foundJobs != null) { @@ -486,12 +485,12 @@ public class ServiceUtil { // begin this transaction beganTx3 = TransactionUtil.begin(); - runTimeDataIt = delegator.find("RuntimeData", null, null, UtilMisc.toSet("runtimeDataId"), null, null); + runTimeDataIt = EntityQuery.use(delegator).select("runtimeDataId").from("RuntimeData").queryIterator(); try { while ((runtimeData = runTimeDataIt.next()) != null) { EntityCondition whereCondition = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("runtimeDataId", EntityOperator.NOT_EQUAL, null), EntityCondition.makeCondition("runtimeDataId", EntityOperator.EQUALS, runtimeData.getString("runtimeDataId"))), EntityOperator.AND); - jobsandBoxCount = delegator.findCountByCondition("JobSandbox", whereCondition, null, null); + jobsandBoxCount = EntityQuery.use(delegator).from("JobSandbox").where(whereCondition).queryCount(); if (BigDecimal.ZERO.compareTo(BigDecimal.valueOf(jobsandBoxCount)) == 0) { runtimeDataToDelete.add(runtimeData); } @@ -548,7 +547,7 @@ public class ServiceUtil { GenericValue job = null; try { - job = delegator.findOne("JobSandbox", fields, false); + job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", jobId).queryOne(); if (job != null) { job.set("cancelDateTime", UtilDateTime.nowTimestamp()); job.set("statusId", "SERVICE_CANCELLED"); @@ -587,7 +586,7 @@ public class ServiceUtil { GenericValue job = null; try { - job = delegator.findOne("JobSandbox", fields, false); + job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", jobId).queryOne(); if (job != null) { job.set("maxRetry", Long.valueOf(0)); job.store(); @@ -666,10 +665,9 @@ public class ServiceUtil { } String jobId = (String) context.get("jobId"); - Map<String, ? extends Object> fields = UtilMisc.toMap("jobId", jobId); GenericValue job; try { - job = delegator.findOne("JobSandbox", fields, false); + job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", jobId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java Mon Jan 5 08:50:30 2015 @@ -32,6 +32,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; import com.ibm.icu.util.Calendar; @@ -140,13 +141,17 @@ public class ExpressionUiHelper { * @return Set of candidate tempExprId Strings */ public static Set<String> getCandidateIncludeIds(Delegator delegator, String tempExprId) throws GenericEntityException { - List<GenericValue> findList = delegator.findList("TemporalExpressionAssoc", EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, true); + List<GenericValue> findList = EntityQuery.use(delegator) + .from("TemporalExpressionAssoc") + .where("fromTempExprId", tempExprId) + .cache(true) + .queryList(); Set<String> excludedIds = new HashSet<String>(); for (GenericValue value : findList) { excludedIds.add(value.getString("toTempExprId")); } excludedIds.add(tempExprId); - findList = delegator.findList("TemporalExpression", null, null, null, null, true); + findList = EntityQuery.use(delegator).from("TemporalExpression").cache(true).queryList(); Set<String> candidateIds = new HashSet<String>(); for (GenericValue value : findList) { candidateIds.add(value.getString("tempExprId")); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java Mon Jan 5 08:50:30 2015 @@ -94,7 +94,7 @@ public class TemporalExpressionWorker { } else if (DayOfWeekRange.equals(tempExprTypeId)) { return setExpressionId(exprValue, new TemporalExpressions.DayOfWeekRange(exprValue.getLong("integer1").intValue(), exprValue.getLong("integer2").intValue())); } else if (Difference.equals(tempExprTypeId)) { - List<GenericValue> childExpressions = delegator.findList("TemporalExpressionAssoc", EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, true); + List<GenericValue> childExpressions = EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId", tempExprId).cache(true).queryList(); GenericValue inclAssoc = null; GenericValue exclAssoc = null; for (GenericValue childExpression : childExpressions) { @@ -118,7 +118,7 @@ public class TemporalExpressionWorker { } else if (MonthRange.equals(tempExprTypeId)) { return setExpressionId(exprValue, new TemporalExpressions.MonthRange(exprValue.getLong("integer1").intValue(), exprValue.getLong("integer2").intValue())); } else if (Substitution.equals(tempExprTypeId)) { - List<GenericValue> childExpressions = delegator.findList("TemporalExpressionAssoc", EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, true); + List<GenericValue> childExpressions = EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId", tempExprId).cache(true).queryList(); GenericValue inclAssoc = null; GenericValue exclAssoc = null; GenericValue substAssoc = null; @@ -141,7 +141,7 @@ public class TemporalExpressionWorker { } protected static Set<TemporalExpression> getChildExpressions(Delegator delegator, String tempExprId) throws GenericEntityException { - List<GenericValue> valueList = delegator.findList("TemporalExpressionAssoc", EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, true); + List<GenericValue> valueList = EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId", tempExprId).cache(true).queryList(); if (UtilValidate.isEmpty(valueList)) { throw new IllegalArgumentException("tempExprId argument invalid - no child expressions found"); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/JobManager.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/JobManager.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/JobManager.java Mon Jan 5 08:50:30 2015 @@ -45,6 +45,7 @@ import org.ofbiz.entity.serialize.Serial import org.ofbiz.entity.serialize.XmlSerializer; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceContainer; @@ -191,7 +192,7 @@ public final class JobManager { Debug.logWarning("Unable to poll JobSandbox for jobs; unable to begin transaction.", module); return poll; } - jobsIterator = delegator.find("JobSandbox", mainCondition, null, null, UtilMisc.toList("runTime"), null); + jobsIterator = EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("runTime").queryIterator(); GenericValue jobValue = jobsIterator.next(); while (jobValue != null) { // Claim ownership of this value. Using storeByCondition to avoid a race condition. @@ -247,7 +248,7 @@ public final class JobManager { Debug.logWarning("Unable to poll JobSandbox for jobs; unable to begin transaction.", module); return Collections.emptyList(); } - jobsIterator = delegator.find("JobSandbox", mainCondition, null, null, UtilMisc.toList("jobId"), null); + jobsIterator = EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("jobId").queryIterator(); GenericValue jobValue = jobsIterator.next(); while (jobValue != null) { poll.add(new PurgeJob(jobValue)); @@ -291,7 +292,7 @@ public final class JobManager { EntityCondition statusCondition = EntityCondition.makeCondition(statusExprList, EntityOperator.OR); EntityCondition mainCondition = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("runByInstanceId", instanceId), statusCondition)); try { - crashed = delegator.findList("JobSandbox", mainCondition, null, UtilMisc.toList("startDateTime"), null, false); + crashed = EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("startDateTime").queryList(); } catch (GenericEntityException e) { Debug.logWarning(e, "Unable to load crashed jobs", module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java Mon Jan 5 08:50:30 2015 @@ -39,6 +39,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityFieldMap; import org.ofbiz.entity.serialize.SerializeException; import org.ofbiz.entity.serialize.XmlSerializer; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericRequester; import org.ofbiz.service.ServiceUtil; @@ -321,8 +322,7 @@ public class PersistedServiceJob extends } long count = 0; try { - EntityFieldMap ecl = EntityCondition.makeConditionMap("parentJobId", pJobId, "statusId", "SERVICE_FAILED"); - count = delegator.findCountByCondition("JobSandbox", ecl, null, null); + count = EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", pJobId, "statusId", "SERVICE_FAILED").queryCount(); } catch (GenericEntityException e) { Debug.logError(e, "Exception thrown while counting retries: ", module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java Mon Jan 5 08:50:30 2015 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.ServiceUtil; import org.ofbiz.service.testtools.OFBizTestCase; @@ -50,7 +51,7 @@ public class ServiceEntityAutoTests exte testingPkPresentMap.put("testingName", "entity auto testing"); Map<String, Object> results = dispatcher.runSync("testEntityAutoCreateTestingPkPresent", testingPkPresentMap); assertTrue(ServiceUtil.isSuccess(results)); - GenericValue testing = delegator.findOne("Testing", false, "testingId", "TESTING_1"); + GenericValue testing = EntityQuery.use(delegator).from("Testing").where("testingId", "TESTING_1").queryOne(); assertNotNull(testing); //test create with auto sequence @@ -58,7 +59,7 @@ public class ServiceEntityAutoTests exte testingPkPresentMap.put("testingName", "entity auto testing without pk part in"); results = dispatcher.runSync("testEntityAutoCreateTestingPkMissing", testingPkMissingMap); assertTrue(ServiceUtil.isSuccess(results)); - testing = delegator.findOne("Testing", false, "testingId", results.get("testingId")); + testing = EntityQuery.use(delegator).from("Testing").where("testingId", results.get("testingId")).queryOne(); assertNotNull(testing); //test collision @@ -73,14 +74,20 @@ public class ServiceEntityAutoTests exte Map<String, Object> testingItemPkPresentMap = UtilMisc.toMap("testingId", "TESTING_2", "testingSeqId", "00001"); Map<String, Object> results = dispatcher.runSync("testEntityAutoCreateTestingItemPkPresent", testingItemPkPresentMap); assertTrue(ServiceUtil.isSuccess(results)); - GenericValue testingItem = delegator.findOne("TestingItem", false, "testingId", "TESTING_2", "testingSeqId", "00001"); + GenericValue testingItem = EntityQuery.use(delegator) + .from("TestingItem") + .where("testingId", "TESTING_2", "testingSeqId", "00001") + .queryOne(); assertNotNull(testingItem); //test create with auto sub-sequence Map<String, Object> testingItemPkMissingMap = UtilMisc.toMap("testingId", "TESTING_2"); results = dispatcher.runSync("testEntityAutoCreateTestingItemPkMissing", testingItemPkMissingMap); assertTrue(ServiceUtil.isSuccess(results)); - testingItem = delegator.findOne("TestingItem", false, "testingId", "TESTING_2", "testingSeqId", results.get("testingSeqId")); + testingItem = EntityQuery.use(delegator) + .from("TestingItem") + .where("testingId", "TESTING_2", "testingSeqId", results.get("testingSeqId")) + .queryOne(); assertNotNull(testingItem); assertEquals("00002", testingItem.get("testingSeqId")); @@ -99,7 +106,10 @@ public class ServiceEntityAutoTests exte "testingNodeId", "NODE_1", "fromDate", UtilDateTime.toTimestamp("01/01/2010 00:00:00")); Map<String, Object> results = dispatcher.runSync("testEntityAutoCreateTestingNodeMemberPkPresent", testingNodeMemberPkPresentMap); assertTrue(ServiceUtil.isSuccess(results)); - GenericValue testingNodeMember = delegator.findOne("TestingNodeMember", false, testingNodeMemberPkPresentMap); + GenericValue testingNodeMember = EntityQuery.use(delegator) + .from("TestingNodeMember") + .where(testingNodeMemberPkPresentMap) + .queryOne(); assertNotNull(testingNodeMember); testingNodeMember.remove(); @@ -117,7 +127,7 @@ public class ServiceEntityAutoTests exte Map<String, Object> testingUpdateMap = UtilMisc.toMap("testingId", "TESTING_4", "testingName", "entity auto testing updated"); Map<String, Object> results = dispatcher.runSync("testEntityAutoUpdateTesting", testingUpdateMap); assertTrue(ServiceUtil.isSuccess(results)); - GenericValue testing = delegator.findOne("Testing", false, "testingId", "TESTING_4"); + GenericValue testing = EntityQuery.use(delegator).from("Testing").where("testingId", "TESTING_4").queryOne(); assertEquals("entity auto testing updated", testing.getString("testingName")); //test update with bad pk @@ -134,7 +144,7 @@ public class ServiceEntityAutoTests exte Map<String, Object> testingDeleteMap = UtilMisc.toMap("testingId", "TESTING_5"); Map<String, Object> results = dispatcher.runSync("testEntityAutoRemoveTesting", testingDeleteMap); assertTrue(ServiceUtil.isSuccess(results)); - GenericValue testing = delegator.findOne("Testing", false, "testingId", "TESTING_5"); + GenericValue testing = EntityQuery.use(delegator).from("Testing").where("testingId", "TESTING_5").queryOne(); assertNull(testing); //test create with bad pk Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/testtools/src/org/ofbiz/testtools/EntityXmlAssertTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/testtools/src/org/ofbiz/testtools/EntityXmlAssertTest.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/testtools/src/org/ofbiz/testtools/EntityXmlAssertTest.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/testtools/src/org/ofbiz/testtools/EntityXmlAssertTest.java Mon Jan 5 08:50:30 2015 @@ -58,8 +58,8 @@ public class EntityXmlAssertTest extends int testCaseCount = 0; try { URL entityXmlURL = FlexibleLocation.resolveLocation(entityXmlUrlString); - List<GenericValue> checkValueList = delegator.readXmlDocument(entityXmlURL); - testCaseCount = checkValueList.size(); + EntitySaxReader reader = new EntitySaxReader(delegator); + testCaseCount += reader.parse(entityXmlURL); } catch (Exception e) { Debug.logError(e, "Error getting test case count", module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.properties?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.properties (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.properties Mon Jan 5 08:50:30 2015 @@ -21,7 +21,7 @@ fop.path=/framework/webapp/config #Set default font family -fop.font.family=any +fop.font.family=NotoSans #Set font base url fop.font.base.url=/framework/webapp/config/ Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.xconf URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.xconf?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.xconf (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/config/fop.xconf Mon Jan 5 08:50:30 2015 @@ -95,6 +95,8 @@ the location of this file. <font-triplet name="ArialMT" style="normal" weight="bold"/> </font> --> + <auto-detect/> + <directory>framework/resources/fonts/NotoSans</directory> </fonts> <!-- This option lets you specify additional options on an XML handler --> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/entitydef/entitymodel.xml?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/entitydef/entitymodel.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/entitydef/entitymodel.xml Mon Jan 5 08:50:30 2015 @@ -88,12 +88,6 @@ under the License. <relation type="one" fk-name="SERVER_HIT_VISIT" rel-entity-name="Visit"> <key-map field-name="visitId"/> </relation> - <relation type="one" fk-name="SERVER_HIT_STATUS" rel-entity-name="StatusItem"> - <key-map field-name="statusId"/> - </relation> - <relation type="one" fk-name="SERVER_HIT_USER" rel-entity-name="UserLogin"> - <key-map field-name="userLoginId"/> - </relation> </entity> <entity entity-name="ServerHitBin" package-name="org.ofbiz.webapp.visit" never-cache="true" title="Server Hit Bin Entity"> <field name="serverHitBinId" type="id-ne"></field> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/ofbiz-component.xml?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/ofbiz-component.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/ofbiz-component.xml Mon Jan 5 08:50:30 2015 @@ -30,6 +30,9 @@ under the License. <classpath type="jar" location="build/lib/*"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> + <!-- + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/> + --> <!--<test-suite loader="main" location="testdef/webapptests.xml"/>--> </ofbiz-component> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Mon Jan 5 08:50:30 2015 @@ -47,6 +47,7 @@ import org.ofbiz.entity.DelegatorFactory import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.security.SecurityConfigurationException; @@ -258,14 +259,14 @@ public class ContextFilter implements Fi //Use base delegator for fetching data from entity of entityGroup org.ofbiz.tenant Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName()); - GenericValue tenantDomainName = baseDelegator.findOne("TenantDomainName", UtilMisc.toMap("domainName", serverName), false); + GenericValue tenantDomainName = EntityQuery.use(baseDelegator).from("TenantDomainName").where("domainName", serverName).queryOne(); if (UtilValidate.isNotEmpty(tenantDomainName)) { String tenantId = tenantDomainName.getString("tenantId"); // if the request path is a root mount then redirect to the initial path if (UtilValidate.isNotEmpty(requestPath) && requestPath.equals(contextUri)) { - GenericValue tenant = baseDelegator.findOne("Tenant", UtilMisc.toMap("tenantId", tenantId), false); + GenericValue tenant = EntityQuery.use(baseDelegator).from("Tenant").where("tenantId", tenantId).queryOne(); String initialPath = tenant.getString("initialPath"); if (UtilValidate.isNotEmpty(initialPath) && !"/".equals(initialPath)) { ((HttpServletResponse)response).sendRedirect(initialPath); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Mon Jan 5 08:50:30 2015 @@ -32,7 +32,7 @@ import javax.servlet.http.HttpSession; import org.apache.bsf.BSFManager; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilTimer; @@ -217,8 +217,7 @@ public class ControlServlet extends Http if (Debug.verboseOn()) Debug.logVerbose(throwable, module); } else { Debug.logError(throwable, "Error in request handler: ", module); - StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder(); - request.setAttribute("_ERROR_MESSAGE_", encoder.encode(throwable.toString())); + request.setAttribute("_ERROR_MESSAGE_", UtilCodec.getEncoder("html").encode(throwable.toString())); errorPage = requestHandler.getDefaultErrorPage(request); } } catch (RequestHandlerExceptionAllowExternalRequests e) { @@ -226,8 +225,7 @@ public class ControlServlet extends Http Debug.logInfo("Going to external page: " + request.getPathInfo(), module); } catch (Exception e) { Debug.logError(e, "Error in request handler: ", module); - StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder(); - request.setAttribute("_ERROR_MESSAGE_", encoder.encode(e.toString())); + request.setAttribute("_ERROR_MESSAGE_", UtilCodec.getEncoder("html").encode(e.toString())); errorPage = requestHandler.getDefaultErrorPage(request); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Mon Jan 5 08:50:30 2015 @@ -237,7 +237,7 @@ public class LoginWorker { // check if they have permission for this login attempt; if not log them out if (userLogin != null) { List<Object> errorMessageList = UtilGenerics.checkList(request.getAttribute("_ERROR_MESSAGE_LIST")); - if (!hasBasePermission(userLogin, request) || isFlaggedLoggedOut(userLogin)) { + if (!hasBasePermission(userLogin, request) || isFlaggedLoggedOut(userLogin, userLogin.getDelegator())) { if (errorMessageList == null) { errorMessageList = new LinkedList<Object>(); request.setAttribute("_ERROR_MESSAGE_LIST", errorMessageList); @@ -1020,7 +1020,7 @@ public class LoginWorker { EntityConditionList<EntityCondition> condition = EntityCondition.makeCondition(conds); Debug.logInfo("Doing issuer lookup: " + condition.toString(), module); - long count = delegator.findCountByCondition("X509IssuerProvision", condition, null, null); + long count = EntityQuery.use(delegator).from("X509IssuerProvision").where(condition).queryCount(); return count > 0; } @@ -1066,8 +1066,8 @@ public class LoginWorker { return "success"; } - public static boolean isFlaggedLoggedOut(GenericValue userLogin) { - if ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "login.disable.global.logout"))) { + public static boolean isFlaggedLoggedOut(GenericValue userLogin, Delegator delegator) { + if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "login.disable.global.logout", delegator))) { return false; } if (userLogin == null || userLogin.get("userLoginId") == null) { @@ -1180,7 +1180,7 @@ public class LoginWorker { if (reqToChangePwdInDays > 0) { List<GenericValue> passwordHistories = null; try { - passwordHistories = delegator.findByAnd("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", userName), null, false); + passwordHistories = EntityQuery.use(delegator).from("UserLoginPasswordHistory").where("userLoginId", userName).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get user's password history record: " + e.getMessage(), module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java Mon Jan 5 08:50:30 2015 @@ -34,6 +34,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; /** * Common Workers @@ -64,15 +65,21 @@ public class ProtectViewWorker { if (userLogin != null) { String userLoginId = userLogin.getString("userLoginId"); try { - List<GenericValue> protectedViews = delegator.findByAnd("UserLoginAndProtectedView", - UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId), null, true); + List<GenericValue> protectedViews = EntityQuery.use(delegator) + .from("UserLoginAndProtectedView") + .where("userLoginId", userLoginId, "viewNameId", viewNameId) + .cache(true) + .queryList(); // Any views to deal with ? if (UtilValidate.isNotEmpty(protectedViews)) { Long now = System.currentTimeMillis(); // we are not in a margin of some milliseconds // Is this login/view couple already tarpitted ? (ie denied access to view for login for a period of time) - List<GenericValue> tarpittedLoginViews = delegator.findByAnd("TarpittedLoginView", - UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId), null, true); + List<GenericValue> tarpittedLoginViews = EntityQuery.use(delegator) + .from("TarpittedLoginView") + .where("userLoginId", userLoginId, "viewNameId", viewNameId) + .cache(true) + .queryList(); String viewNameUserLoginId = viewNameId + userLoginId; if (UtilValidate.isNotEmpty(tarpittedLoginViews)) { GenericValue tarpittedLoginView = tarpittedLoginViews.get(0); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Mon Jan 5 08:50:30 2015 @@ -40,6 +40,7 @@ import org.ofbiz.base.start.Start; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.SSLUtil; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; @@ -62,7 +63,6 @@ import org.ofbiz.webapp.view.ViewHandler import org.ofbiz.webapp.view.ViewHandlerException; import org.ofbiz.webapp.website.WebSiteProperties; import org.ofbiz.webapp.website.WebSiteWorker; -import org.owasp.esapi.errors.EncodingException; import org.python.modules.re; /** @@ -71,8 +71,6 @@ import org.python.modules.re; public class RequestHandler { public static final String module = RequestHandler.class.getName(); - private static final boolean throwRequestHandlerExceptionOnMissingLocalRequest = UtilProperties.propertyValueEqualsIgnoreCase( - "requestHandler.properties", "throwRequestHandlerExceptionOnMissingLocalRequest", "Y"); private final String defaultStatusCodeString = UtilProperties.getPropertyValue("requestHandler.properties", "status-code", "302"); private final ViewFactory viewFactory; private final EventFactory eventFactory; @@ -131,6 +129,8 @@ public class RequestHandler { public void doRequest(HttpServletRequest request, HttpServletResponse response, String chain, GenericValue userLogin, Delegator delegator) throws RequestHandlerException, RequestHandlerExceptionAllowExternalRequests { + final boolean throwRequestHandlerExceptionOnMissingLocalRequest = EntityUtilProperties.propertyValueEqualsIgnoreCase( + "requestHandler.properties", "throwRequestHandlerExceptionOnMissingLocalRequest", "Y", delegator); long startTime = System.currentTimeMillis(); HttpSession session = request.getSession(); @@ -280,7 +280,7 @@ public class RequestHandler { } } if (enableHttps == null) { - enableHttps = UtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y"); + enableHttps = EntityUtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y", delegator); } if (Boolean.FALSE.equals(enableHttps)) { @@ -1023,11 +1023,11 @@ public class RequestHandler { @Deprecated public static String getDefaultServerRootUrl(HttpServletRequest request, boolean secure) { Delegator delegator = (Delegator) request.getAttribute("delegator"); - String httpsPort = UtilProperties.getPropertyValue("url.properties", "port.https", "443"); - String httpsServer = UtilProperties.getPropertyValue("url.properties", "force.https.host"); - String httpPort = UtilProperties.getPropertyValue("url.properties", "port.http", "80"); - String httpServer = UtilProperties.getPropertyValue("url.properties", "force.http.host"); - boolean useHttps = UtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y"); + String httpsPort = EntityUtilProperties.getPropertyValue("url.properties", "port.https", "443", delegator); + String httpsServer = EntityUtilProperties.getPropertyValue("url.properties", "force.https.host", delegator); + String httpPort = EntityUtilProperties.getPropertyValue("url.properties", "port.http", "80", delegator); + String httpServer = EntityUtilProperties.getPropertyValue("url.properties", "force.http.host", delegator); + boolean useHttps = EntityUtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y", delegator); if (Start.getInstance().getConfig().portOffset != 0) { Integer httpPortValue = Integer.valueOf(httpPort); @@ -1115,13 +1115,11 @@ public class RequestHandler { if (queryString.length() > 1) { queryString.append("&"); } - - try { - queryString.append(StringUtil.defaultWebEncoder.encodeForURL(name)); + String encodedName = UtilCodec.getEncoder("url").encode(name); + if (encodedName != null) { + queryString.append(encodedName); queryString.append("="); - queryString.append(StringUtil.defaultWebEncoder.encodeForURL(value)); - } catch (EncodingException e) { - Debug.logError(e, module); + queryString.append(UtilCodec.getEncoder("url").encode(value)); } } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java Mon Jan 5 08:50:30 2015 @@ -25,10 +25,9 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.webapp.taglib.ContentUrlTag; -import org.owasp.esapi.errors.EncodingException; import freemarker.core.Environment; import freemarker.ext.beans.BeanModel; @@ -93,11 +92,7 @@ public class OfbizContentTransform imple return; } - try { - requestUrl = StringUtil.defaultWebEncoder.decodeFromURL(requestUrl); - } catch (EncodingException e) { - Debug.logError(e, module); - } + requestUrl = UtilCodec.getDecoder("url").decode(requestUrl); // make the link StringBuilder newURL = new StringBuilder(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Mon Jan 5 08:50:30 2015 @@ -37,6 +37,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import com.ibm.icu.util.Calendar; @@ -213,7 +214,7 @@ public class ServerHitBin { // put the copy at the first of the list, then put this object back on if (bin.getNumberHits() > 0) { // persist each bin when time ends if option turned on - if (UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".bin", "true")) { + if (EntityUtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".bin", "true", delegator)) { GenericValue serverHitBin = delegator.makeValue("ServerHitBin"); serverHitBin.set("contentId", bin.id); serverHitBin.set("hitTypeId", ServerHitBin.typeIds[bin.type]); @@ -465,7 +466,8 @@ public class ServerHitBin { private void saveHit(HttpServletRequest request, long startTime, long runningTime, GenericValue userLogin) throws GenericEntityException { // persist record of hit in ServerHit entity if option turned on - if (UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".hit", "true")) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + if (EntityUtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".hit", "true", delegator)) { // if the hit type is ENTITY and the name contains "ServerHit" don't // persist; avoids the infinite loop and a bunch of annoying data if (this.type == ENTITY && this.id.indexOf("ServerHit") > 0) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Mon Jan 5 08:50:30 2015 @@ -36,6 +36,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; /** * Handles saving and maintaining visit information @@ -204,7 +205,8 @@ public class VisitHandler { public static GenericValue getVisitor(HttpServletRequest request, HttpServletResponse response) { // this defaults to true: ie if anything but "false" it will be true - if (!UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist.visitor", "false")) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + if (!EntityUtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist.visitor", "false", delegator)) { HttpSession session = request.getSession(); GenericValue visitor = (GenericValue) session.getAttribute("visitor"); @@ -212,7 +214,6 @@ public class VisitHandler { synchronized (session) { visitor = (GenericValue) session.getAttribute("visitor"); if (visitor == null) { - Delegator delegator = (Delegator) request.getAttribute("delegator"); String delegatorName = (String) session.getAttribute("delegatorName"); if (delegator == null && UtilValidate.isNotEmpty(delegatorName)) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java Mon Jan 5 08:50:30 2015 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; /** * WebSiteWorker - Worker class for web site related functionality @@ -72,7 +73,7 @@ public class WebSiteWorker { public static GenericValue findWebSite(Delegator delegator, String webSiteId, boolean useCache) { GenericValue result = null; try { - result = delegator.findOne("WebSite", useCache, UtilMisc.toMap("webSiteId", webSiteId)); + result = EntityQuery.use(delegator).from("WebSite").where("webSiteId", webSiteId).cache(useCache).queryOne(); } catch (GenericEntityException e) { Debug.logError("Error looking up website with id " + webSiteId, module); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java Mon Jan 5 08:50:30 2015 @@ -39,6 +39,7 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelField; import org.ofbiz.entity.model.ModelFieldType; import org.ofbiz.entity.model.ModelReader; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.security.Security; /** @@ -206,7 +207,7 @@ public class GenericWebEvent { GenericValue tempEntity = null; try { - tempEntity = delegator.findOne(findByEntity.getEntityName(), findByEntity.getPrimaryKey(), false); + tempEntity = EntityQuery.use(delegator).from(findByEntity.getEntityName()).where(findByEntity.getPrimaryKey()).queryOne(); } catch (GenericEntityException e) { String errMsg = UtilProperties.getMessage(GenericWebEvent.err_resource, "genericWebEvent.create_failed_by_check", locale) + ": " + e.toString(); Debug.logWarning(e, errMsg, module); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Mon Jan 5 08:50:30 2015 @@ -79,6 +79,7 @@ import org.ofbiz.entity.transaction.Tran import org.ofbiz.entity.util.EntityDataAssert; import org.ofbiz.entity.util.EntityDataLoader; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntitySaxReader; import org.ofbiz.entityext.EntityGroupUtil; import org.ofbiz.security.Security; @@ -512,7 +513,7 @@ public class WebToolsServices { if (UtilValidate.isNotEmpty(fromDate)) { conds.add(EntityCondition.makeCondition("createdStamp", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); } - values = delegator.find(curEntityName, EntityCondition.makeCondition(conds), null, null, me.getPkFieldNames(), null); + values = EntityQuery.use(delegator).from(curEntityName).where(conds).orderBy(me.getPkFieldNames()).queryIterator(); } catch (Exception entityEx) { results.add("["+fileNumber +"] [xxx] Error when writing " + curEntityName + ": " + entityEx); continue; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java Mon Jan 5 08:50:30 2015 @@ -37,10 +37,9 @@ import org.ofbiz.base.component.Componen import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.GeneralException; -import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; -import org.owasp.esapi.errors.EncodingException; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -103,7 +102,7 @@ public class LabelManagerFactory { } } - public void findMatchingLabels(String component, String fileName, String key, String locale) throws MalformedURLException, SAXException, ParserConfigurationException, IOException, EncodingException, GeneralException { + public void findMatchingLabels(String component, String fileName, String key, String locale) throws MalformedURLException, SAXException, ParserConfigurationException, IOException, GeneralException { if (UtilValidate.isEmpty(component) && UtilValidate.isEmpty(fileName) && UtilValidate.isEmpty(key) && UtilValidate.isEmpty(locale)) { // Important! Don't allow unparameterized queries - doing so will result in loading the entire project into memory return; @@ -124,7 +123,7 @@ public class LabelManagerFactory { for (Node propertyNode : UtilXml.childNodeList(resourceElem.getFirstChild())) { if (propertyNode instanceof Element) { Element propertyElem = (Element) propertyNode; - String labelKey = StringUtil.defaultWebEncoder.canonicalize(propertyElem.getAttribute("key")); + String labelKey = UtilCodec.canonicalize(propertyElem.getAttribute("key")); String labelComment = ""; for (Node valueNode : UtilXml.childNodeList(propertyElem.getFirstChild())) { if (valueNode instanceof Element) { @@ -135,7 +134,7 @@ public class LabelManagerFactory { if( localeName.contains("_")) { localeName = localeName.replace('_', '-'); } - String labelValue = StringUtil.defaultWebEncoder.canonicalize(UtilXml.nodeValue(valueElem.getFirstChild())); + String labelValue = UtilCodec.canonicalize(UtilXml.nodeValue(valueElem.getFirstChild())); LabelInfo label = labels.get(labelKey + keySeparator + fileInfo.getFileName()); if (UtilValidate.isEmpty(label)) { @@ -149,12 +148,12 @@ public class LabelManagerFactory { localesFound.add(localeName); labelComment = ""; } else if (valueNode instanceof Comment) { - labelComment = labelComment + StringUtil.defaultWebEncoder.canonicalize(valueNode.getNodeValue()); + labelComment = labelComment + UtilCodec.canonicalize(valueNode.getNodeValue()); } } labelKeyComment = ""; } else if (propertyNode instanceof Comment) { - labelKeyComment = labelKeyComment + StringUtil.defaultWebEncoder.canonicalize(propertyNode.getNodeValue()); + labelKeyComment = labelKeyComment + UtilCodec.canonicalize(propertyNode.getNodeValue()); } } } |
Free forum by Nabble | Edit this page |