Author: mbrohl
Date: Sun Dec 17 11:19:19 2017 New Revision: 1818474 URL: http://svn.apache.org/viewvc?rev=1818474&view=rev Log: Improved: General refactoring and code improvements, package org.apache.ofbiz.entity.finder. (OFBIZ-9953) Thanks Dennis Balkir for reporting and providing the patches. Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/Finder.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/PrimaryKeyFinder.java Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java?rev=1818474&r1=1818473&r2=1818474&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java Sun Dec 17 11:19:19 2017 @@ -96,7 +96,6 @@ public final class EntityFinderUtil { } public static void expandFieldMapToContext(Map<FlexibleMapAccessor<Object>, Object> fieldMap, Map<String, Object> context, Map<String, Object> outContext) { - //Debug.logInfo("fieldMap: " + fieldMap, module); if (fieldMap != null) { for (Map.Entry<FlexibleMapAccessor<Object>, Object> entry: fieldMap.entrySet()) { FlexibleMapAccessor<Object> serviceContextFieldAcsr = entry.getKey(); @@ -226,7 +225,9 @@ public final class EntityFinderUtil { value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, modelFieldTypeReader, context); } - if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module); + if (Debug.verboseOn()) { + Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module); + } if (this.ignoreIfEmpty && ObjectType.isEmpty(value)) { return null; Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/Finder.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/Finder.java?rev=1818474&r1=1818473&r2=1818474&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/Finder.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/Finder.java Sun Dec 17 11:19:19 2017 @@ -39,7 +39,9 @@ public abstract class Finder implements public String getEntityName() { String entName = this.entityNameExdr.getOriginal(); // if there is expansion syntax - if (entName.indexOf("${") >= 0) return null; + if (entName.indexOf("${") >= 0) { + return null; + } return entName; } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java?rev=1818474&r1=1818473&r2=1818474&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java Sun Dec 17 11:19:19 2017 @@ -89,7 +89,7 @@ public abstract class ListFinder extends // process order-by List<? extends Element> orderByElementList = UtilXml.childElementList(element, "order-by"); if (orderByElementList.size() > 0) { - orderByExpanderList = new ArrayList<FlexibleStringExpander>(orderByElementList.size()); + orderByExpanderList = new ArrayList<>(orderByElementList.size()); for (Element orderByElement: orderByElementList) { orderByExpanderList.add(FlexibleStringExpander.getInstance(orderByElement.getAttribute("field-name"))); } @@ -132,8 +132,9 @@ public abstract class ListFinder extends boolean filterByDate = "true".equals(filterByDateStr); boolean distinct = "true".equals(distinctStr); int resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; - if ("forward".equals(resultSetTypeString)) + if ("forward".equals(resultSetTypeString)) { resultSetType = ResultSet.TYPE_FORWARD_ONLY; + } if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); @@ -213,7 +214,7 @@ public abstract class ListFinder extends } EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields, options); this.outputHandler.handleOutput(eli, context, listAcsr); - // NOTE: the eli EntityListIterator is not closed here. It SHOULD be closed later after the returned list will be used (eg see EntityAnd.getChildren() in ModelTree.java) + // NOTE: the eli EntityListIterator is not closed here. It SHOULD be closed later after the returned list will be used (eg see EntityAnd.getChildren() in ModelTree.java) } catch (GenericEntityException e) { String errMsg = "Failure in by " + label + " find operation, rolling back transaction"; Debug.logError(e, errMsg, module); Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/PrimaryKeyFinder.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=1818474&r1=1818473&r2=1818474&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/PrimaryKeyFinder.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/PrimaryKeyFinder.java Sun Dec 17 11:19:19 2017 @@ -86,8 +86,6 @@ public class PrimaryKeyFinder extends Fi 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()) { this.valueNameAcsr.put(context, valueOut); } else { @@ -122,7 +120,6 @@ public class PrimaryKeyFinder extends Fi } } EntityFinderUtil.expandFieldMapToContext(fieldMap, context, entityContext); - //Debug.logInfo("PrimaryKeyFinder: entityContext=" + entityContext, module); // then convert the types... // need the timeZone and locale for conversion, so add here and remove after @@ -156,7 +153,9 @@ public class PrimaryKeyFinder extends Fi } } } else { - if (Debug.infoOn()) Debug.logInfo("Returning null because found incomplete primary key in find: " + entityPK, module); + if (Debug.infoOn()) { + Debug.logInfo("Returning null because found incomplete primary key in find: " + entityPK, module); + } } return valueOut; |
Free forum by Nabble | Edit this page |