Fixed: Clean groovy file FindLookUp
No functional change :
* remove case syntax
* use groovy syntax (excepted on executeResult.listIt, EntityListIterator not support the groovy syntax *if (!listIt)*)
* use Elvis operator for default values
* add typage to help ide and compilation
* under the License.
*/
-
-
-
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtilProperties
-if (context.noConditionFind == null) {
- context.noConditionFind = parameters.noConditionFind
-}
-if (context.noConditionFind == null) {
- context.noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator)
-}
-if (context.filterByDate == null) {
- context.filterByDate = parameters.filterByDate
+if (! context.noConditionFind) {
+ context.noConditionFind = parameters.noConditionFind ?:
+ EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator)
}
-prepareResult = runService('prepareFind', [entityName : context.entityName,
+Map prepareResult = runService('prepareFind', [entityName: context.entityName,
orderBy: context.orderBy,
inputFields: parameters,
- filterByDate : context.filterByDate,
+ filterByDate: context.filterByDate ?: parameters.filterByDate,
filterByDateValue: context.filterByDateValue,
userLogin: context.userLogin])
-exprList = [EntityCondition.makeCondition("statusId", null),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")]
-statusPartyDisable = EntityCondition.makeCondition(exprList, EntityOperator.OR)
-entityConditionList = null
-if (prepareResult.entityConditionList != null) {
- ConditionList = [prepareResult.entityConditionList, statusPartyDisable]
- entityConditionList = EntityCondition.makeCondition(ConditionList)
+EntityCondition statusPartyDisable = EntityCondition.makeCondition(
+ [EntityCondition.makeCondition("statusId", null),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")],
+ EntityOperator.OR)
+EntityCondition entityConditionList = null
+if (prepareResult.entityConditionList) {
+ entityConditionList = EntityCondition.makeCondition([prepareResult.entityConditionList, statusPartyDisable])
} else if ("Y" == context.noConditionFind) {
entityConditionList = statusPartyDisable
}
-executeResult = runService('executeFind', [entityName : context.entityName,
+Map executeResult = runService('executeFind', [entityName: context.entityName,
orderByList: prepareResult.orderByList,
entityConditionList: entityConditionList,
noConditionFind: context.noConditionFind])
if (executeResult.listIt == null) {
- logWarning("No list found for query string + [" + prepareResult.queryString + "]")
+ logWarning("No list found for query string [${prepareResult.queryString}]")
}
context.listIt = executeResult.listIt
context.queryString = prepareResult.queryString
