/** * Creates a constraint for a path to be not equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute neq(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.NOT_EQUALS, value); }
/** * Creates a constraint for a path to be LIKE a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute like(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.MATCHES, value); }
/** * Creates a constraint for a path to not contain a value. * * @param path the path that the constraint is attached to * @param contained the value this path's field should not contain. * @return a new PathConstraint object */ public static PathConstraintAttribute doesNotContain(String path, String contained) { return new PathConstraintAttribute(path, ConstraintOp.DOES_NOT_CONTAIN, contained); } }
/** * Creates a constraint for a path to be NOT LIKE a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute notLike(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.DOES_NOT_MATCH, value); }
/** * Creates a constraint for a path to be less than or equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute lessThanEqualTo(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.LESS_THAN_EQUALS, value); }
/** * Creates a constraint for a path to contain a value. * * @param path the path that the constraint is attached to * @param contained the value this path's field should contain. * @return a new PathConstraint object */ public static PathConstraintAttribute contains(String path, String contained) { return new PathConstraintAttribute(path, ConstraintOp.CONTAINS, contained); }
/** * Creates a constraint for a path to be LIKE a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute like(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.MATCHES, value); }
/** * Creates a constraint for a path to be less than or equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute lessThanEqualTo(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.LESS_THAN_EQUALS, value); }
/** * Creates a constraint for a path to be greater than a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute greaterThan(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.GREATER_THAN, value); }
/** * Creates a constraint for a path to contain a value. * * @param path the path that the constraint is attached to * @param contained the value this path's field should contain. * @return a new PathConstraint object */ public static PathConstraintAttribute contains(String path, String contained) { return new PathConstraintAttribute(path, ConstraintOp.CONTAINS, contained); }
/** * Creates a constraint for a path to be greater than a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute greaterThan(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.GREATER_THAN, value); }
/** * Creates a constraint for a path to be greater than or equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute greaterThanEqualTo(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.GREATER_THAN_EQUALS, value); }
/** * Creates a constraint for a path to be equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute eq(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.EQUALS, value); }
/** * Creates a constraint for a path to be less than a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute lessThan(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.LESS_THAN, value); }
/** * Creates a constraint for a path to be greater than or equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute greaterThanEqualTo(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.GREATER_THAN_EQUALS, value); }
/** * Creates a constraint for a path to be equal to a value. * * @param path the path to apply the constraint to * @param value the value to constrain to * @return a new PathConstraint object */ public static PathConstraintAttribute eq(String path, String value) { return new PathConstraintAttribute(path, ConstraintOp.EQUALS, value); }
/** * Creates a constraint for a path to not contain a value. * * @param path the path that the constraint is attached to * @param contained the value this path's field should not contain. * @return a new PathConstraint object */ public static PathConstraintAttribute doesNotContain(String path, String contained) { return new PathConstraintAttribute(path, ConstraintOp.DOES_NOT_CONTAIN, contained); } }
public void testIsListConstraint() { PathConstraint pc1 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "EmployeeA1"); PathConstraint pc2 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[]"); PathConstraint pc3 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[list]"); PathConstraint pc4 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[LIST]"); assertEquals(false, WidgetConfigUtil.isListConstraint(pc1)); assertEquals(false, WidgetConfigUtil.isListConstraint(pc2)); assertEquals(true, WidgetConfigUtil.isListConstraint(pc3)); assertEquals(true, WidgetConfigUtil.isListConstraint(pc4)); }
public void testIsFilterConstraint() throws Exception { WidgetConfig config = webConfig.getWidgets().get("contractor_enrichment_with_filter1"); PathConstraint pc1 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "EmployeeA1"); PathConstraint pc2 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[filter]"); PathConstraint pc3 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[testFilter]"); PathConstraint pc4 = new PathConstraintAttribute("Employee.name", ConstraintOp.EQUALS, "[TESTFilter]"); assertEquals(false, WidgetConfigUtil.isFilterConstraint(config, pc1)); assertEquals(false, WidgetConfigUtil.isFilterConstraint(config, pc2)); assertEquals(true, WidgetConfigUtil.isFilterConstraint(config, pc3)); assertEquals(true, WidgetConfigUtil.isFilterConstraint(config, pc4)); } }
private PathQuery getQuery2(Model model) { PathQuery q = new PathQuery(model); q.addView("Employee.name"); q.addView("Employee.department.name"); q.addOrderBy("Employee.age", OrderDirection.ASC); q.addConstraint(new PathConstraintAttribute("Employee.age", ConstraintOp.LESS_THAN, "50")); q.addConstraint(new PathConstraintAttribute("Employee.department.name", ConstraintOp.EQUALS, "Fred")); q.setConstraintLogic("A or B"); q.setOuterJoinStatus("Employee.department", OuterJoinStatus.INNER); q.setDescription("Flibble"); q.setDescription("Employee.name", "Albert"); return q; }