if (value == null && valueExdr != null) {
value = valueExdr.expandString(context);
}
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);
}
// If IN or BETWEEN operator, see if value is a literal list and split it
if ((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN))
&& value instanceof String) {
String delim = null;
if (((String)value).indexOf("|") >= 0) {
delim = "|";
} else if (((String)value).indexOf(",") >= 0) {
delim = ",";
}
if (UtilValidate.isNotEmpty(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.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN))
&& value instanceof Collection)) {
// now to a type conversion for the target fieldName
value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context);
}