|
Modified: ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Tue Aug 7 06:25:59 2012 @@ -21,19 +21,20 @@ package org.ofbiz.entity.finder; import static org.ofbiz.base.util.UtilGenerics.cast; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastMap; +import javolution.util.FastList; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.StringUtil; -import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; @@ -63,24 +64,24 @@ public class EntityFinderUtil { Map<FlexibleMapAccessor<Object>, Object> fieldMap = null; List<? extends Element> fieldMapElementList = UtilXml.childElementList(element, "field-map"); if (fieldMapElementList.size() > 0) { - fieldMap = FastMap.newInstance(); + fieldMap = new HashMap<FlexibleMapAccessor<Object>, Object>(fieldMapElementList.size()); for (Element fieldMapElement: fieldMapElementList) { // set the env-name for each field-name, noting that if no field-name is specified it defaults to the env-name String fieldName = fieldMapElement.getAttribute("field-name"); String envName = fieldMapElement.getAttribute("from-field"); - if (UtilValidate.isEmpty(envName)) { + if (envName.isEmpty()) { envName = fieldMapElement.getAttribute("env-name"); } String value = fieldMapElement.getAttribute("value"); - if (UtilValidate.isEmpty(fieldName)) { + if (fieldName.isEmpty()) { // no fieldName, use envName for both fieldMap.put(FlexibleMapAccessor.getInstance(envName), FlexibleMapAccessor.getInstance(envName)); } else { - if (UtilValidate.isNotEmpty(value)) { + if (!value.isEmpty()) { fieldMap.put(FlexibleMapAccessor.getInstance(fieldName), FlexibleStringExpander.getInstance(value)); } else { // at this point we have a fieldName and no value, do we have a envName? - if (UtilValidate.isNotEmpty(envName)) { + if (!envName.isEmpty()) { fieldMap.put(FlexibleMapAccessor.getInstance(fieldName), FlexibleMapAccessor.getInstance(envName)); } else { // no envName, use fieldName for both @@ -116,7 +117,7 @@ public class EntityFinderUtil { List<FlexibleStringExpander> selectFieldExpanderList = null; List<? extends Element> selectFieldElementList = UtilXml.childElementList(element, "select-field"); if (selectFieldElementList.size() > 0) { - selectFieldExpanderList = new LinkedList<FlexibleStringExpander>(); + selectFieldExpanderList = new ArrayList<FlexibleStringExpander>(selectFieldElementList.size()); for (Element selectFieldElement: selectFieldElementList) { selectFieldExpanderList.add(FlexibleStringExpander.getInstance(selectFieldElement.getAttribute("field-name"))); } @@ -138,7 +139,7 @@ public class EntityFinderUtil { public static List<String> makeOrderByFieldList(List<FlexibleStringExpander> orderByExpanderList, Map<String, Object> context) { List<String> orderByFields = null; if (UtilValidate.isNotEmpty(orderByExpanderList)) { - orderByFields = new LinkedList<String>(); + orderByFields = new ArrayList<String>(orderByExpanderList.size()); for (FlexibleStringExpander orderByExpander: orderByExpanderList) { orderByFields.add(orderByExpander.expandString(context)); } @@ -149,30 +150,37 @@ public class EntityFinderUtil { public static interface Condition extends Serializable { public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader); } + @SuppressWarnings("serial") - public static class ConditionExpr implements Condition { - protected FlexibleStringExpander fieldNameExdr; - protected FlexibleStringExpander operatorExdr; - protected FlexibleMapAccessor<Object> envNameAcsr; - protected FlexibleStringExpander valueExdr; - protected FlexibleStringExpander ignoreExdr; - protected boolean ignoreIfNull; - protected boolean ignoreIfEmpty; - protected boolean ignoreCase; + public static final class ConditionExpr implements Condition { + private final String fieldName; + private final EntityOperator<?,?,?> operator; + private final FlexibleMapAccessor<Object> envNameAcsr; + private final FlexibleStringExpander valueExdr; + private final FlexibleStringExpander ignoreExdr; + private final boolean ignoreIfNull; + private final boolean ignoreIfEmpty; + private final boolean ignoreCase; public ConditionExpr(Element conditionExprElement) { - this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("field-name")); - if (this.fieldNameExdr.isEmpty()) { - // no "field-name"? try "name" - this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("name")); - } - - this.operatorExdr = FlexibleStringExpander.getInstance(UtilFormatOut.checkEmpty(conditionExprElement.getAttribute("operator"), "equals")); - if (UtilValidate.isNotEmpty(conditionExprElement.getAttribute("from-field"))) { - this.envNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("from-field")); - } else { - this.envNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("env-name")); + String fieldNameAttribute = conditionExprElement.getAttribute("field-name"); + if (fieldNameAttribute.isEmpty()) { + fieldNameAttribute = conditionExprElement.getAttribute("name"); + } + this.fieldName = fieldNameAttribute; + String operatorAttribute = conditionExprElement.getAttribute("operator"); + if (operatorAttribute.isEmpty()) { + operatorAttribute = "equals"; + } + this.operator = EntityOperator.lookup(operatorAttribute); + if (this.operator == null) { + throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorAttribute); + } + String fromFieldAttribute = conditionExprElement.getAttribute("from-field"); + if (fromFieldAttribute.isEmpty()) { + fromFieldAttribute = conditionExprElement.getAttribute("env-name"); } + this.envNameAcsr = FlexibleMapAccessor.getInstance(fromFieldAttribute); this.valueExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("value")); this.ignoreIfNull = "true".equals(conditionExprElement.getAttribute("ignore-if-null")); this.ignoreIfEmpty = "true".equals(conditionExprElement.getAttribute("ignore-if-empty")); @@ -181,22 +189,19 @@ public class EntityFinderUtil { } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - String fieldName = fieldNameExdr.expandString(context); - - Object value = null; - // start with the environment variable, will override if exists and a value is specified - if (envNameAcsr != null) { - value = envNameAcsr.get(context); + if ("true".equals(this.ignoreExdr.expandString(context))) { + return null; } - // no value so far, and a string value is specified, use that - if (value == null && valueExdr != null) { - value = valueExdr.expandString(context); + if (modelEntity.getField(fieldName) == null) { + throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]"); } - String operatorName = operatorExdr.expandString(context); - EntityOperator<?,?,?> operator = EntityOperator.lookup(operatorName); - if (operator == null) { - throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName); + Object value = envNameAcsr.get(context); + if (value == null && !valueExdr.isEmpty()) { + value = valueExdr.expandString(context); + } + if (this.ignoreIfNull && value == null) { + return null; } // If IN or BETWEEN operator, see if value is a literal list and split it @@ -208,15 +213,11 @@ public class EntityFinderUtil { } else if (((String)value).indexOf(",") >= 0) { delim = ","; } - if (UtilValidate.isNotEmpty(delim)) { + if (delim != null) { value = StringUtil.split((String)value, delim); } } - if (modelEntity.getField(fieldName) == null) { - throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]"); - } - // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection if (!((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN)) && value instanceof Collection<?>)) { @@ -226,17 +227,10 @@ public class EntityFinderUtil { if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module); - if (this.ignoreIfNull && value == null) { - return null; - } if (this.ignoreIfEmpty && ObjectType.isEmpty(value)) { return null; } - if ("true".equals(this.ignoreExdr.expandString(context))) { - return null; - } - if (operator == EntityOperator.NOT_EQUAL && value != null) { // since some databases don't consider nulls in != comparisons, explicitly include them // this makes more sense logically, but if anyone ever needs it to not behave this way we should add an "or-null" attribute that is true by default @@ -263,68 +257,72 @@ public class EntityFinderUtil { } @SuppressWarnings("serial") - public static class ConditionList implements Condition { - List<Condition> conditionList = new LinkedList<Condition>(); - FlexibleStringExpander combineExdr; + public static final class ConditionList implements Condition { + private final List<Condition> conditionList; + private final EntityOperator<?,?,?> operator; public ConditionList(Element conditionListElement) { - this.combineExdr = FlexibleStringExpander.getInstance(conditionListElement.getAttribute("combine")); - + String operatorAttribute = conditionListElement.getAttribute("combine"); + if (operatorAttribute.isEmpty()) { + operatorAttribute = "and"; + } + this.operator = EntityOperator.lookup(operatorAttribute); + if (this.operator == null) { + throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorAttribute); + } List<? extends Element> subElements = UtilXml.childElementList(conditionListElement); - for (Element subElement: subElements) { - if ("condition-expr".equals(subElement.getNodeName())) { - conditionList.add(new ConditionExpr(subElement)); - } else if ("condition-list".equals(subElement.getNodeName())) { - conditionList.add(new ConditionList(subElement)); - } else if ("condition-object".equals(subElement.getNodeName())) { - conditionList.add(new ConditionObject(subElement)); - } else { - throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + "] found under a condition-list element."); + if (subElements.isEmpty()) { + this.conditionList = null; + } else { + List<Condition> conditionList = new ArrayList<Condition>(subElements.size()); + for (Element subElement : subElements) { + if ("condition-expr".equals(subElement.getNodeName())) { + conditionList.add(new ConditionExpr(subElement)); + } else if ("condition-list".equals(subElement.getNodeName())) { + conditionList.add(new ConditionList(subElement)); + } else if ("condition-object".equals(subElement.getNodeName())) { + conditionList.add(new ConditionObject(subElement)); + } else { + throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + "] found under a condition-list element."); + } } + this.conditionList = Collections.unmodifiableList(conditionList); } } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - if (this.conditionList.size() == 0) { + if (this.conditionList == null) { return null; } if (this.conditionList.size() == 1) { Condition condition = this.conditionList.get(0); return condition.createCondition(context, modelEntity, modelFieldTypeReader); } - - List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>(); - for (Condition curCondition: conditionList) { + List<EntityCondition> entityConditionList = new ArrayList<EntityCondition>(this.conditionList.size()); + for (Condition curCondition: this.conditionList) { EntityCondition econd = curCondition.createCondition(context, modelEntity, modelFieldTypeReader); if (econd != null) { entityConditionList.add(econd); } } - - String operatorName = combineExdr.expandString(context); - EntityOperator<?,?,?> operator = EntityOperator.lookup(operatorName); - if (operator == null) { - throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName); - } - return EntityCondition.makeCondition(entityConditionList, UtilGenerics.<EntityJoinOperator>cast(operator)); } } + @SuppressWarnings("serial") - public static class ConditionObject implements Condition { - protected FlexibleMapAccessor<Object> fieldNameAcsr; + public static final class ConditionObject implements Condition { + private final FlexibleMapAccessor<Object> fieldNameAcsr; public ConditionObject(Element conditionExprElement) { - this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field")); - if (this.fieldNameAcsr.isEmpty()) { - // no "field"? try "field-name" - this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field-name")); + String fieldNameAttribute = conditionExprElement.getAttribute("field"); + if (fieldNameAttribute.isEmpty()) { + fieldNameAttribute = conditionExprElement.getAttribute("field-name"); } + this.fieldNameAcsr = FlexibleMapAccessor.getInstance(fieldNameAttribute); } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - EntityCondition condition = (EntityCondition) fieldNameAcsr.get(context); - return condition; + return (EntityCondition) fieldNameAcsr.get(context); } } @@ -332,6 +330,7 @@ public class EntityFinderUtil { public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); } + @SuppressWarnings("serial") public static class LimitRange implements OutputHandler { FlexibleStringExpander startExdr; @@ -365,7 +364,7 @@ public class EntityFinderUtil { } public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { - int start = getStart(context); + int start = getStart(context) + 1; // ELI index is one-based. int size = getSize(context); try { listAcsr.put(context, eli.getPartialList(start, size)); @@ -378,15 +377,22 @@ public class EntityFinderUtil { } public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { + List<GenericValue> result = null; int start = getStart(context); - int size = getSize(context); - - int end = start + size; - if (end > results.size()) end = results.size(); - - listAcsr.put(context, results.subList(start, end)); + if (start < results.size()) { + int size = getSize(context); + int end = start + size; + if (end > results.size()) { + end = results.size(); + } + result = results.subList(start, end); + } else { + result = FastList.newInstance(); + } + listAcsr.put(context, result); } } + @SuppressWarnings("serial") public static class LimitView implements OutputHandler { FlexibleStringExpander viewIndexExdr; @@ -422,9 +428,8 @@ public class EntityFinderUtil { public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { int index = this.getIndex(context); int size = this.getSize(context); - try { - listAcsr.put(context, eli.getPartialList(((index - 1) * size) + 1, size)); + listAcsr.put(context, eli.getPartialList(((index - 1) * size) + 1, size)); // ELI index is one-based. eli.close(); } catch (GenericEntityException e) { String errMsg = "Error getting partial list in limit-view with index=" + index + " and size=" + size + ": " + e.toString(); @@ -434,16 +439,23 @@ public class EntityFinderUtil { } public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { + List<GenericValue> result = null; int index = this.getIndex(context); int size = this.getSize(context); - - int begin = index * size; - int end = index * size + size; - if (end > results.size()) end = results.size(); - - listAcsr.put(context, results.subList(begin, end)); + int begin = (index - 1) * size; + if (begin < results.size()) { + int end = begin + size; + if (end > results.size()) { + end = results.size(); + } + result = results.subList(begin, end); + } else { + result = FastList.newInstance(); + } + listAcsr.put(context, result); } } + @SuppressWarnings("serial") public static class UseIterator implements OutputHandler { public UseIterator(Element useIteratorElement) { Modified: ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java Tue Aug 7 06:25:59 2012 @@ -230,7 +230,7 @@ public class DynamicViewEntity { } /** - * @deprecated use {@link #addAliasAll(String, String, Collection<String>)} + * @deprecated use {@link #addAliasAll(String, String, Collection)} */ @Deprecated public void addAliasAll(String entityAlias, String prefix) { Modified: ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/ModelReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Tue Aug 7 06:25:59 2012 @@ -98,7 +98,7 @@ public class ModelReader implements Seri return reader; } - public ModelReader(String modelName) throws GenericEntityException { + private ModelReader(String modelName) throws GenericEntityException { this.modelName = modelName; entityResourceHandlers = FastList.newInstance(); resourceHandlerEntities = FastMap.newInstance(); @@ -127,6 +127,7 @@ public class ModelReader implements Seri private ModelEntity buildEntity(ResourceHandler entityResourceHandler, Element curEntityElement, int i, ModelInfo def) throws GenericEntityException { boolean isEntity = "entity".equals(curEntityElement.getNodeName()); String entityName = UtilXml.checkEmpty(curEntityElement.getAttribute("entity-name")).intern(); + boolean redefinedEntity = "true".equals(curEntityElement.getAttribute("redefinition")); // add entityName to appropriate resourceHandlerEntities collection Collection<String> resourceHandlerEntityNames = resourceHandlerEntities.get(entityResourceHandler); @@ -138,7 +139,7 @@ public class ModelReader implements Seri resourceHandlerEntityNames.add(entityName); // check to see if entity with same name has already been read - if (entityCache.containsKey(entityName)) { + if (entityCache.containsKey(entityName) && !redefinedEntity) { Debug.logWarning("WARNING: Entity " + entityName + " is defined more than once, most recent will over-write " + "previous definition(s)", module); Modified: ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java Tue Aug 7 06:25:59 2012 @@ -264,7 +264,8 @@ public class XmlSerializer { } else { String byteHex = StringUtil.toHexString(objBytes); Element element = document.createElement("cus-obj"); - element.appendChild(document.createCDATASection(byteHex)); + // this is hex encoded so does not need to be in a CDATA block + element.appendChild(document.createTextNode(byteHex)); return element; } } else { @@ -499,4 +500,4 @@ public class XmlSerializer { } return formatter; } -} \ No newline at end of file +} Modified: ofbiz/branches/jackrabbit20120501/framework/entityext/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entityext/ofbiz-component.xml?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entityext/ofbiz-component.xml (original) +++ ofbiz/branches/jackrabbit20120501/framework/entityext/ofbiz-component.xml Tue Aug 7 06:25:59 2012 @@ -34,4 +34,10 @@ under the License. <service-resource type="model" loader="main" location="servicedef/services.xml"/> <service-resource type="group" loader="main" location="servicedef/groups.xml"/> + + <!-- load the data load container, runs the entity data load stuff --> + <container name="dataload-container" loaders="install" class="org.ofbiz.entityext.data.EntityDataLoadContainer"> + <property name="delegator-name" value="default"/> + <property name="entity-group-name" value="org.ofbiz"/> + </container> </ofbiz-component> Modified: ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java Tue Aug 7 06:25:59 2012 @@ -20,8 +20,8 @@ package org.ofbiz.entityext; import org.ofbiz.entity.Delegator; import org.ofbiz.service.DispatchContext; -import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceContainer; /** * EntityEcaUtil @@ -31,7 +31,7 @@ public class EntityServiceFactory { public static final String module = EntityServiceFactory.class.getName(); public static LocalDispatcher getLocalDispatcher(Delegator delegator) { - LocalDispatcher dispatcher = GenericDispatcher.getLocalDispatcher("entity-" + delegator.getDelegatorName(), delegator); + LocalDispatcher dispatcher = ServiceContainer.getLocalDispatcher("entity-" + delegator.getDelegatorName(), delegator); return dispatcher; } Modified: ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Tue Aug 7 06:25:59 2012 @@ -77,14 +77,15 @@ public class EntityDataLoadContainer imp protected boolean createConstraints = false; protected int txTimeout = -1; + private String name; + public EntityDataLoadContainer() { super(); } - /** - * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) - */ - public void init(String[] args, String configFile) throws ContainerException { + @Override + public void init(String[] args, String name, String configFile) throws ContainerException { + this.name = name; this.configFile = configFile; // disable job scheduler, JMS listener and startup services ServiceDispatcher.enableJM(false); @@ -207,7 +208,7 @@ public class EntityDataLoadContainer imp Debug.logWarning("Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module); return true; } - ContainerConfig.Container cfg = ContainerConfig.getContainer("dataload-container", configFile); + ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile); ContainerConfig.Container.Property delegatorNameProp = cfg.getProperty("delegator-name"); String delegatorName = null; if (delegatorNameProp == null || UtilValidate.isEmpty(delegatorNameProp.value)) { @@ -238,7 +239,7 @@ public class EntityDataLoadContainer imp return true; } private void loadContainer() throws ContainerException{ - ContainerConfig.Container cfg = ContainerConfig.getContainer("dataload-container", configFile); + ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile); ContainerConfig.Container.Property delegatorNameProp = cfg.getProperty("delegator-name"); ContainerConfig.Container.Property entityGroupNameProp = cfg.getProperty("entity-group-name"); @@ -570,4 +571,8 @@ public class EntityDataLoadContainer imp */ public void stop() throws ContainerException { } + + public String getName() { + return name; + } } Modified: ofbiz/branches/jackrabbit20120501/framework/geronimo/src/org/ofbiz/geronimo/GeronimoContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/geronimo/src/org/ofbiz/geronimo/GeronimoContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/geronimo/src/org/ofbiz/geronimo/GeronimoContainer.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/geronimo/src/org/ofbiz/geronimo/GeronimoContainer.java Tue Aug 7 06:25:59 2012 @@ -35,11 +35,11 @@ public class GeronimoContainer implement public static final String module = GeronimoContainer.class.getName(); protected String configFile = null; + private String name; - /** - * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) - */ - public void init(String[] args, String configFile) throws ContainerException { + @Override + public void init(String[] args, String name, String configFile) throws ContainerException { + this.name = name; this.configFile = configFile; this.startGeronimo(); } @@ -50,7 +50,7 @@ public class GeronimoContainer implement private void startGeronimo() throws ContainerException { // get the container config - ContainerConfig.Container cc = ContainerConfig.getContainer("geronimo-container", configFile); + ContainerConfig.Container cc = ContainerConfig.getContainer(name, configFile); if (cc == null) { throw new ContainerException("No geronimo-container configuration found in container config!"); } @@ -83,4 +83,8 @@ public class GeronimoContainer implement // TODO: how to stop the Geronimo transaction manager? is it even needed? } + public String getName() { + return name; + } + } Modified: ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/fieldlookup.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/fieldlookup.js?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/fieldlookup.js Tue Aug 7 06:25:59 2012 @@ -449,7 +449,7 @@ var FieldLookupCounter = function() { }; }; -var GLOBAL_LOOKUP_REF = new FieldLookupCounter; +var GLOBAL_LOOKUP_REF = new FieldLookupCounter(); /******************************************************************************* * Button Modifier Object @@ -474,8 +474,8 @@ var ButtonModifier = function(lookupDiv) var slTitleBars = jQuery("#" + lookupDiv + " .screenlet-title-bar"); - jQuery.each(slTitleBars, function(i) { - var slTitleBar = slTitleBars[i]; + jQuery.each(slTitleBars, function(index) { + var slTitleBar = slTitleBars[index]; var ul = slTitleBar.firstChild; if ((typeof ul) != 'object') { return true; @@ -610,10 +610,10 @@ var ButtonModifier = function(lookupDiv) jQuery.each(cellChilds, function(child) { if (cellChilds[child].tagName == "A") { var link = cellChilds[child].href; - var liSub = link.substring(link.lastIndexOf('/') + 1, (link.length)); - if (liSub.indexOf("javascript:set_") != -1) { + if (link.indexOf("javascript:set_") != -1) { cellChilds[child].href = link; } else { + var liSub = link.substring(link.lastIndexOf('/') + 1, (link.length)); cellChilds[child].href = "javascript:lookupAjaxRequest('" + liSub + "&presentation=layer')"; } } @@ -851,22 +851,21 @@ lookupDescriptionLoaded.prototype.update this.allParams = this.params + '&' + fieldSerialized + '&' + 'searchType=EQUALS'; var _fieldId = this.fieldId; - jQuery - .ajax({ - url : this.url, - type : "POST", - data : this.allParams, - async : false, - success : function(result) { - // This would be far more reliable if we were removing - // the widget boundaries in LookupDecorator using - // widgetVerbose in context :/ - if (result.split("ajaxAutocompleteOptions.ftl -->")[1]) { - setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), - "", ""); - } - } - }); + jQuery.ajax({ + url : this.url, + type : "POST", + data : this.allParams, + async : false, + success : function(result) { + // This would be far more reliable if we were removing + // the widget boundaries in LookupDecorator using + // widgetVerbose in context :/ + if (result.split("ajaxAutocompleteOptions.ftl -->")[1]) { + setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), + "", ""); + } + } + }); } } Modified: ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/getDependentDropdownValues.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/getDependentDropdownValues.js?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/getDependentDropdownValues.js (original) +++ ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/getDependentDropdownValues.js Tue Aug 7 06:25:59 2012 @@ -52,7 +52,7 @@ function getDependentDropdownValues(requ jQuery.each(list, function(key, value){ if (typeof value == 'string') { values = value.split(': '); - if (values[1].indexOf(selected) >= 0) { + if (values[1].indexOf(selected) >= 0 && selected.length > 0) { optionList += "<option selected='selected' value = " + values[1] + " >" + values[0] + "</option>"; } else { optionList += "<option value = " + values[1] + " >" + values[0] + "</option>"; Modified: ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/selectall.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/selectall.js?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/selectall.js (original) +++ ofbiz/branches/jackrabbit20120501/framework/images/webapp/images/selectall.js Tue Aug 7 06:25:59 2012 @@ -390,7 +390,7 @@ function ajaxSubmitFormUpdateAreas(form, }); } -/** Enable auto-completion for text elements. +/** Enable auto-completion for text elements, with a possible span of tooltip class showing description. * @param areaCsvString The area CSV string. The CSV string is a flat array in the * form of: areaId, target, target parameters [, areaId, target, target parameters...]. */ Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/loader/JCRContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/loader/JCRContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/loader/JCRContainer.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/loader/JCRContainer.java Tue Aug 7 06:25:59 2012 @@ -36,11 +36,11 @@ public class JCRContainer implements Con public static final String DEFAULT_JCR_CONFIG_PATH = "framework/jcr/config/jcr-config.xml"; - private static final String module = JCRContainer.class.getName(); - private static String configFilePath = null; private boolean removeRepositoryOnShutdown = false; + private String name; + /* * (non-Javadoc) * @@ -48,8 +48,10 @@ public class JCRContainer implements Con * java.lang.String) */ @Override - public void init(String[] args, String configFile) throws ContainerException { - readContainerConfig(configFile); + public void init(String[] args, String name, String configFile) throws ContainerException { + this.name = name; + + readContainerConfig(configFile); Element configRootElement = getConfigFileRootElement(); @@ -62,7 +64,6 @@ public class JCRContainer implements Con * * @see org.ofbiz.base.container.Container#start() */ - @Override public boolean start() throws ContainerException { JCRFactory jcrFactory = getJCRFactory(); @@ -80,7 +81,6 @@ public class JCRContainer implements Con * * @see org.ofbiz.base.container.Container#stop() */ - @Override public void stop() throws ContainerException { JCRFactory jcrFactory = getJCRFactory(); @@ -154,4 +154,9 @@ public class JCRContainer implements Con } return jcrFactory; } + + @Override + public String getName() { + return this.name; + } } Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java Tue Aug 7 06:25:59 2012 @@ -48,7 +48,7 @@ public class JackrabbitBaseTests extends @Override protected void setUp() throws Exception { - userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system")); + userLogin = delegator.findOne("UserLogin", true, UtilMisc.toMap("userLoginId", "system")); } Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java Tue Aug 7 06:25:59 2012 @@ -24,14 +24,14 @@ public class JackrabbitTenantTests exten @Override protected void setUp() throws Exception { - userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "admin")); + userLogin = delegator.findOne("UserLogin", true, UtilMisc.toMap("userLoginId", "admin")); // tenant delegator String delegatorName = delegator.getDelegatorBaseName() + "#DEMO1"; tenantDelegator = DelegatorFactory.getDelegator(delegatorName); assertNotNull(tenantDelegator); - tenantUserLogin = tenantDelegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "admin")); + tenantUserLogin = tenantDelegator.findOne("UserLogin", true, UtilMisc.toMap("userLoginId", "admin")); assertNotNull(tenantUserLogin); } Modified: ofbiz/branches/jackrabbit20120501/framework/jetty/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jetty/ofbiz-component.xml?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/jetty/ofbiz-component.xml (original) +++ ofbiz/branches/jackrabbit20120501/framework/jetty/ofbiz-component.xml Tue Aug 7 06:25:59 2012 @@ -24,4 +24,61 @@ under the License. <resource-loader name="main" type="component"/> <classpath type="jar" location="lib/*"/> <classpath type="jar" location="build/lib/*"/> + + <container name="jetty-container" class="org.ofbiz.jetty.container.JettyContainer"> + <property name="default-server" value="server"> + <property name="send-server-version" value="false"/> + <!-- thread pool config --> + <property name="min-threads" value="5"/> + <property name="max-threads" value="100"/> + <property name="max-idle-time-ms" value="30000"/> + <property name="max-stop-time-ms" value="5000"/> + <!-- connectors --> + <!-- + <property name="http-connector" value="connector"> + <property name="type" value="http"/> + <property name="host" value="0.0.0.0"/> + <property name="port" value="8080"/> + </property> + <property name="https-connector" value="connector"> + <property name="type" value="https"/> + <property name="host" value="0.0.0.0"/> + <property name="port" value="8443"/> + <property name="keystore" value="framework/base/config/ofbizssl.jks"/> + <property name="password" value="changeit"/> + <property name="key-password" value="changeit"/> + <property name="client-auth" value="false"/> + </property> + --> + <property name="nio-http-connector" value="connector"> + <property name="type" value="nio-http"/> + <property name="host" value="0.0.0.0"/> + <property name="port" value="8080"/> + </property> + <property name="nio-https-connector" value="connector"> + <property name="type" value="nio-https"/> + <property name="host" value="0.0.0.0"/> + <property name="port" value="8443"/> + <property name="keystore" value="framework/base/config/ofbizssl.jks"/> + <property name="password" value="changeit"/> + <property name="key-password" value="changeit"/> + <property name="client-auth" value="false"/> + </property> + <!-- + <property name="ajp13-connector" value="connector"> + <property name="type" value="ajp13"/> + <property name="host" value="0.0.0.0"/> + <property name="port" value="8009"/> + </property> + --> + <!-- request logs --> + <property name="request-log" value="request-log"> + <property name="filename" value="runtime/logs/yyyy_mm_dd.request.log"/> + <property name="append" value="true"/> + <property name="extended" value="true"/> + <property name="timezone" value="GMT"/> + <property name="retain-days" value="90"/> + </property> + </property> + </container> </ofbiz-component> Modified: ofbiz/branches/jackrabbit20120501/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java (original) +++ ofbiz/branches/jackrabbit20120501/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Tue Aug 7 06:25:59 2012 @@ -58,13 +58,12 @@ public class JettyContainer implements C public static final String module = JettyContainer.class.getName(); + private String name; private Map<String, Server> servers = new HashMap<String, Server>(); - /** - * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) - */ - public void init(String[] args, String configFile) throws ContainerException { - + @Override + public void init(String[] args, String name, String configFile) throws ContainerException { + this.name = name; // configure JSSE properties SSLUtil.loadJsseProperties(); @@ -77,7 +76,7 @@ public class JettyContainer implements C } // get the jetty container config - ContainerConfig.Container jettyContainerConfig = ContainerConfig.getContainer("jetty-container", configFile); + ContainerConfig.Container jettyContainerConfig = ContainerConfig.getContainer(name, configFile); // create the servers for (ContainerConfig.Container.Property serverConfig : jettyContainerConfig.getPropertiesWithValue("server")) { @@ -376,4 +375,8 @@ public class JettyContainer implements C } } + public String getName() { + return name; + } + } Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/config/minilang.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/config/minilang.properties?rev=1370126&r1=1370125&r2=1370126&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20120501/framework/minilang/config/minilang.properties (original) +++ ofbiz/branches/jackrabbit20120501/framework/minilang/config/minilang.properties Tue Aug 7 06:25:59 2012 @@ -26,3 +26,7 @@ validation.level=none # to correct common syntax errors. The corrections are saved in the original # source file. autocorrect=false + +# Enable trace statements in mini-language unit tests. If set to true, mini-language +# unit tests will log trace messages. Log messages will be INFO. +unit.tests.trace.enabled=false |
| Free forum by Nabble | Edit this page |
