int parent = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
int type = WebUtility.getOptionalIntRequestParameter(request, "type", -1);
int myGroupId = WebUtility.getOptionalIntRequestParameter(request, "groupId", -1);
MeasurementScheduleManagerLocal scheduleManager = LookupUtil.getMeasurementScheduleManager();
MeasurementChartsManagerLocal chartsManager = LookupUtil.getMeasurementChartsManager();
if (log.isTraceEnabled()) {
log.trace("finding metric summaries for resource [" + Arrays.toString(resourceIds) + "] for range " + begin
+ ":" + end + " filters value: " + filters + " and keyword: " + keyword);
}
List<MetricDisplaySummary> metricSummaries = null;
// GH: Why are we only getting the first one? --> single resource case
if (myGroupId > 0) {
ResourceGroupManagerLocal resGrpMgr = LookupUtil.getResourceGroupManager();
int[] definitionIds = resGrpMgr.findDefinitionsForCompatibleGroup(subject, myGroupId, false);
metricSummaries = chartsManager.getMetricDisplaySummariesForCompatibleGroup(subject,
EntityContext.forGroup(myGroupId),
definitionIds, begin, end, false);
} else if ((parent > 0) && (type > 0)) {
ResourceGroupManagerLocal resGrpMgr = LookupUtil.getResourceGroupManager();
int[] definitionIds = resGrpMgr.findDefinitionsForAutoGroup(subject, parent, type, false);
metricSummaries = chartsManager.getMetricDisplaySummariesForAutoGroup(subject, parent, type, definitionIds,
begin, end, false);
} else if ((resourceIds != null) && (resourceIds.length > 0)) {
int resourceId = resourceIds[0];
List<MeasurementSchedule> scheds = scheduleManager.findSchedulesForResourceAndType(subject,
resourceId, null, null, false); //null -> don't filter, we want everything, false -> not only enabled
int metricOrTraitCount = 0;
for (MeasurementSchedule sched : scheds) {
if ((sched.getDefinition().getDataType() == DataType.MEASUREMENT)