use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class AbstractAnyDAO method getAllMatchingCond.
@Override
public SearchCond getAllMatchingCond() {
AnyCond idCond = new AnyCond(AttributeCond.Type.ISNOTNULL);
idCond.setSchema("id");
return SearchCond.getLeafCond(idCond);
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondConverterTest method nieq.
@Test
public void nieq() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").notEqualTolIgnoreCase("rossini").query();
assertEquals("username!~rossini", fiql);
AnyCond attrCond = new AnyCond(AttributeCond.Type.IEQ);
attrCond.setSchema("username");
attrCond.setExpression("rossini");
SearchCond simpleCond = SearchCond.getNotLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class SearchCondConverterTest method nilike.
@Test
public void nilike() {
String fiql = new UserFiqlSearchConditionBuilder().is("username").notEqualTolIgnoreCase("ros*").query();
assertEquals("username!~ros*", fiql);
AttributeCond attrCond = new AnyCond(AttributeCond.Type.ILIKE);
attrCond.setSchema("username");
attrCond.setExpression("ros%");
SearchCond simpleCond = SearchCond.getNotLeafCond(attrCond);
assertEquals(simpleCond, SearchCondConverter.convert(fiql));
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class AnySearchTest method issueSYNCOPE46.
@Test
public void issueSYNCOPE46() {
AnyCond cond = new AnyCond(AttributeCond.Type.LIKE);
cond.setSchema("username");
cond.setExpression("%ossin%");
SearchCond searchCondition = SearchCond.getLeafCond(cond);
assertTrue(searchCondition.isValid());
List<User> users = searchDAO.search(searchCondition, AnyTypeKind.USER);
assertNotNull(users);
assertEquals(1, users.size());
}
use of org.apache.syncope.core.persistence.api.dao.search.AnyCond in project syncope by apache.
the class AnySearchTest method searchByUsernameAndFullname.
@Test
public void searchByUsernameAndFullname() {
AnyCond usernameLeafCond = new AnyCond(AnyCond.Type.EQ);
usernameLeafCond.setSchema("username");
usernameLeafCond.setExpression("rossini");
AttributeCond idRightCond = new AttributeCond(AttributeCond.Type.LIKE);
idRightCond.setSchema("fullname");
idRightCond.setExpression("Giuseppe V%");
SearchCond searchCondition = SearchCond.getOrCond(SearchCond.getLeafCond(usernameLeafCond), SearchCond.getLeafCond(idRightCond));
List<User> matchingUsers = searchDAO.search(searchCondition, AnyTypeKind.USER);
assertNotNull(matchingUsers);
assertEquals(2, matchingUsers.size());
}
Aggregations