Examples of ResourceTypeCriteria


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

        String plugin = PLUGIN_NAME;

        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(plugin);
        criteria.fetchBundleConfiguration(true);
        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        assertEquals("too many types returned!", 1, resourceTypes.size());
        ResourceType resourceType = resourceTypes.get(0);
View Full Code Here

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

        String propertyName, List<String> expected) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        String fetch = "fetch" + WordUtils.capitalize(propertyName);
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(plugin);
        criteria.setStrict(true);
        criteria.fetchBundleConfiguration(true);
        criteria.fetchDriftDefinitionTemplates(true);
        MethodUtils.invokeMethod(criteria, fetch, true);

        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        assertEquals("too many types!", 1, resourceTypes.size());
View Full Code Here

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

        loadDeletedTypes();
        loadInstalledPlugins();
    }

    private void loadDeletedTypes() {
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterDeleted(true); // we'll filter on all deleted types ...
        criteria.addFilterIgnored(null); // ... whether they are ignored or not

        //Use CriteriaQuery to automatically chunk/page through criteria query results
        CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
            @Override
            public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
View Full Code Here

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

        List<ResourceType> results = new ArrayList<ResourceType>(uniqueTypes);

        if (sawTopLevelServer) {
            // get all platform types, whether or not they are ignored
            ResourceTypeCriteria criteria = new ResourceTypeCriteria();
            criteria.addFilterIgnored(null);
            criteria.addFilterCategory(ResourceCategory.PLATFORM);
            criteria.clearPaging();//disable paging as the code assumes all the results will be returned.

            List<ResourceType> platforms = findResourceTypesByCriteria(subject, criteria);
            results.addAll(platforms);
        }
View Full Code Here

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

    public List<ResourceType> getAllResourceTypeDescendants(Subject subject, int resourceTypeId) {
        ResourceType first = entityManager.find(ResourceType.class, resourceTypeId);

        if (first.getCategory() == ResourceCategory.PLATFORM) {
            // get all platform types, whether or not they are ignored
            ResourceTypeCriteria criteria = new ResourceTypeCriteria();
            criteria.addFilterIgnored(null);
            criteria.clearPaging();//disable paging as the code assumes all the results will be returned.

            List<ResourceType> allResourceTypes = findResourceTypesByCriteria(subject, criteria);

            List<ResourceType> results = new ArrayList<ResourceType>();
            for (ResourceType nextType : allResourceTypes) {
View Full Code Here

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

        bvc.addFilterId(liveDeployment.getBundleVersion().getId());
        bvc.fetchBundle(true); // will eagerly fetch the bundle type
        PageList<BundleVersion> bvs = bundleManager.findBundleVersionsByCriteria(subject, bvc);
        liveDeployment.setBundleVersion(bvs.get(0)); // wire up the full bundle version back into the live deployment
        // the bundle type doesn't eagerly load the resource type - the remote plugin container needs that too
        ResourceTypeCriteria rtc = new ResourceTypeCriteria();
        rtc.addFilterIgnored(null); // we are purging, so we don't care if this returns ignored types or not, just purge anyway
        rtc.addFilterBundleTypeId(liveDeployment.getBundleVersion().getBundle().getBundleType().getId());
        PageList<ResourceType> rts = resourceTypeManager.findResourceTypesByCriteria(subject, rtc);
        liveDeployment.getBundleVersion().getBundle().getBundleType().setResourceType(rts.get(0));

        // we need to obtain the resources for all resource deployments - our first criteria can't fetch this deep, we have to do another query.
        List<Integer> resourceDeployIds = new ArrayList<Integer>();
View Full Code Here

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

        BundleCriteria bc = new BundleCriteria();
        bc.addFilterDestinationId(deployment.getDestination().getId());
        Bundle bundle = bundleManager.findBundlesByCriteria(subject, bc).get(0);

        ResourceTypeCriteria rtc = new ResourceTypeCriteria();
        rtc.addFilterIgnored(false); // we only care about those that are not ignored
        rtc.addFilterBundleTypeId(bundle.getBundleType().getId());
        ResourceType resourceType = resourceTypeManager.findResourceTypesByCriteria(subject, rtc).get(0);
        bundle.getBundleType().setResourceType(resourceType);

        deployment.getBundleVersion().setBundle(bundle);
        deployment.getDestination().setBundle(bundle);
View Full Code Here

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

        // a chance yet to send us its full inventory report.
        PlatformSyncInfo syncInfo = discoveryBoss.getPlatformSyncInfo(knownAgent);

        // we need to also tell the agent if there were any ignored types - we must provide the agent with
        // ALL types that are ignored, not just for those resources that were in the report
        ResourceTypeCriteria ignoredTypesCriteria = new ResourceTypeCriteria();
        ignoredTypesCriteria.addFilterIgnored(true);
        ignoredTypesCriteria.setPageControl(PageControl.getUnlimitedInstance());
        PageList<ResourceType> ignoredTypes = resourceTypeManager.findResourceTypesByCriteria(
            subjectManager.getOverlord(), ignoredTypesCriteria);

        MergeInventoryReportResults results;
        if (syncInfo != null) {
View Full Code Here

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

    @EJB
    private PlatformUtilizationManagerLocal platformUtilizationMgr;

    @Override
    public PageList<PlatformMetricsSummary> loadPlatformMetrics(final Subject subject) {
        final ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
        typeCriteria.addFilterIgnored(false); // don't load metrics for ignored types
        typeCriteria.addFilterCategory(PLATFORM);
        typeCriteria.fetchMetricDefinitions(true);

        //Use CriteriaQuery to automatically chunk/page through criteria query results
        CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
            @Override
            public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
View Full Code Here

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

        return true;
    }

    private int getResourceTypeCount(Plugin plugin) {
        // this will get all types, even those deleted and ignored
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterPluginName(plugin.getName());
        criteria.setRestriction(Criteria.Restriction.COUNT_ONLY);
        criteria.addFilterDeleted(null);
        criteria.addFilterIgnored(null);
        criteria.setStrict(true);

        PageList<ResourceType> types = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);

        return types.getTotalSize();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.