Package org.rhq.core.domain.criteria

Examples of org.rhq.core.domain.criteria.ResourceCriteria


            throw new IllegalStateException("The findResources() method requires a connection to the RHQ server.");
        }
       
        ResourceManagerRemote resourceManager = remoteClient.getProxy(ResourceManagerRemote.class);

        ResourceCriteria criteria = new ResourceCriteria();
        criteria.addFilterName(string);
        criteria.clearPaging();//disable paging as the code assumes all the results will be returned.

        return resourceManager.findResourcesByCriteria(getSubjectFromEngine(), criteria);
    }
View Full Code Here


        this.pluginConfigurationDefinition = configurationManager.getPluginConfigurationDefinitionForResourceType(
            remoteClient.getSubject(), resource.getResourceType().getId());
    }

    private void initChildren() {
        ResourceCriteria criteria = new ResourceCriteria();
        criteria.addFilterParentResourceId(resourceId);
        criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
        PageList<Resource> childResources = remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
            remoteClient.getSubject(), criteria);

        for (Resource child : childResources) {
            this.children.add(proxyFactory.getResource(child.getId()));
View Full Code Here

        return r.getName() + "[" + r.getResourceType().getName() + "] on " + r.getAgent().getName() + " [availability="
            + r.getCurrentAvailability().getAvailabilityType() + "]";
    }

    private String getAvailableReports(int resourceId) {
        ResourceCriteria rc = new ResourceCriteria();
        rc.addFilterId(resourceId);
        rc.fetchAgent(true);
        rc.fetchResourceType(true);
        rc.fetchChildResources(true);

        PageList<Resource> resources = LookupUtil.getResourceManager().findResourcesByCriteria(
            LookupUtil.getSubjectManager().getOverlord(), rc);

        StringBuilder options = new StringBuilder();
View Full Code Here

    @Test
    public void testNoCandidates() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceCriteria criteria = new ResourceCriteria();
                criteria.setCaseSensitive(false);
                criteria.addFilterName(GROUP_MEMBER_CANDIDATE_NAME_PREFIX);

                PageList<Resource> groupMemberCandidateResources = resourceManager.findGroupMemberCandidateResources(
                    overlord, criteria, new int[0]);

                assertEquals(0, groupMemberCandidateResources.getTotalSize());
View Full Code Here

    @Test
    public void testNoCandidatesWithExclusions() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceCriteria criteria = new ResourceCriteria();
                criteria.setCaseSensitive(false);
                criteria.addFilterName(GROUP_MEMBER_CANDIDATE_NAME_PREFIX);
                int[] alreadySelectedResourceIds = new int[100];
                for (int i = 0; i < alreadySelectedResourceIds.length; i++) {
                    alreadySelectedResourceIds[i] = i;
                }
View Full Code Here

    @Test
    public void testUnlimitedPageControl() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceCriteria criteria = new ResourceCriteria();
                criteria.setPageControl(PageControl.getUnlimitedInstance());

                try {
                    PageList<Resource> groupMemberCandidateResources = resourceManager
                        .findGroupMemberCandidateResources(overlord, criteria, new int[0]);
                    fail("findGroupMemberCandidateResources should throw UnsupportedOperationException");
View Full Code Here

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                int resourcesCount = 100;
                createTestResources(resourcesCount);
                ResourceCriteria criteria = new ResourceCriteria();
                criteria.setCaseSensitive(false);
                criteria.addFilterName(GROUP_MEMBER_CANDIDATE_NAME_PREFIX);
                criteria.addSortName(ASC);
                int pageNumber = 5;
                int pageSize = 7;
                criteria.setPaging(pageNumber, pageSize);

                PageList<Resource> groupMemberCandidateResources = resourceManager.findGroupMemberCandidateResources(
                    overlord, criteria, new int[0]);

                assertEquals(resourcesCount, groupMemberCandidateResources.getTotalSize());
View Full Code Here

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                int resourcesCount = 100;
                int[] resourcesIds = createTestResources(resourcesCount);
                ResourceCriteria criteria = new ResourceCriteria();
                criteria.setCaseSensitive(false);
                criteria.addFilterName(GROUP_MEMBER_CANDIDATE_NAME_PREFIX);
                criteria.addSortName(ASC);
                int pageNumber = 5;
                int pageSize = 7;
                criteria.setPaging(pageNumber, pageSize);
                int[] alreadySelectedResourceIds = Arrays.copyOfRange(resourcesIds, 13, 59);

                PageList<Resource> groupMemberCandidateResources = resourceManager.findGroupMemberCandidateResources(
                    overlord, criteria, alreadySelectedResourceIds);
View Full Code Here

        purgeOOBs();

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceCriteria c = new ResourceCriteria();
                c.addFilterInventoryStatus(null);
                c.addFilterResourceKey(RESOURCE_KEY);
                c.fetchSchedules(true);
                List<Resource> r = resourceManager.findResourcesByCriteria(overlord, c);

                // Note that the order of deletes is important due to FK
                // constraints.
                if (!r.isEmpty()) {
View Full Code Here

            }
        }

        @Override
        protected ResourceCriteria getFetchCriteria(DSRequest request) {
            ResourceCriteria criteria = super.getFetchCriteria(request);
            criteria.fetchDriftDefinitions(true);

            // filter out unsortable fields (i.e. fields sorted client-side only)
            PageControl pageControl = getPageControl(request);
            pageControl.removeOrderingField(ATTR_IN_COMPLIANCE);
            criteria.setPageControl(pageControl);

            return criteria;
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.criteria.ResourceCriteria

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.