Search in sources :

Example 1 with UserCriteria

use of org.jaffa.rules.testmodels.UserCriteria in project jaffa-framework by jaffa-projects.

the class GraphCriteriaFlexFieldsTest method testHasFlexFields.

public void testHasFlexFields() throws FrameworkException, ApplicationExceptions {
    UserCriteria userCriteria = new UserCriteria();
    StaticContext.initialize(userCriteria);
    assertNotNull(userCriteria.getFlexCriteriaBean());
}
Also used : UserCriteria(org.jaffa.rules.testmodels.UserCriteria)

Example 2 with UserCriteria

use of org.jaffa.rules.testmodels.UserCriteria in project jaffa-framework by jaffa-projects.

the class GraphCriteriaFlexFieldsTest method testCriteriaClauseDomainMapped.

public void testCriteriaClauseDomainMapped() throws FrameworkException, ApplicationExceptions {
    UserCriteria userCriteria = new UserCriteria();
    StaticContext.initialize(userCriteria);
    assertNotNull(userCriteria.getFlexCriteriaBean());
    Criteria c = userCriteria.buildQueryCriteria();
    assertNull(c.getCriteriaEntries());
    userCriteria.getFlexCriteriaBean().set("remarks", new StringCriteriaField("Equals", "nice guy"));
    c = userCriteria.buildQueryCriteria();
    assertNotNull(c.getCriteriaEntries());
    assertEquals(1, c.getCriteriaEntries().size());
    List<Criteria.CriteriaEntry> criteriaEntries = new ArrayList<>(c.getCriteriaEntries());
    assertEquals("nice guy", criteriaEntries.get(0).getValue());
    assertEquals("UserRef15", criteriaEntries.get(0).getName());
}
Also used : UserCriteria(org.jaffa.rules.testmodels.UserCriteria) ArrayList(java.util.ArrayList) Criteria(org.jaffa.persistence.Criteria) UserCriteria(org.jaffa.rules.testmodels.UserCriteria) StringCriteriaField(org.jaffa.components.finder.StringCriteriaField)

Aggregations

UserCriteria (org.jaffa.rules.testmodels.UserCriteria)2 ArrayList (java.util.ArrayList)1 StringCriteriaField (org.jaffa.components.finder.StringCriteriaField)1 Criteria (org.jaffa.persistence.Criteria)1