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

    public void create() {
        NotificationTO notificationTO = buildNotificationTO();

        MembershipCond membCond = new MembershipCond();
        membCond.setRoleId(7L);
        NodeCond recipients = NodeCond.getLeafCond(membCond);
        notificationTO.setRecipients(recipients);

        Response response = notificationService.create(notificationTO);
        NotificationTO actual = getObject(response, NotificationTO.class, notificationService);
View Full Code Here

        }
        assertNotNull(exception);

        MembershipCond membCond = new MembershipCond();
        membCond.setRoleId(7L);
        NodeCond recipients = NodeCond.getLeafCond(membCond);

        notificationTO.setRecipients(recipients);

        notificationService.update(notificationTO.getId(), notificationTO);
        NotificationTO actual = notificationService.read(notificationTO.getId());
View Full Code Here

        fullnameLeafCond1.setSchema("fullname");
        fullnameLeafCond1.setExpression("%o%");
        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
        fullnameLeafCond2.setSchema("fullname");
        fullnameLeafCond2.setExpression("%i%");
        NodeCond about = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1),
                NodeCond.getLeafCond(fullnameLeafCond2));

        notificationTO.setAbout(about);

        notificationTO.setRecipientAttrName("email");
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

        if (searchConditionWrapper == null || searchConditionWrapper.getFilterType() == null) {
            return null;
        }
        LOG.debug("Search condition wrapper: {}", searchConditionWrapper);

        NodeCond nodeCond = null;

        switch (searchConditionWrapper.getFilterType()) {
            case ATTRIBUTE:
                // AttributeCond or SyncopeUserCond
                final String schema = searchConditionWrapper.getFilterName();
View Full Code Here

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                final NodeCond searchCond = searchPanel.buildSearchCond();
                LOG.debug("Node condition {}", searchCond);

                doSearch(target, searchCond, searchResult);

                Session.get().getFeedbackMessages().clear();
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.