Search in sources :

Example 16 with AnyCond

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);
}
Also used : AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond)

Example 17 with AnyCond

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));
}
Also used : UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) Test(org.junit.jupiter.api.Test)

Example 18 with AnyCond

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));
}
Also used : AttributeCond(org.apache.syncope.core.persistence.api.dao.search.AttributeCond) UserFiqlSearchConditionBuilder(org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) Test(org.junit.jupiter.api.Test)

Example 19 with AnyCond

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());
}
Also used : User(org.apache.syncope.core.persistence.api.entity.user.User) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Example 20 with AnyCond

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());
}
Also used : User(org.apache.syncope.core.persistence.api.entity.user.User) AttributeCond(org.apache.syncope.core.persistence.api.dao.search.AttributeCond) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) AnyCond(org.apache.syncope.core.persistence.api.dao.search.AnyCond) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

AnyCond (org.apache.syncope.core.persistence.api.dao.search.AnyCond)25 SearchCond (org.apache.syncope.core.persistence.api.dao.search.SearchCond)20 Test (org.junit.jupiter.api.Test)16 AttributeCond (org.apache.syncope.core.persistence.api.dao.search.AttributeCond)11 AbstractTest (org.apache.syncope.core.persistence.jpa.AbstractTest)10 UserFiqlSearchConditionBuilder (org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder)6 User (org.apache.syncope.core.persistence.api.entity.user.User)6 OrderByClause (org.apache.syncope.core.persistence.api.dao.search.OrderByClause)3 Group (org.apache.syncope.core.persistence.api.entity.group.Group)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)2 RealmTO (org.apache.syncope.common.lib.to.RealmTO)2 Realm (org.apache.syncope.core.persistence.api.entity.Realm)2 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)2 Annotation (java.lang.annotation.Annotation)1 ManagementFactory (java.lang.management.ManagementFactory)1 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)1