Package org.apache.oozie.CoordinatorEngine

Examples of org.apache.oozie.CoordinatorEngine.FILTER_COMPARATORS


        List<Object>> filterMap) {
        Map<String, Object> params = new HashMap<String, Object>();
        int pcnt= 1;
        for (Entry<Pair<String, FILTER_COMPARATORS>, List<Object>> filter : filterMap.entrySet()) {
            String field = filter.getKey().getFist();
            FILTER_COMPARATORS comp = filter.getKey().getSecond();
            String sqlField;
            if (field.equals(OozieClient.FILTER_STATUS)) {
                sqlField = "a.statusStr";
            } else if (field.equals(OozieClient.FILTER_NOMINAL_TIME)) {
                sqlField = "a.nominalTimestamp";
            } else {
                throw new IllegalArgumentException("Invalid filter key " + field);
            }

            sb.append(" and ").append(sqlField).append(" ");
            switch (comp) {
            case EQUALS:
                sb.append("IN (");
                params.putAll(appendParams(sb, filter.getValue(), pcnt));
                sb.append(")");
                break;

            case NOT_EQUALS:
                sb.append("NOT IN (");
                params.putAll(appendParams(sb, filter.getValue(), pcnt));
                sb.append(")");
                break;

            case GREATER:
            case GREATER_EQUAL:
            case LESSTHAN:
            case LESSTHAN_EQUAL:
                if (filter.getValue().size() != 1) {
                    throw new IllegalArgumentException(field + comp.getSign() + " can't have more than 1 values");
                }

                sb.append(comp.getSign()).append(" ");
                params.putAll(appendParams(sb, filter.getValue(), pcnt));
                break;
            }

            pcnt += filter.getValue().size();
View Full Code Here

TOP

Related Classes of org.apache.oozie.CoordinatorEngine.FILTER_COMPARATORS

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.