congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Condition.c
Code IndexAdd Tabnine to your IDE (free)

How to use
c
method
in
io.yawp.repository.query.condition.Condition

Best Java code snippets using io.yawp.repository.query.condition.Condition.c (Showing top 20 results out of 315)

origin: feroult/yawp

public static BaseCondition c(String field, String operator, Object comparison) {
  return c(field, WhereOperator.toOperator(operator), comparison);
}
origin: feroult/yawp

@Test
public void testWhereWithComplexAndOrStructure() {
  saveManyBasicObjects(3);
  List<BasicObject> objects1 = yawp(BasicObject.class).where(
      or(and(c("intValue", "=", 1), c("intValue", "=", 2)), and(c("intValue", "=", 3), c("intValue", "=", 3)))).list();
  assertEquals(1, objects1.size());
  assertEquals(3, objects1.get(0).getIntValue());
  BaseCondition condition = or(and(c("intValue", "=", 3), c("intValue", "=", 3)), and(c("intValue", "=", 1), c("intValue", "=", 2)));
  List<BasicObject> objects2 = yawp(BasicObject.class).where(condition).list();
  assertEquals(1, objects2.size());
  assertEquals(3, objects2.get(0).getIntValue());
}
origin: feroult/yawp

@Test
public void testWhereInWithEmptyListOrTrueExpression() {
  saveManyBasicObjects(3);
  BaseCondition emptyListCondition = c("intValue", "in", Collections.emptyList());
  BaseCondition condition = or(emptyListCondition, c("stringValue", "=", "xpto"));
  List<BasicObject> objects = yawp(BasicObject.class).where(condition).list();
  assertEquals(3, objects.size());
}
origin: feroult/yawp

@Test
public void testWhereInWithEmptyListAndFalseExpression() {
  saveManyBasicObjects(1);
  BaseCondition emptyListCondition = c("intValue", "in", Collections.emptyList());
  BaseCondition condition = and(emptyListCondition, c("stringValue", "=", "otpx"));
  List<BasicObject> objects = yawp(BasicObject.class).where(condition).list();
  assertEquals(0, objects.size());
}
origin: feroult/yawp

@Test
public void testGrandparentFalseCondition() {
  Grandchild grandchild = saveGrandchild("granchild", saveChild("child", saveParent("another-parent")));
  RuleConditions conditions = new RuleConditions(yawp, Grandchild.class, null, Arrays.asList(grandchild));
  conditions.where(c("name", "=", "granchild"));
  conditions.and(c("parent->name", "=", "child"));
  conditions.and(c("parent->parent->name", "=", "parent"));
  assertFalse(conditions.evaluate());
}
origin: feroult/yawp

@Test
public void testWhereInWithEmptyListOrComplexExpression() {
  saveManyBasicObjects(1);
  BaseCondition emptyListCondition = c("intValue", "in", Collections.emptyList());
  BaseCondition condition = and(emptyListCondition, and(c("stringValue", "=", "otpx"), emptyListCondition));
  List<BasicObject> objects = yawp(BasicObject.class).where(condition).list();
  assertEquals(0, objects.size());
}
origin: feroult/yawp

@Test
public void testParentTrueCondition() {
  Child child = saveChild("child", saveParent("parent"));
  RuleConditions conditions = new RuleConditions(yawp, Child.class, null, Arrays.asList(child));
  conditions.where(c("name", "=", "child"));
  conditions.where(c("parent->name", "=", "parent"));
  assertTrue(conditions.evaluate());
}
origin: feroult/yawp

@Test
public void testParentFalseCondition() {
  Child child = saveChild("child", saveParent("another-parent"));
  RuleConditions conditions = new RuleConditions(yawp, Child.class, null, Arrays.asList(child));
  conditions.where(c("name", "=", "child"));
  conditions.and(c("parent->name", "=", "parent"));
  assertFalse(conditions.evaluate());
}
origin: feroult/yawp

@Test
public void testEvaluateIncomingEqualsExisting() {
  BasicObject object1 = saveObject("xpto");
  BasicObject object2 = saveObject("xpto");
  BasicObject object3 = saveObject("xyz");
  assertTrue(createConditions(Arrays.asList(object1, object2), c("stringValue", "=", "xpto")).evaluate());
  assertFalse(createConditions(Arrays.asList(object1, object3), c("stringValue", "=", "xpto")).evaluate());
}
origin: feroult/yawp

@Test
public void testGrandparentWithoutObjectFalseCondition() {
  Parent parent = saveParent("another-parent");
  saveGrandchild("granchild", saveChild("child", parent));
  RuleConditions conditions = new RuleConditions(yawp, Grandchild.class, parent.getId(), null);
  conditions.where(c("name", "=", "granchild"));
  conditions.and(c("parent->name", "=", "child"));
  conditions.and(c("parent->parent->name", "=", "parent"));
  assertFalse(conditions.evaluate());
}
origin: feroult/yawp

@Test
public void testChainedWheresWithAnd() {
  saveManyBasicObjects(1);
  List<BasicObject> objects = yawp(BasicObject.class).where(and(c("intValue", "=", 1), c("stringValue", "=", "xpto"))).list();
  assertEquals(1, objects.size());
  assertEquals("xpto", objects.get(0).getStringValue());
  assertEquals(1, objects.get(0).getIntValue());
}
origin: feroult/yawp

@Test
public void testGrandparentWithoutObjectTrueCondition() {
  Parent parent = saveParent("parent");
  saveGrandchild("granchild", saveChild("child", parent));
  RuleConditions conditions = new RuleConditions(yawp, Grandchild.class, parent.getId(), null);
  conditions.where(c("name", "=", "granchild"));
  conditions.and(c("parent->name", "=", "child"));
  conditions.and(c("parent->parent->name", "=", "parent"));
  assertTrue(conditions.evaluate());
}
origin: feroult/yawp

@Test
public void testWhereWithOrNot() {
  saveManyBasicObjects(3);
  List<BasicObject> objects = yawp(BasicObject.class).where(or(c("intValue", "=", 1), c("intValue", "=", 2)).not()).list();
  assertEquals(1, objects.size());
  assertEquals("xpto", objects.get(0).getStringValue());
  assertEquals(3, objects.get(0).getIntValue());
}
origin: feroult/yawp

@Test
public void testEvaluateIncomingNotEqualsExisting() {
  BasicObject object1 = saveObject("xpto");
  BasicObject object2 = saveObject("xpto");
  BasicObject object3 = saveObject("xyz");
  object1.setStringValue("xyz");
  object2.setStringValue("xyz");
  assertFalse(createConditions(Arrays.asList(object1, object3), c("stringValue", "=", "xpto")).evaluate());
  assertFalse(createConditions(Arrays.asList(object2), c("stringValue", "=", "xpto")).evaluate());
  assertTrue(createConditions(Arrays.asList(object3), c("stringValue", "=", "xyz")).evaluate());
}
origin: feroult/yawp

@Test
public void testWhereWithOr() {
  saveManyBasicObjects(2);
  List<BasicObject> objects = yawp(BasicObject.class).where(or(c("intValue", "=", 1), c("intValue", "=", 2))).list();
  assertEquals(2, objects.size());
  sort(objects);
  assertEquals(2, objects.size());
  assertEquals("xpto", objects.get(0).getStringValue());
  assertEquals(1, objects.get(0).getIntValue());
  assertEquals("xpto", objects.get(1).getStringValue());
  assertEquals(2, objects.get(1).getIntValue());
}
origin: feroult/yawp

@Test
public void testWhereWithAndNot() {
  saveManyBasicObjects(5);
  List<BasicObject> objects = yawp(BasicObject.class).where(and(c("intValue", ">", 1), c("intValue", "<", 5)).not()).list();
  assertEquals(2, objects.size());
  sort(objects);
  assertEquals(1, objects.get(0).getIntValue());
  assertEquals(5, objects.get(1).getIntValue());
}
origin: feroult/yawp

@Test
public void testSimpleWhereWithNot() {
  saveManyBasicObjects(2);
  List<BasicObject> objects = yawp(BasicObject.class).where(c("intValue", "=", 1).not()).list();
  assertEquals(1, objects.size());
  assertEquals("xpto", objects.get(0).getStringValue());
  assertEquals(2, objects.get(0).getIntValue());
}
origin: feroult/yawp

@PUT("single")
public void single(IdRef<ShieldedChild> id) {
  allow(isId100(id));
  allow(isJanis()).where(c("parent->name", "=", "ok-for-janis"));
}
origin: feroult/yawp

@Test
public void testWhereWithoutIndexComplexConditions() {
  yawp.save(new BasicObject("a", 1l));
  yawp.save(new BasicObject("a", 2l));
  yawp.save(new BasicObject("c", 3l));
  yawp.save(new BasicObject("c", 4l));
  yawp.save(new BasicObject("d", 5l));
  yawp.save(new BasicObject("e", 6l));
  BaseCondition c2 = c("stringValue", "=", "c").and(c("longValue", "=", 3l));
  List<BasicObject> objects = yawp(BasicObject.class).where(c("stringValue", "=", "a").or(c2)).list();
  assertObjects(objects, "a", "a", "c");
}
origin: feroult/yawp

@Test
public void testQueryRefWithPreFilter() {
  BasicObject ref1 = new BasicObject("right");
  BasicObject ref2 = new BasicObject("right");
  yawp.save(ref1);
  yawp.save(ref2);
  yawp.save(new BasicObject("a", ref1.getId()));
  yawp.save(new BasicObject("b", ref2.getId()));
  BasicObject object = yawp(BasicObject.class).where(c("objectId->stringValue", "=", "right").and(c("stringValue", "=", "a"))).only();
  assertEquals("a", object.getStringValue());
}
io.yawp.repository.query.conditionConditionc

Popular methods of Condition

  • and
  • or

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • getExternalFilesDir (Context)
  • setContentView (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now