Package org.rhq.enterprise.gui.uibeans

Examples of org.rhq.enterprise.gui.uibeans.AutoGroupCompositeDisplaySummary


                if (parentComposite != null) {
                    parentComposite.setMainResource(true);
                    List<MetricDisplaySummary> metricSummaries = null;
                    metricSummaries = chartsManager.getMetricDisplaySummariesForMetrics(subject, parentId,
                        DataType.MEASUREMENT, begin, end, true, true);
                    displaySummary.add(0, new AutoGroupCompositeDisplaySummary(parentComposite, metricSummaries));
                }
                /* We have n children with each child representing exactly 1 resource.
                 * As we are in an autogroup, all children have the same type, so we can just feed them to the backend
                 * in one call with all n resources.
                 */

                // 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);
                return null;
            }
        } else { // resource != null
            // get children of that single resource, which can be individual resources or autogroups
            children = getResourceChildren(resource, subject);

            displaySummary = new ArrayList<AutoGroupCompositeDisplaySummary>(children.size());
            for (AutoGroupComposite child : children) {
                List<MetricDisplaySummary> metrics = getMetrics(resource, child, subject, begin, end);

                displaySummary.add(new AutoGroupCompositeDisplaySummary(child, metrics));
            }
        }

        context.putAttribute(AttrConstants.CTX_SUMMARIES, displaySummary);

View Full Code Here

TOP

Related Classes of org.rhq.enterprise.gui.uibeans.AutoGroupCompositeDisplaySummary

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.