/** * Creates a constraint for a path with the LOOKUP operator. * * @param path the path to apply the constraint to * @param value the value to constrain to * @param extraValue the extra value * @return a new PathConstraint object */ public static PathConstraintLookup lookup(String path, String value, String extraValue) { return new PathConstraintLookup(path, value, extraValue); }
private static String handleConstraint(PathConstraintLookup pc) { return format(LOOKUP_FMT, qq(pc.getPath()), qq(pc.getValue()), qq(pc.getExtraValue())); }
String value = ((PathConstraintLookup) pc).getValue(); String extraValue = ((PathConstraintLookup) pc).getExtraValue(); StringBuilder sb = new StringBuilder(start) .append("{\"op\": \"LOOKUP\", \"value\": \"")
((PathConstraintBag) pathConstraint).getBag()); } else if (pathConstraint instanceof PathConstraintLookup) { newPathConstraint = new PathConstraintLookup(newPath, ((PathConstraintLookup) pathConstraint).getValue(), ((PathConstraintLookup) pathConstraint).getExtraValue()); } else if (pathConstraint instanceof PathConstraintSubclass) { newPathConstraint = new PathConstraintSubclass(newPath,
/** * A static method for getting the extra-value if there is one, or * null if there is none to be got. * @param con The constraint to get the extra value of. * @return The constraint's extra-value, or null. */ public static String getExtraValue(PathConstraint con) { if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getExtraValue(); } else { return null; } }
/** * A static method for accessing values without having to handle * the subclasses manually. * @param con The constraint. * @return A string representing the value. */ public static String getValue(PathConstraint con) { if (con instanceof PathConstraintAttribute) { return ((PathConstraintAttribute) con).getValue(); } else if (con instanceof PathConstraintBag) { return ((PathConstraintBag) con).getBag(); } else if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getValue(); } else if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else if (con instanceof PathConstraintLoop) { return ((PathConstraintLoop) con).getLoopPath(); } else if (con instanceof PathConstraintNull) { return ((PathConstraintNull) con).getOp().toString(); } return null; }
writer.writeAttribute("op", "" + constraint.getKey().getOp()); writer.writeAttribute("value", ((PathConstraintLookup) constraint.getKey()) .getValue()); String extraValue = ((PathConstraintLookup) constraint.getKey()).getExtraValue(); if (extraValue != null) { writer.writeAttribute("extraValue", extraValue);
((PathConstraintBag) pathConstraint).getBag()); } else if (pathConstraint instanceof PathConstraintLookup) { newPathConstraint = new PathConstraintLookup(newPath, ((PathConstraintLookup) pathConstraint).getValue(), ((PathConstraintLookup) pathConstraint).getExtraValue()); } else if (pathConstraint instanceof PathConstraintSubclass) { newPathConstraint = new PathConstraintSubclass(newPath,
/** * A static method for getting the extra-value if there is one, or * null if there is none to be got. * @param con The constraint to get the extra value of. * @return The constraint's extra-value, or null. */ public static String getExtraValue(PathConstraint con) { if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getExtraValue(); } else { return null; } }
/** * A static method for accessing values without having to handle * the subclasses manually. * @param con The constraint. * @return A string representing the value. */ public static String getValue(PathConstraint con) { if (con instanceof PathConstraintAttribute) { return ((PathConstraintAttribute) con).getValue(); } else if (con instanceof PathConstraintBag) { return ((PathConstraintBag) con).getBag(); } else if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getValue(); } else if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else if (con instanceof PathConstraintLoop) { return ((PathConstraintLoop) con).getLoopPath(); } else if (con instanceof PathConstraintNull) { return ((PathConstraintNull) con).getOp().toString(); } return null; }
String value = ((PathConstraintLookup) pc).getValue(); String extraValue = ((PathConstraintLookup) pc).getExtraValue(); StringBuilder sb = new StringBuilder(start) .append("{\"op\": \"LOOKUP\", \"value\": \"")
query.addConstraint(new PathConstraintAttribute("CEOTest.company.name", ConstraintOp.CONTAINS, "pany")); query.addConstraint(new PathConstraintLookup( "CEOTest.company.CEOTest.department.company.CEOTest", "ttt", "DepartmentA1")); query.setOuterJoinStatus("CEOTest.company", OuterJoinStatus.OUTER); PathConstraintLookup constraint3 = (PathConstraintLookup) queryUpdated .getConstraintsForPath("CEO.company.CEO.department.company.CEO").get(0); assertEquals("ttt", constraint3.getValue()); assertEquals("DepartmentA1", constraint3.getExtraValue());
/** * Creates a constraint for a path with the LOOKUP operator. * * @param path the path to apply the constraint to * @param value the value to constrain to * @param extraValue the extra value * @return a new PathConstraint object */ public static PathConstraintLookup lookup(String path, String value, String extraValue) { return new PathConstraintLookup(path, value, extraValue); }
private static String handleConstraint(PathConstraintLookup pc) { return format(LOOKUP_FMT, qq(pc.getPath()), qq(pc.getValue()), qq(pc.getExtraValue())); }
writer.writeAttribute("op", "" + constraint.getKey().getOp()); writer.writeAttribute("value", ((PathConstraintLookup) constraint.getKey()) .getValue()); String extraValue = ((PathConstraintLookup) constraint.getKey()).getExtraValue(); if (extraValue != null) { writer.writeAttribute("extraValue", extraValue);
extraValue = constraintObj.getString("extraValue"); constraint = new PathConstraintLookup(path, value, extraValue); } else if ("ONE OF".equals(op) || "NONE OF".equals(op)) { List<String> oneOfValues = new ArrayList<String>();
subv = dblQuote(((PathConstraintBag) pc).getBag()); } else if ("PathConstraintLookup".equals(className)) { String extraValue = ((PathConstraintLookup) pc).getExtraValue(); if (StringUtils.isBlank(extraValue)) { subv = dblQuote(((PathConstraintLookup) pc).getValue()); } else { subv = dblQuote(((PathConstraintLookup) pc).getValue() + "\", :with => \"" + extraValue);
extraValue = constraintObj.getString("extraValue"); constraint = new PathConstraintLookup(path, value, extraValue); } else if ("ONE OF".equals(op) || "NONE OF".equals(op)) { List<String> oneOfValues = new ArrayList<String>();
sb.append(", \"" + value + "\""); } else if ("PathConstraintLookup".equals(className)) { String value = ((PathConstraintLookup) pc).getValue(); String extraValue = ((PathConstraintLookup) pc).getExtraValue(); sb.append('"').append(op.toString()).append('"'); sb.append(", \"").append(value).append('"');
extraValue = null; return new PathConstraintLookup(path, lookup, extraValue); } else { throw new SAXException("Invalid operation type: " + constraintOp