Package org.ofbiz.entity.condition

Examples of org.ofbiz.entity.condition.EntityOperator


            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))
                    && 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))
                    && value instanceof Collection)) {
                // now to a type conversion for the target fieldName
                value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context);
            }
View Full Code Here


                    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);
View Full Code Here

     * @return a arrayList usable to create an entityCondition
     */
    public static ArrayList<EntityCondition> createCondition(ModelEntity modelEntity, HashMap<String, HashMap<String, HashMap<String, Object>>> normalizedFields, Map<String, Object> queryStringMap, Map<String, List<Object[]>> origValueMap, GenericDelegator delegator, Map<String, ?> context) {
        HashMap<String, HashMap<String, Object>> subMap = null;
        HashMap<String, Object> subMap2 = null;
        EntityOperator fieldOp = null;
        Object fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
                                  // If it is an "op" field, it will be "equals", "greaterThan", etc.
        EntityExpr cond = null;
        ArrayList<EntityCondition> tmpList = new ArrayList<EntityCondition>();
        String opString = null;
View Full Code Here

            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);
            }
View Full Code Here

                    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);
View Full Code Here

            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 operator, see if value is a literal list and split it
View Full Code Here

                    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);
View Full Code Here

     */
    public static ArrayList createCondition(List keys, HashMap normalizedFields, Map queryStringMap, Map origValueMap) {
        String fieldName = null;
        HashMap subMap = null;
        HashMap subMap2 = null;
        EntityOperator fieldOp = null;
        String fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
                                  // If it is an "op" field, it will be "equals", "greaterThan", etc.
        Iterator iter = keys.iterator();
        EntityExpr cond = null;
        ArrayList tmpList = new ArrayList();
View Full Code Here

     */
    public static ArrayList createCondition(List keys, HashMap normalizedFields, Map queryStringMap, Map origValueMap) {
        String fieldName = null;
        HashMap subMap = null;
        HashMap subMap2 = null;
        EntityOperator fieldOp = null;
        String fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
                                  // If it is an "op" field, it will be "equals", "greaterThan", etc.
        Iterator iter = keys.iterator();
        EntityExpr cond = null;
        ArrayList tmpList = new ArrayList();
View Full Code Here

            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
View Full Code Here

TOP

Related Classes of org.ofbiz.entity.condition.EntityOperator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.