/** * Perform test for NOT NULL constraint on node * @param c the constraint to test */ public void apply(Constraint c) { if (c instanceof SimpleConstraint) { SimpleConstraint sc = (SimpleConstraint) c; if (sc.getOp().equals(ConstraintOp.IS_NOT_NULL)) { if (node.equals(sc.getArg1())) { exists = true; } } } } }
/** * Perform test for NOT NULL constraint on node * @param c the constraint to test */ public void apply(Constraint c) { if (c instanceof SimpleConstraint) { SimpleConstraint sc = (SimpleConstraint) c; if (sc.getOp().equals(ConstraintOp.IS_NOT_NULL)) { if (node.equals(sc.getArg1())) { exists = true; } } } } }
/** * Converts a SimpleConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SimpleConstraint object * @param q the Query * @throws ObjectStoreException if something goes wrong */ protected static void simpleConstraintToString(State state, StringBuffer buffer, SimpleConstraint c, Query q) throws ObjectStoreException { queryEvaluableToString(buffer, c.getArg1(), q, state); buffer.append(" " + c.getOp().toString()); if (c.getArg2() != null) { buffer.append(" "); queryEvaluableToString(buffer, c.getArg2(), q, state); } }
/** * Converts a SimpleConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SimpleConstraint object * @param q the Query * @throws ObjectStoreException if something goes wrong */ protected static void simpleConstraintToString(State state, StringBuffer buffer, SimpleConstraint c, Query q) throws ObjectStoreException { queryEvaluableToString(buffer, c.getArg1(), q, state); buffer.append(" " + c.getOp().toString()); if (c.getArg2() != null) { buffer.append(" "); queryEvaluableToString(buffer, c.getArg2(), q, state); } }
public void testGetRealType() throws Exception { SimpleConstraint c1 = new SimpleConstraint(qeNum1, ConstraintOp.EQUALS, qeNum1); c1.negate(); assertEquals(c1.getOp(), ConstraintOp.NOT_EQUALS); SimpleConstraint c2 = new SimpleConstraint(qeNum1, ConstraintOp.NOT_EQUALS, qeNum1); c2.negate(); assertEquals(c2.getOp(), ConstraintOp.EQUALS); SimpleConstraint c3 = new SimpleConstraint(qeNum1, ConstraintOp.LESS_THAN, qeNum1); c3.negate(); assertEquals(c3.getOp(), ConstraintOp.GREATER_THAN_EQUALS); SimpleConstraint c4 = new SimpleConstraint(qeNum1, ConstraintOp.GREATER_THAN_EQUALS, qeNum1); c4.negate(); assertEquals(c4.getOp(), ConstraintOp.LESS_THAN); SimpleConstraint c5 = new SimpleConstraint(qeNum1, ConstraintOp.GREATER_THAN, qeNum1); c5.negate(); assertEquals(c5.getOp(), ConstraintOp.LESS_THAN_EQUALS); SimpleConstraint c6 = new SimpleConstraint(qeNum1, ConstraintOp.LESS_THAN_EQUALS, qeNum1); c6.negate(); assertEquals(c6.getOp(), ConstraintOp.GREATER_THAN); SimpleConstraint c7 = new SimpleConstraint(qeStr1, ConstraintOp.MATCHES, qeStr1); c7.negate(); assertEquals(c7.getOp(), ConstraintOp.DOES_NOT_MATCH); SimpleConstraint c8 = new SimpleConstraint(qeStr1, ConstraintOp.DOES_NOT_MATCH, qeStr1); c8.negate(); assertEquals(c8.getOp(), ConstraintOp.MATCHES); SimpleConstraint c9 = new SimpleConstraint(qeNum1, ConstraintOp.IS_NULL); c9.negate(); assertEquals(c9.getOp(), ConstraintOp.IS_NOT_NULL); SimpleConstraint c10 = new SimpleConstraint(qeNum1, ConstraintOp.IS_NOT_NULL); c10.negate();
if ((origC.getOp() == ConstraintOp.IS_NULL) || (origC.getOp() == ConstraintOp.IS_NOT_NULL)) { return new SimpleConstraint((QueryEvaluable) cloneThing(origC.getArg1(), fromElementMap, qopeMap), origC.getOp()); } else { return new SimpleConstraint((QueryEvaluable) cloneThing(origC.getArg1(), fromElementMap, qopeMap), origC.getOp(), (QueryEvaluable) cloneThing(origC.getArg2(), fromElementMap, qopeMap));
if ((origC.getOp() == ConstraintOp.IS_NULL) || (origC.getOp() == ConstraintOp.IS_NOT_NULL)) { return new SimpleConstraint((QueryEvaluable) cloneThing(origC.getArg1(), fromElementMap, qopeMap), origC.getOp()); } else { return new SimpleConstraint((QueryEvaluable) cloneThing(origC.getArg1(), fromElementMap, qopeMap), origC.getOp(), (QueryEvaluable) cloneThing(origC.getArg2(), fromElementMap, qopeMap));
SimpleConstraint c = (SimpleConstraint) cc; if (c.getArg2() == null) { return nodeToString(q, c.getArg1(), parameters, null) + " " + c.getOp().toString(); } else { return nodeToString(q, c.getArg1(), parameters, null) + " " + c.getOp().toString() + " " + nodeToString(q, c.getArg2(), parameters, null);
SimpleConstraint c = (SimpleConstraint) cc; if (c.getArg2() == null) { return nodeToString(q, c.getArg1(), parameters, null) + " " + c.getOp().toString(); } else { return nodeToString(q, c.getArg1(), parameters, null) + " " + c.getOp().toString() + " " + nodeToString(q, c.getArg2(), parameters, null);