Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -52,7 +52,7 @@ return new EntityExpr(); } }; - + private Object lhs = null; private EntityOperator<?> operator = null; private Object rhs = null; @@ -98,7 +98,7 @@ throw new IllegalArgumentException("BETWEEN Operator requires a Collection with 2 elements for the right/rhs argument"); } } - + if (lhs instanceof String) { this.lhs = EntityFieldValue.makeFieldValue((String) lhs); } else { @@ -106,10 +106,10 @@ } this.operator = operator; this.rhs = rhs; - + //Debug.logInfo("new EntityExpr internal field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module); } - + public void init(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) { if (lhs == null) { throw new IllegalArgumentException("The left EntityCondition argument cannot be null"); @@ -125,7 +125,7 @@ this.operator = operator; this.rhs = rhs; } - + public void reset() { this.lhs = null; this.operator = null; @@ -164,7 +164,7 @@ public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, DatasourceInfo datasourceInfo) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module); - + this.checkRhsType(modelEntity, null); StringBuilder sql = new StringBuilder(); @@ -211,7 +211,7 @@ } } } - + public void visit(EntityConditionVisitor visitor) { visitor.acceptEntityOperator(operator, lhs, rhs); } @@ -219,7 +219,7 @@ public void accept(EntityConditionVisitor visitor) { visitor.acceptEntityExpr(this); } - + public void checkRhsType(ModelEntity modelEntity, GenericDelegator delegator) { if (this.rhs == null || this.rhs == GenericEntity.NULL_FIELD || modelEntity == null) return; @@ -227,20 +227,20 @@ if (this.rhs instanceof EntityFunction) { value = ((EntityFunction) this.rhs).getOriginalValue(); } - + if (value instanceof Collection) { Collection valueCol = (Collection) value; if (valueCol.size() > 0) { value = valueCol.iterator().next(); } } - + if (delegator == null) { // this will be the common case for now as the delegator isn't available where we want to do this // we'll cheat a little here and assume the default delegator delegator = GenericDelegator.getGenericDelegator("default"); } - + String fieldName = null; if (this.lhs instanceof EntityFieldValue) { EntityFieldValue efv = (EntityFieldValue) this.lhs; @@ -249,7 +249,7 @@ // nothing to check return; } - + ModelField curField = modelEntity.getField(fieldName); if (UtilValidate.isEmpty(curField)) { throw new IllegalArgumentException("FieldName " + fieldName + " not found for entity: " + modelEntity.getEntityName()); @@ -263,7 +263,7 @@ if (type == null) { throw new IllegalArgumentException("Type " + curField.getType() + " not found for entity [" + modelEntity.getEntityName() + "]; probably because there is no datasource (helper) setup for the entity group that this entity is in: [" + delegator.getEntityGroupName(modelEntity.getEntityName()) + "]"); } - + // make sure the type matches the field Java type if (!ObjectType.instanceOf(value, type.getJavaType())) { String errMsg = "In entity field [" + modelEntity.getEntityName() + "." + curField.getName() + "] set the value passed in [" + value.getClass().getName() + "] is not compatible with the Java type of the field [" + type.getJavaType() + "]"; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -40,7 +40,7 @@ return new EntityFieldMap(); } }; - + protected Map<String, ? extends Object> fieldMap = null; protected EntityFieldMap() { @@ -60,7 +60,7 @@ return list; } - + /** @deprecated Use EntityCondition.makeCondition() instead */ public EntityFieldMap(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) { this.init(compOp, joinOp, keysValues); @@ -80,7 +80,7 @@ public EntityFieldMap(Map<String, ? extends Object> fieldMap, EntityJoinOperator operator) { this.init(fieldMap, EntityOperator.EQUALS, operator); } - + public void init(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) { super.init(makeConditionList(EntityUtil.makeFields(keysValues), compOp), joinOp); this.fieldMap = EntityUtil.makeFields(keysValues); @@ -103,19 +103,19 @@ public Object getField(String name) { return this.fieldMap.get(name); } - + public boolean containsField(String name) { return this.fieldMap.containsKey(name); } - + public Iterator<String> getFieldKeyIterator() { return Collections.unmodifiableSet(this.fieldMap.keySet()).iterator(); } - + public Iterator<Map.Entry<String, Object>> getFieldEntryIterator() { return Collections.unmodifiableMap(this.fieldMap).entrySet().iterator(); } - + public void accept(EntityConditionVisitor visitor) { visitor.acceptEntityFieldMap(this); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -43,9 +43,9 @@ return new EntityFieldValue(); } }; - + protected String fieldName = null; - + public static EntityFieldValue makeFieldValue(String fieldName) { EntityFieldValue efv = EntityFieldValue.entityFieldValueFactory.object(); efv.init(fieldName); @@ -53,16 +53,16 @@ } protected EntityFieldValue() {} - + /** @deprecated Use EntityFieldValue.makeFieldValue() instead */ public EntityFieldValue(String fieldName) { this.init(fieldName); } - + public void init(String fieldName) { this.fieldName = fieldName; } - + public void reset() { this.fieldName = null; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -134,7 +134,7 @@ static { register( "in", IN ); } public static final EntityComparisonOperator BETWEEN = new EntityComparisonOperator(ID_BETWEEN, "BETWEEN") { public boolean compare(Comparable lhs, Object rhs) { return EntityComparisonOperator.compareIn(lhs, rhs); } - protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { appendRHSBetweenList(entityConditionParams, sb, field, rhs); } + protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { appendRHSBetweenList(entityConditionParams, sb, field, rhs); } }; static { register( "between", BETWEEN ); } public static final EntityComparisonOperator NOT = new EntityComparisonOperator(ID_NOT, "NOT"); @@ -214,7 +214,7 @@ } whereStringBuilder.append(')'); } - + protected void appendRHSBetweenList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, Object rhs) { if (rhs instanceof Collection) { Iterator rhsIter = ((Collection) rhs).iterator(); @@ -227,7 +227,7 @@ whereStringBuilder.append(" AND "); } } - } + } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -47,7 +47,7 @@ return new EntityWhereString(); } }; - + protected String sqlString; protected EntityWhereString() {} @@ -56,11 +56,11 @@ public EntityWhereString(String sqlString) { init(sqlString); } - + public void init(String sqlString) { this.sqlString = sqlString; } - + public void reset() { this.sqlString = null; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -68,7 +68,7 @@ public void addOrderBy(EntityConditionValue value, boolean descending) { addOrderBy(new OrderByItem(value, descending)); } - + public void addOrderBy(OrderByItem orderByItem) { orderByList.add(orderByItem); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -38,12 +38,12 @@ public List<? extends Element> sqlLoadPaths; public List<? extends Element> readDatas; public Element datasourceElement; - - public static final int TYPE_JNDI_JDBC = 1; + + public static final int TYPE_JNDI_JDBC = 1; public static final int TYPE_INLINE_JDBC = 2; public static final int TYPE_TYREX_DATA_SOURCE = 3; public static final int TYPE_OTHER = 4; - + public Element jndiJdbcElement; public Element tyrexDataSourceElement; public Element inlineJdbcElement; @@ -155,7 +155,7 @@ this.alwaysUseConstraintKeyword = "true".equals(datasourceElement.getAttribute("always-use-constraint-keyword")); this.dropFkUseForeignKeyKeyword = "true".equals(datasourceElement.getAttribute("drop-fk-use-foreign-key-keyword")); this.useBinaryTypeForBlob = "true".equals(datasourceElement.getAttribute("use-binary-type-for-blob")); - + this.tableType = datasourceElement.getAttribute("table-type"); this.characterSet = datasourceElement.getAttribute("character-set"); this.collate = datasourceElement.getAttribute("collate"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -57,15 +57,15 @@ this.useDistributedCacheClear = "true".equalsIgnoreCase(element.getAttribute("distributed-cache-clear-enabled")); this.distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name"); if (UtilValidate.isEmpty(this.distributedCacheClearClassName)) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices"; - + this.distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id"); if (UtilValidate.isEmpty(this.distributedCacheClearUserLoginId)) this.distributedCacheClearUserLoginId = "admin"; this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix"); - + this.defaultGroupName = element.getAttribute("default-group-name"); if (UtilValidate.isEmpty(this.defaultGroupName)) this.defaultGroupName = "org.ofbiz"; - + for (Element groupMapElement: UtilXml.childElementList(element, "group-map")) { groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name")); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -38,7 +38,7 @@ * */ public class EntityConfigUtil { - + public static final String module = EntityConfigUtil.class.getName(); public static final String ENTITY_ENGINE_XML_FILENAME = "entityengine.xml"; @@ -233,7 +233,7 @@ public static DatasourceInfo getDatasourceInfo(String name) { return datasourceInfos.get(name); } - + public static Map<String, DatasourceInfo> getDatasourceInfos() { return datasourceInfos; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -31,7 +31,7 @@ String loader = element.getAttribute("loader"); String location = element.getAttribute("location"); - if (UtilValidate.isNotEmpty(loader) && UtilValidate.isNotEmpty(location)) { + if (UtilValidate.isNotEmpty(loader) && UtilValidate.isNotEmpty(location)) { resourceElements.add(0, element); } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -26,7 +26,7 @@ */ public class FieldTypeInfo extends NamedInfo { public Element resourceElement; - + public FieldTypeInfo(Element element) { super(element); resourceElement = element; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceLoaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceLoaderInfo.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceLoaderInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceLoaderInfo.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Sat Mar 21 23:22:45 2009 @@ -90,7 +90,7 @@ // wrap it with a LocalXAConnectionFactory XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf); - + // configure the pool settings GenericObjectPool pool = new GenericObjectPool(); pool.setTimeBetweenEvictionRunsMillis(600000); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -38,19 +38,19 @@ * MinervaConnectionFactory - Central source for Minerva JDBC Objects */ public class MinervaConnectionFactory implements ConnectionFactoryInterface { - + public static final String module = MinervaConnectionFactory.class.getName(); protected static Map<String, XAPoolDataSource> dsCache = FastMap.newInstance(); public Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException { - XAPoolDataSource pds = dsCache.get(helperName); - if (pds != null) { + XAPoolDataSource pds = dsCache.get(helperName); + if (pds != null) { return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); } - + synchronized (MinervaConnectionFactory.class) { pds = dsCache.get(helperName); - if (pds != null) { + if (pds != null) { return pds.getConnection(); } else { pds = new XAPoolDataSource(); @@ -61,10 +61,10 @@ if (ds == null) throw new GenericEntityException("XADataSource was not created, big problem!"); - + ds.setDriver(jotmJdbcElement.getAttribute("jdbc-driver")); ds.setURL(jotmJdbcElement.getAttribute("jdbc-uri")); - + String transIso = jotmJdbcElement.getAttribute("isolation-level"); if (transIso != null && transIso.length() > 0) { if ("Serializable".equals(transIso)) { @@ -77,19 +77,19 @@ pds.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); } else if ("None".equals(transIso)) { pds.setTransactionIsolation(Connection.TRANSACTION_NONE); - } + } } - - // set the datasource in the pool + + // set the datasource in the pool pds.setDataSource(ds); pds.setJDBCUser(jotmJdbcElement.getAttribute("jdbc-username")); pds.setJDBCPassword(jotmJdbcElement.getAttribute("jdbc-password")); - + // set the transaction manager in the pool pds.setTransactionManager(TransactionFactory.getTransactionManager()); - + // configure the pool settings - try { + try { pds.setMaxSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"))); } catch (NumberFormatException nfe) { Debug.logError("Problems with pool settings [pool-maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module); @@ -98,7 +98,7 @@ Debug.logError(e, "Problems with pool settings", module); pds.setMaxSize(20); } - try { + try { pds.setMinSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"))); } catch (NumberFormatException nfe) { Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 5.", module); @@ -107,19 +107,19 @@ Debug.logError(e, "Problems with pool settings", module); pds.setMinSize(2); } - + // cache the pool - dsCache.put(helperName, pds); - + dsCache.put(helperName, pds); + return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); - } + } } - + public void closeAll() { for (String helperName: dsCache.keySet()) { XAPoolDataSource pds = dsCache.remove(helperName); - pds.close(); - } + pds.close(); + } } // static methods for webtools Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -84,16 +84,16 @@ return null; } - + public static void closeAll() { Set cacheKeys = dsCache.keySet(); Iterator i = cacheKeys.iterator(); while (i.hasNext()) { String helperName = (String) i.next(); EnabledDataSource ed = (EnabledDataSource) dsCache.remove(helperName); - ed = null; - } - } + ed = null; + } + } } */ Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -37,52 +37,52 @@ * JotmFactory - Central source for JOTM JDBC Objects */ public class XaPoolConnectionFactory { - - public static final String module = XaPoolConnectionFactory.class.getName(); - + + public static final String module = XaPoolConnectionFactory.class.getName(); + protected static Map dsCache = new HashMap(); - - public static Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException { - StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.get(helperName); - if (pds != null) { - if (Debug.verboseOn()) Debug.logVerbose(helperName + " pool size: " + pds.pool.getCount(), module); + + public static Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException { + StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.get(helperName); + if (pds != null) { + if (Debug.verboseOn()) Debug.logVerbose(helperName + " pool size: " + pds.pool.getCount(), module); return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); } - - synchronized (XaPoolConnectionFactory.class) { + + synchronized (XaPoolConnectionFactory.class) { pds = (StandardXAPoolDataSource) dsCache.get(helperName); - if (pds != null) { + if (pds != null) { return pds.getConnection(); } - + // the xapool wrapper class String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class"); - - StandardXADataSource ds = null; - try { - //ds = new StandardXADataSource(); + + StandardXADataSource ds = null; + try { + //ds = new StandardXADataSource(); ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass); pds = new StandardXAPoolDataSource(); - } catch (NoClassDefFoundError e) { - throw new GenericEntityException("Cannot find xapool.jar"); + } catch (NoClassDefFoundError e) { + throw new GenericEntityException("Cannot find xapool.jar"); } catch (ClassNotFoundException e) { - throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e); + throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e); } catch (InstantiationException e) { - throw new GenericEntityException("Unable to instantiate " + wrapperClass, e); + throw new GenericEntityException("Unable to instantiate " + wrapperClass, e); } catch (IllegalAccessException e) { - throw new GenericEntityException("Problems getting instance of " + wrapperClass, e); + throw new GenericEntityException("Problems getting instance of " + wrapperClass, e); } - + if (ds == null) throw new GenericEntityException("StandardXaDataSource was not created, big problem!"); - + ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver")); ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri")); ds.setUser(jotmJdbcElement.getAttribute("jdbc-username")); ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password")); - ds.setDescription(helperName); - ds.setTransactionManager(TransactionFactory.getTransactionManager()); - + ds.setDescription(helperName); + ds.setTransactionManager(TransactionFactory.getTransactionManager()); + String transIso = jotmJdbcElement.getAttribute("isolation-level"); if (transIso != null && transIso.length() > 0) { if ("Serializable".equals(transIso)) { @@ -95,54 +95,54 @@ ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); } else if ("None".equals(transIso)) { ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE); - } + } } - - // set the datasource in the pool + + // set the datasource in the pool pds.setDataSource(ds); pds.setDescription(ds.getDescription()); pds.setUser(ds.getUser()); pds.setPassword(ds.getPassword()); Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module); - + // set the transaction manager in the pool pds.setTransactionManager(TransactionFactory.getTransactionManager()); - - // configure the pool settings - try { + + // configure the pool settings + try { pds.setMaxSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"))); pds.setMinSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"))); pds.setSleepTime(Long.parseLong(jotmJdbcElement.getAttribute("pool-sleeptime"))); pds.setLifeTime(Long.parseLong(jotmJdbcElement.getAttribute("pool-lifetime"))); pds.setDeadLockMaxWait(Long.parseLong(jotmJdbcElement.getAttribute("pool-deadlock-maxwait"))); pds.setDeadLockRetryWait(Long.parseLong(jotmJdbcElement.getAttribute("pool-deadlock-retrywait"))); - + // set the test statement to test connections String testStmt = jotmJdbcElement.getAttribute("pool-jdbc-test-stmt"); if (testStmt != null && testStmt.length() > 0) { pds.setJdbcTestStmt(testStmt); Debug.logInfo("Set JDBC Test Statement : " + testStmt, module); - } + } } catch (NumberFormatException nfe) { Debug.logError(nfe, "Problems with pool settings; the values MUST be numbers, using defaults.", module); } catch (Exception e) { Debug.logError(e, "Problems with pool settings", module); } - + // cache the pool - dsCache.put(helperName, pds); - + dsCache.put(helperName, pds); + return TransactionFactory.getCursorConnection(helperName, pds.getConnection()); - } + } } - + public static void closeAll() { Set cacheKeys = dsCache.keySet(); Iterator i = cacheKeys.iterator(); while (i.hasNext()) { String helperName = (String) i.next(); StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.remove(helperName); - pds.shutdown(true); - } + pds.shutdown(true); + } } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -754,7 +754,7 @@ if (queryTotalTime > 150) { Debug.logTiming("Ran query in " + queryTotalTime + " milli-seconds: " + sql, module); } - } + } return new EntityListIterator(sqlP, modelEntity, selectFields, modelFieldTypeReader); } @@ -882,7 +882,7 @@ // put this inside an if statement so that we don't have to generate the string when not used... Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module); } - + boolean isGroupBy = false; ModelViewEntity modelViewEntity = null; String groupByString = null; @@ -890,17 +890,17 @@ modelViewEntity = (ModelViewEntity) modelEntity; groupByString = modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), ", ", "", false); if (UtilValidate.isNotEmpty(groupByString)) { - isGroupBy = true; + isGroupBy = true; } } - + // To get a count of the rows that will be returned when there is a GROUP BY, must do something like: // SELECT COUNT(1) FROM (SELECT COUNT(1) FROM OFBIZ.POSTAL_ADDRESS PA GROUP BY PA.CITY) TEMP_NAME // instead of a simple: // SELECT COUNT(1) FROM OFBIZ.POSTAL_ADDRESS PA GROUP BY PA.CITY StringBuilder sqlBuffer = new StringBuilder("SELECT "); - + if (isGroupBy) { sqlBuffer.append("COUNT(1) FROM (SELECT "); } @@ -961,7 +961,7 @@ sqlBuffer.append(" HAVING "); sqlBuffer.append(entityCondHavingString); } - + if (isGroupBy) { sqlBuffer.append(") TEMP_NAME"); } @@ -998,7 +998,7 @@ count = resultSet.getLong(1); } return count; - + } catch (SQLException e) { throw new GenericDataSourceException("Error getting count value", e); } finally { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -30,7 +30,7 @@ * */ public class GenericHelperFactory { - + public static final String module = GenericHelperFactory.class.getName(); // protected static UtilCache helperCache = new UtilCache("entity.GenericHelpers", 0, 0); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/eca/EntityEcaHandler.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -26,19 +26,19 @@ * */ public interface EntityEcaHandler<T> { - + public static final String EV_VALIDATE = "validate"; public static final String EV_RUN = "run"; public static final String EV_RETURN = "return"; public static final String EV_CACHE_CLEAR = "cache-clear"; public static final String EV_CACHE_CHECK = "cache-check"; public static final String EV_CACHE_PUT = "cache-put"; - + public static final String OP_CREATE = "create"; public static final String OP_STORE = "store"; public static final String OP_REMOVE = "remove"; public static final String OP_FIND = "find"; - + public void setDelegator(GenericDelegator delegator); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -35,14 +35,14 @@ * */ public class ByAndFinder extends ListFinder { - - public static final String module = ByAndFinder.class.getName(); - + + public static final String module = ByAndFinder.class.getName(); + protected Map<FlexibleMapAccessor<Object>, Object> fieldMap; public ByAndFinder(Element element) { super(element, "and"); - + // process field-map this.fieldMap = EntityFinderUtil.makeFieldMap(element); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -45,7 +45,7 @@ public ByConditionFinder(Element element) { super(element, "condition"); - // NOTE: the whereCondition can be null, ie (condition-expr | condition-list) is optional; if left out, means find all, or with no condition in essense + // NOTE: the whereCondition can be null, ie (condition-expr | condition-list) is optional; if left out, means find all, or with no condition in essense // process condition-expr | condition-list Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr"); Element conditionListElement = UtilXml.firstChildElement(element, "condition-list"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -59,9 +59,9 @@ * */ public class EntityFinderUtil { - - public static final String module = EntityFinderUtil.class.getName(); - + + public static final String module = EntityFinderUtil.class.getName(); + public static Map<FlexibleMapAccessor<Object>, Object> makeFieldMap(Element element) { Map<FlexibleMapAccessor<Object>, Object> fieldMap = null; List<? extends Element> fieldMapElementList = UtilXml.childElementList(element, "field-map"); @@ -114,7 +114,7 @@ } } } - + public static List<FlexibleStringExpander> makeSelectFieldExpanderList(Element element) { List<FlexibleStringExpander> selectFieldExpanderList = null; List<? extends Element> selectFieldElementList = UtilXml.childElementList(element, "select-field"); @@ -126,7 +126,7 @@ } return selectFieldExpanderList; } - + public static Set<String> makeFieldsToSelect(List<FlexibleStringExpander> selectFieldExpanderList, Map<String, Object> context) { Set<String> fieldsToSelect = null; if (UtilValidate.isNotEmpty(selectFieldExpanderList)) { @@ -137,7 +137,7 @@ } return fieldsToSelect; } - + public static List<String> makeOrderByFieldList(List<FlexibleStringExpander> orderByExpanderList, Map<String, Object> context) { List<String> orderByFields = null; if (UtilValidate.isNotEmpty(orderByExpanderList)) { @@ -148,7 +148,7 @@ } return orderByFields; } - + public static interface Condition extends Serializable { public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator); } @@ -161,7 +161,7 @@ protected boolean ignoreIfNull; protected boolean ignoreIfEmpty; protected boolean ignoreCase; - + public ConditionExpr(Element conditionExprElement) { this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("field-name")); if (this.fieldNameExdr.isEmpty()) { @@ -179,17 +179,17 @@ this.ignoreIfNull = "true".equals(conditionExprElement.getAttribute("ignore-if-null")); this.ignoreIfEmpty = "true".equals(conditionExprElement.getAttribute("ignore-if-empty")); this.ignoreCase = "true".equals(conditionExprElement.getAttribute("ignore-case")); - this.ignoreExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("ignore")); + this.ignoreExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("ignore")); } - + public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) { ModelEntity modelEntity = delegator.getModelEntity(entityName); if (modelEntity == null) { throw new IllegalArgumentException("Error in Entity Find: could not find entity with name [" + entityName + "]"); } - + 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) { @@ -211,22 +211,22 @@ && value instanceof String) { String delim = null; if (((String)value).indexOf("|") >= 0) { - delim = "|"; + delim = "|"; } else if (((String)value).indexOf(",") >= 0) { - delim = ","; + delim = ","; } if (UtilValidate.isNotEmpty(delim)) { - value = StringUtil.split((String)value, delim); + value = StringUtil.split((String)value, delim); } } - + // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection - if (!((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN) + if (!((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN) && value instanceof Collection)) { // now to a type conversion for the target fieldName value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context); } - + if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module); if (this.ignoreIfNull && value == null) { @@ -239,18 +239,18 @@ 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 if (ignoreCase) { return EntityCondition.makeCondition( - EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), (EntityComparisonOperator) operator, EntityFunction.UPPER(value)), + EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), (EntityComparisonOperator) operator, EntityFunction.UPPER(value)), EntityOperator.OR, EntityCondition.makeCondition(fieldName, EntityOperator.EQUALS, null)); } else { return EntityCondition.makeCondition( - EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) operator, value), + EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) operator, value), EntityOperator.OR, EntityCondition.makeCondition(fieldName, EntityOperator.EQUALS, null)); } @@ -264,14 +264,14 @@ } } } - + public static class ConditionList implements Condition { List<Condition> conditionList = new LinkedList<Condition>(); FlexibleStringExpander combineExdr; - + public ConditionList(Element conditionListElement) { this.combineExdr = FlexibleStringExpander.getInstance(conditionListElement.getAttribute("combine")); - + List<? extends Element> subElements = UtilXml.childElementList(conditionListElement); for (Element subElement: subElements) { if ("condition-expr".equals(subElement.getNodeName())) { @@ -285,7 +285,7 @@ } } } - + public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) { if (this.conditionList.size() == 0) { return null; @@ -294,7 +294,7 @@ Condition condition = this.conditionList.get(0); return condition.createCondition(context, entityName, delegator); } - + List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>(); for (Condition curCondition: conditionList) { EntityCondition econd = curCondition.createCondition(context, entityName, delegator); @@ -302,19 +302,19 @@ 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, (EntityJoinOperator) operator); } } public static class ConditionObject implements Condition { protected FlexibleMapAccessor<Object> fieldNameAcsr; - + public ConditionObject(Element conditionExprElement) { this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field-name")); if (this.fieldNameAcsr.isEmpty()) { @@ -322,13 +322,13 @@ this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("name")); } } - + public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) { EntityCondition condition = (EntityCondition) fieldNameAcsr.get(context); return condition; } } - + public static interface OutputHandler extends Serializable { 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); @@ -336,12 +336,12 @@ public static class LimitRange implements OutputHandler { FlexibleStringExpander startExdr; FlexibleStringExpander sizeExdr; - + public LimitRange(Element limitRangeElement) { this.startExdr = FlexibleStringExpander.getInstance(limitRangeElement.getAttribute("start")); this.sizeExdr = FlexibleStringExpander.getInstance(limitRangeElement.getAttribute("size")); } - + int getStart(Map<String, Object> context) { String startStr = this.startExdr.expandString(context); try { @@ -352,7 +352,7 @@ throw new IllegalArgumentException(errMsg); } } - + int getSize(Map<String, Object> context) { String sizeStr = this.sizeExdr.expandString(context); try { @@ -363,7 +363,7 @@ throw new IllegalArgumentException(errMsg); } } - + public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { int start = getStart(context); int size = getSize(context); @@ -380,22 +380,22 @@ public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { 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)); } } public static class LimitView implements OutputHandler { FlexibleStringExpander viewIndexExdr; FlexibleStringExpander viewSizeExdr; - + public LimitView(Element limitViewElement) { this.viewIndexExdr = FlexibleStringExpander.getInstance(limitViewElement.getAttribute("view-index")); this.viewSizeExdr = FlexibleStringExpander.getInstance(limitViewElement.getAttribute("view-size")); } - + int getIndex(Map<String, Object> context) { String viewIndexStr = this.viewIndexExdr.expandString(context); try { @@ -406,7 +406,7 @@ throw new IllegalArgumentException(errMsg); } } - + int getSize(Map<String, Object> context) { String viewSizeStr = this.viewSizeExdr.expandString(context); try { @@ -417,11 +417,11 @@ throw new IllegalArgumentException(errMsg); } } - + 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)); eli.close(); @@ -435,11 +435,11 @@ public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { 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)); } } @@ -447,7 +447,7 @@ public UseIterator(Element useIteratorElement) { // no parameters, nothing to do } - + public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { listAcsr.put(context, eli); } @@ -460,7 +460,7 @@ public GetAll() { // no parameters, nothing to do } - + public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { try { listAcsr.put(context, eli.getCompleteList()); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -34,7 +34,7 @@ this.entityNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("entity-name")); this.useCacheStrExdr = FlexibleStringExpander.getInstance(element.getAttribute("use-cache")); } - + public String getEntityName() { String entName = this.entityNameExdr.getOriginal(); // if there is expansion syntax Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -61,13 +61,13 @@ public static final String module = ListFinder.class.getName(); protected String label; - + protected FlexibleStringExpander filterByDateStrExdr; protected FlexibleStringExpander distinctStrExdr; protected FlexibleStringExpander delegatorNameExdr; protected FlexibleMapAccessor<Object> listAcsr; protected FlexibleStringExpander resultSetTypeExdr; - + protected List<FlexibleStringExpander> selectFieldExpanderList; protected List<FlexibleStringExpander> orderByExpanderList; protected OutputHandler outputHandler; @@ -88,7 +88,7 @@ // process select-field selectFieldExpanderList = EntityFinderUtil.makeSelectFieldExpanderList(element); - + // process order-by List<? extends Element> orderByElementList = UtilXml.childElementList(element, "order-by"); if (orderByElementList.size() > 0) { @@ -125,18 +125,18 @@ String delegatorName = this.delegatorNameExdr.expandString(context); ModelEntity modelEntity = delegator.getModelEntity(entityName); String resultSetTypeString = this.resultSetTypeExdr.expandString(context); - + if (modelEntity == null) { throw new IllegalArgumentException("In find entity by " + label + " could not find definition for entity with name [" + entityName + "]."); } - + boolean useCache = "true".equals(useCacheStr); boolean filterByDate = "true".equals(filterByDateStr); boolean distinct = "true".equals(distinctStr); int resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; if ("forward".equals(resultSetTypeString)) resultSetType = ResultSet.TYPE_FORWARD_ONLY; - + if (delegatorName != null && delegatorName.length() > 0) { delegator = GenericDelegator.getGenericDelegator(delegatorName); } @@ -156,8 +156,8 @@ throw new IllegalArgumentException("In find entity by " + label + " cannot have use-cache set to true and specify a having-condition-list (can only use a where condition with condition-expr or condition-list)."); } } - - + + // get the list of fieldsToSelect from selectFieldExpanderList Set<String> fieldsToSelect = EntityFinderUtil.makeFieldsToSelect(selectFieldExpanderList, context); @@ -168,7 +168,7 @@ // get the list of orderByFields from orderByExpanderList List<String> orderByFields = EntityFinderUtil.makeOrderByFieldList(this.orderByExpanderList, context); - + try { // if filterByDate, do a date filter on the results based on the now-timestamp if (filterByDate) { @@ -179,7 +179,7 @@ whereEntityCondition = filterByDateCondition; } } - + if (useCache) { List<GenericValue> results = delegator.findList(entityName, whereEntityCondition, fieldsToSelect, orderByFields, null, true); this.outputHandler.handleOutput(results, context, listAcsr); @@ -190,7 +190,7 @@ Debug.logError(newE, "ERROR: Cannot do a by " + label + " find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.", module); useTransaction = false; } - + EntityFindOptions options = new EntityFindOptions(); options.setDistinct(distinct); options.setResultSetType(resultSetType); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -42,8 +42,8 @@ * */ public class PrimaryKeyFinder extends Finder { - public static final String module = PrimaryKeyFinder.class.getName(); - + public static final String module = PrimaryKeyFinder.class.getName(); + protected FlexibleMapAccessor<Object> valueNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; protected Map<FlexibleMapAccessor<Object>, Object> fieldMap; @@ -67,7 +67,7 @@ public void runFind(Map<String, Object> context, GenericDelegator delegator) throws GeneralException { String entityName = this.entityNameExdr.expandString(context); - + String useCacheString = this.useCacheStrExdr.expandString(context); // default to false boolean useCacheBool = "true".equals(useCacheString); @@ -78,7 +78,7 @@ ModelEntity modelEntity = delegator.getModelEntity(entityName); GenericValue valueOut = runFind(modelEntity, context, delegator, useCacheBool, autoFieldMapBool, this.fieldMap, this.selectFieldExpanderList); - + //Debug.logInfo("PrimaryKeyFinder: valueOut=" + valueOut, module); //Debug.logInfo("PrimaryKeyFinder: going into=" + this.valueNameAcsr.getOriginalName(), module); if (!valueNameAcsr.isEmpty()) { @@ -89,10 +89,10 @@ } } } - - public static GenericValue runFind(ModelEntity modelEntity, Map<String, Object> context, GenericDelegator delegator, boolean useCache, boolean autoFieldMap, + + public static GenericValue runFind(ModelEntity modelEntity, Map<String, Object> context, GenericDelegator delegator, boolean useCache, boolean autoFieldMap, Map<FlexibleMapAccessor<Object>, Object> fieldMap, List<FlexibleStringExpander> selectFieldExpanderList) throws GeneralException { - + // assemble the field map Map<String, Object> entityContext = FastMap.newInstance(); if (autoFieldMap) { @@ -113,15 +113,15 @@ //Debug.logInfo("PrimaryKeyFinder: entityContext=" + entityContext, module); // then convert the types... modelEntity.convertFieldMapInPlace(entityContext, delegator); - + // get the list of fieldsToSelect from selectFieldExpanderList Set<String> fieldsToSelect = EntityFinderUtil.makeFieldsToSelect(selectFieldExpanderList, context); - + //if fieldsToSelect != null and useCacheBool is true, throw an error if (fieldsToSelect != null && useCache) { throw new IllegalArgumentException("Error in entity-one definition, cannot specify select-field elements when use-cache is set to true"); } - + try { GenericValue valueOut = null; GenericPK entityPK = delegator.makePK(modelEntity.getEntityName(), entityContext); @@ -140,7 +140,7 @@ } else { if (Debug.infoOn()) Debug.logInfo("Returning null because found incomplete primary key in find: " + entityPK, module); } - + return valueOut; } catch (GenericEntityException e) { String errMsg = "Error finding entity value by primary key with entity-one: " + e.toString(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/AbstractCursorHandler.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -25,7 +25,7 @@ import java.lang.reflect.Proxy; public abstract class AbstractCursorHandler implements InvocationHandler { - + protected String cursorName; protected int fetchSize; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -121,7 +121,7 @@ } } } - return _factory; + return _factory; } public static Connection getManagedConnection(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorConnection.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorConnection.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorConnection.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorConnection.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorResultSet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorResultSet.java?rev=757065&r1=757064&r2=757065&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorResultSet.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/CursorResultSet.java Sat Mar 21 23:22:45 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
Free forum by Nabble | Edit this page |