Package org.apache.syncope.common.search

Examples of org.apache.syncope.common.search.NodeCond


    @Test
    public void searchCount() throws InvalidSearchConditionException {
        AttributeCond isNullCond = new AttributeCond(AttributeCond.Type.ISNULL);
        isNullCond.setSchema("loginDate");
        NodeCond searchCond = NodeCond.getLeafCond(isNullCond);

        Integer count = userService.searchCount(searchCond);
        assertNotNull(count);
        assertTrue(count > 0);
    }
View Full Code Here


    public void searchByBooleanAttributableCond() throws InvalidSearchConditionException {
        final AttributableCond cond = new AttributableCond(AttributableCond.Type.EQ);
        cond.setSchema("inheritAttributes");
        cond.setExpression("true");

        final NodeCond searchCondition = NodeCond.getLeafCond(cond);

        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
        assertNotNull(matchingRoles);
        assertFalse(matchingRoles.isEmpty());
    }
View Full Code Here

        userListCond.setExpression("USER_LIST");

        final EntitlementCond userReadcond = new EntitlementCond();
        userReadcond.setExpression("USER_READ");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(userListCond),
                NodeCond.getLeafCond(userReadcond));
        assertTrue(searchCondition.isValid());

        final List<RoleTO> matchingRoles = roleService.search(searchCondition);
        assertNotNull(matchingRoles);
        assertFalse(matchingRoles.isEmpty());
    }
View Full Code Here

        userOwnerCond.setExpression("5");

        final AttributableCond ppolicyCond = new AttributableCond(AttributableCond.Type.ISNOTNULL);
        ppolicyCond.setSchema("passwordPolicy");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(userOwnerCond),
                NodeCond.getLeafCond(ppolicyCond));

        assertTrue(searchCondition.isValid());

        final List<RoleTO> matchingRoles = roleService.search(searchCondition);

        assertNotNull(matchingRoles);
        assertEquals(1, matchingRoles.size());
View Full Code Here

            extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
        }

        // search for user/role by attribute(s) specified in the policy
        NodeCond searchCond = null;

        for (String schema : altSearchSchemas) {
            Attribute value = extValues.get(schema);

            AttributeCond.Type type;
            String expression = null;

            if (value == null || value.getValue() == null || value.getValue().isEmpty()
                    || (value.getValue().size() == 1 && value.getValue().get(0) == null)) {
                type = AttributeCond.Type.ISNULL;
            } else {
                type = AttributeCond.Type.EQ;
                expression = value.getValue().size() > 1
                        ? value.getValue().toString()
                        : value.getValue().get(0).toString();
            }

            NodeCond nodeCond;
            // users: just id or username can be selected to be used
            // roles: just id or name can be selected to be used
            if ("id".equalsIgnoreCase(schema) || "username".equalsIgnoreCase(schema)
                    || "name".equalsIgnoreCase(schema)) {
View Full Code Here

        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
        fullnameLeafCond2.setSchema("fullname");
        fullnameLeafCond2.setExpression("%i%");

        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1), NodeCond.getLeafCond(
                fullnameLeafCond2));

        assertTrue(searchCondition.isValid());

        List<UserTO> matchedUsers = userService.search(searchCondition);
       
        assertNotNull(matchedUsers);
        assertFalse(matchedUsers.isEmpty());
View Full Code Here

        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
        idRightCond.setSchema("id");
        idRightCond.setExpression("2");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(usernameLeafCond), NodeCond.
                getLeafCond(idRightCond));

        assertTrue(searchCondition.isValid());

        final List<UserTO> matchingUsers = userService.search(searchCondition);

        assertNotNull(matchingUsers);
        assertEquals(1, matchingUsers.size());
View Full Code Here

        final AttributableCond idRightCond = new AttributableCond(AttributableCond.Type.LT);
        idRightCond.setSchema("id");
        idRightCond.setExpression("2");

        final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(rolenameLeafCond),
                NodeCond.getLeafCond(idRightCond));

        assertTrue(searchCondition.isValid());

        final List<RoleTO> matchingRoles = roleService.search(searchCondition);

        assertNotNull(matchingRoles);
        assertEquals(1, matchingRoles.size());
View Full Code Here

        ws2.setResourceName("ws-target-resource2");

        ResourceCond ws1 = new ResourceCond();
        ws1.setResourceName(RESOURCE_NAME_MAPPINGS2);

        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2), NodeCond.getLeafCond(ws1));

        assertTrue(searchCondition.isValid());

        List<UserTO> matchedUsers = userService.search(searchCondition);
        assertNotNull(matchedUsers);
        assertFalse(matchedUsers.isEmpty());
View Full Code Here

        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
        fullnameLeafCond2.setSchema("fullname");
        fullnameLeafCond2.setExpression("%i%");

        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1), NodeCond.getLeafCond(
                fullnameLeafCond2));

        assertTrue(searchCondition.isValid());

        List<UserTO> matchedUsers = userService.search(searchCondition, 1, 2);
        assertNotNull(matchedUsers);

        assertFalse(matchedUsers.isEmpty());
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.search.NodeCond

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.