Package org.rhq.core.domain.resource.composite

Examples of org.rhq.core.domain.resource.composite.ResourceWithAvailability


        List<Object[]> objs = query.getResultList();
        List<ResourceWithAvailability> results = new ArrayList<ResourceWithAvailability>(objs.size());
        for (Object[] ob : objs) {
            Resource r = (Resource) ob[0];
            AvailabilityType at = (AvailabilityType) ob[1];
            ResourceWithAvailability rwa = new ResourceWithAvailability(r, at);
            results.add(rwa);
        }

        return results;
    }
View Full Code Here


        // resource and row. So we need to construct the ResourceWithAvailability objects ourselves.
        List<Object[]> objs = query.getResultList();
        for (Object[] ob : objs) {
            Resource r = (Resource) ob[0];
            AvailabilityType at = (AvailabilityType) ob[1];
            ResourceWithAvailability rwa = new ResourceWithAvailability(r, at);

            AutoGroupComposite comp = new AutoGroupComposite(oneComp);
            List res = new ArrayList(1); // hack to get around type safety
            res.add(rwa);
            comp.setResources(res);
View Full Code Here

            @SuppressWarnings("rawtypes")
            List results = new ArrayList<ResourceWithAvailability>(objs.size());
            for (Object[] ob : objs) {
                Resource r = (Resource) ob[0];
                AvailabilityType at = (AvailabilityType) ob[1];
                ResourceWithAvailability rwa = new ResourceWithAvailability(r, at);
                results.add(rwa);
            }
            composite.setResources(results);
        }
View Full Code Here

                // Loop over children, get resources, call some ..forMultiMetrics..
                List<Integer> resourceIds = new ArrayList<Integer>();
                for (AutoGroupComposite child : children) {
                    List resources = child.getResources();
                    ResourceWithAvailability rwa = (ResourceWithAvailability) resources.get(0);
                    resourceIds.add(rwa.getResource().getId());
                }

                // Map<ResourceId, List<Summaries for that resource>
                Map<Integer, List<MetricDisplaySummary>> summaries = dataManager
                    .findNarrowedMetricDisplaySummariesForResourcesAndParent(subject, resourceTypeId, parentId,
                        resourceIds, begin, end);
                for (AutoGroupComposite child : children) {
                    if (parentComposite != null)
                        child.increaseDepth(1);

                    List resources = child.getResources();
                    ResourceWithAvailability rwa = (ResourceWithAvailability) resources.get(0);
                    List<MetricDisplaySummary> sumList = summaries.get(rwa.getResource().getId());
                    displaySummary.add(new AutoGroupCompositeDisplaySummary(child, sumList));
                }

            } else {
                RequestUtils.setError(request, MessageConstants.ERR_RESOURCE_NOT_FOUND);
View Full Code Here

        // TODO GH: Why are we only getting the first one? --> single resource case
        //

        List resources = resourceGroupComposite.getResources();
        if ((resources != null) && (resources.size() == 1)) {
            ResourceWithAvailability resource = (ResourceWithAvailability) resources.get(0);

            metricSummaries = chartsManager.getMetricDisplaySummariesForMetrics(subject,
                resource.getResource().getId(), DataType.MEASUREMENT, beginTime, endTime, true, true);
        } else if ((resources != null) && (resources.size() > 1)) {
            List<Resource> res = new ArrayList<Resource>();
            for (Object o : resources) {
                if (o instanceof ResourceWithAvailability) {
                    ResourceWithAvailability rwa = (ResourceWithAvailability) o;
                    res.add(rwa.getResource());
                }
            }

            Map<Integer, List<MetricDisplaySummary>> sumMap = dataManager
                .findNarrowedMetricDisplaySummariesForCompatibleResources(subject, res, beginTime, endTime);
View Full Code Here

            Assert.assertEquals(rwas2.size(), (ids.size() * 2)); // multiple by 2 as each will have an initial UNKNOWN avail

            for (Object[] ob : rwas2) {
                Resource r = (Resource) ob[0];
                AvailabilityType at = (AvailabilityType) ob[1];
                ResourceWithAvailability rwa = new ResourceWithAvailability(r, at);
                rwas.add(rwa);
            }
            Assert.assertEquals(rwas.size(), (ids.size() * 2)); // multiple by 2 as each will have an initial UNKNOWN avail

        } finally {
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.composite.ResourceWithAvailability

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.