/** * Test case for {@link QueryObjectModelFactory#not(Constraint)} */ public void testNot() throws RepositoryException { PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1); Not not = qf.not(propExist); assertTrue("Not a property existence constraint", not.getConstraint() instanceof PropertyExistence); }
public void testNot() throws RepositoryException { Node n1 = testRootNode.addNode(nodeName1, testNodeType); n1.setProperty(propertyName1, "foo"); Node n2 = testRootNode.addNode(nodeName2, testNodeType); n2.setProperty(propertyName2, "bar"); superuser.save(); QueryObjectModel qom = qf.createQuery( qf.selector(testNodeType, "s"), qf.and( qf.descendantNode("s", testRootNode.getPath()), qf.not( qf.propertyExistence("s", propertyName1) ) ), null, null ); checkQOM(qom, new Node[]{n2}); } }
private void splitNot(ConstraintSplitInfo constraintSplitInfo, Not not) throws RepositoryException { Constraint constraint = not.getConstraint(); if (constraint instanceof Not) { split(constraintSplitInfo, ((Not) constraint).getConstraint()); } else if (constraint instanceof And) { And and = (And) constraint; split(constraintSplitInfo, factory.or(factory.not(and.getConstraint1()), factory.not(and.getConstraint2()))); } else if (constraint instanceof Or) { Or or = (Or) constraint; split(constraintSplitInfo, factory.and(factory.not(or.getConstraint1()), factory.not(or.getConstraint2()))); } else { splitBySelectors(constraintSplitInfo, not, getSelectorNames(constraint)); } }
private void splitNot(ConstraintSplitInfo constraintSplitInfo, Not not) throws RepositoryException { Constraint constraint = not.getConstraint(); if (constraint instanceof Not) { split(constraintSplitInfo, ((Not) constraint).getConstraint()); } else if (constraint instanceof And) { And and = (And) constraint; split(constraintSplitInfo, factory.or(factory.not(and.getConstraint1()), factory.not(and.getConstraint2()))); } else if (constraint instanceof Or) { Or or = (Or) constraint; split(constraintSplitInfo, factory.and(factory.not(or.getConstraint1()), factory.not(or.getConstraint2()))); } else { splitBySelectors(constraintSplitInfo, not, getSelectorNames(constraint)); } }
@Test public void not() throws RepositoryException { Constraint c = f.propertyExistence("x", "c0"); Not n = f.not(c); assertEquals(c, n.getConstraint()); assertEquals("[x].[c0] IS NOT NULL", c.toString()); assertEquals("* IS NOT NULL", f.propertyExistence(null, null).toString()); assertEquals("[s].* IS NOT NULL", f.propertyExistence("s", null).toString()); assertEquals("[p] IS NOT NULL", f.propertyExistence(null, "p").toString()); assertEquals("[s].[p] IS NOT NULL", f.propertyExistence("s", "p").toString()); }
private Constraint parseCondition() throws RepositoryException { Constraint a; if (readIf("NOT")) { a = factory.not(parseConstraint()); } else if (readIf("(")) { a = parseConstraint();
private Constraint parseCondition() throws RepositoryException { Constraint a; if (readIf("NOT")) { a = factory.not(parseConstraint()); } else if (readIf("(")) { a = parseConstraint();
private Constraint parseCondition() throws RepositoryException { Constraint a; if (readIf("NOT")) { a = factory.not(parseConstraint()); } else if (readIf("(")) { a = parseConstraint();