modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java | 148 ---------- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java | 142 --------- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerLocal.java | 22 + modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java | 12 4 files changed, 33 insertions(+), 291 deletions(-)
New commits: commit 705254b82108c65f0b0ce61912617d1a2e1bc35c Author: Jirka Kremser jkremser@redhat.com Date: Wed Sep 12 17:21:26 2012 +0200
refactoring: removed unused classes (CallTimeDataSource and CallTimeView) and marking some methods used only by portal-war as deprecated
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java deleted file mode 100644 index 550215e..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime; - -import java.util.List; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.data.DSRequest; -import com.smartgwt.client.data.DSResponse; -import com.smartgwt.client.data.DataSourceField; -import com.smartgwt.client.data.Record; -import com.smartgwt.client.data.fields.DataSourceIntegerField; -import com.smartgwt.client.data.fields.DataSourceTextField; -import com.smartgwt.client.widgets.HTMLFlow; -import com.smartgwt.client.widgets.grid.ListGridRecord; - -import org.rhq.core.domain.criteria.Criteria; -import org.rhq.core.domain.measurement.calltime.CallTimeDataComposite; -import org.rhq.core.domain.util.PageControl; -import org.rhq.core.domain.util.PageList; -import org.rhq.enterprise.gui.coregui.client.CoreGUI; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; -import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; - -/** - * @author Greg Hinkle - */ -public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite, Criteria> { - - private double maxMaximum; - - public CallTimeDataSource() { - List<DataSourceField> fields = addDataSourceFields(); - addFields(fields); - } - - @Override - protected List<DataSourceField> addDataSourceFields() { - List<DataSourceField> fields = super.addDataSourceFields(); - - DataSourceTextField callDestination = new DataSourceTextField("callDestination", MSG - .view_resource_monitor_calltime_destination()); - fields.add(callDestination); - DataSourceIntegerField count = new DataSourceIntegerField("count", MSG.view_resource_monitor_calltime_count()); - fields.add(count); - DataSourceIntegerField minimum = new DataSourceIntegerField("minimum", MSG - .view_resource_monitor_calltime_minimum()); - fields.add(minimum); - DataSourceIntegerField average = new DataSourceIntegerField("average", MSG - .view_resource_monitor_calltime_average()); - fields.add(average); - DataSourceIntegerField maximum = new DataSourceIntegerField("maximum", MSG - .view_resource_monitor_calltime_maximum()); - fields.add(maximum); - DataSourceIntegerField total = new DataSourceIntegerField("total", MSG.common_title_total()); - fields.add(total); - - return fields; - } - - @Override - protected void executeFetch(final DSRequest request, final DSResponse response, final Criteria unused) { - int scheduleId = Integer.parseInt((String) request.getCriteria().getValues().get("scheduleId")); - long now = System.currentTimeMillis(); - long eightHoursAgo = now - (1000L * 60 * 60 * 8); - - PageControl pc = getPageControl(request); - - GWTServiceLookup.getMeasurementDataService().findCallTimeDataForResource(scheduleId, eightHoursAgo, now, pc, - new AsyncCallback<PageList<CallTimeDataComposite>>() { - public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_calltime_loadFailed(), caught); - } - - public void onSuccess(PageList<CallTimeDataComposite> result) { - Record[] data = buildRecords(result); - setGraphs(data); - response.setData(data); - - processResponse(request.getRequestId(), response); - } - }); - } - - @Override - protected Criteria getFetchCriteria(DSRequest request) { - // we don't use criterias for this datasource, just return null - return null; - } - - @Override - public CallTimeDataComposite copyValues(Record from) { - throw new UnsupportedOperationException(MSG.view_resource_monitor_calltime_editFailed()); - } - - public void setGraphs(Record[] records) { - for (Record record : records) { - if (record.getAttributeAsInt("maximum") > maxMaximum) - maxMaximum = record.getAttributeAsInt("maximum"); - } - - for (Record record : records) { - - int minWidth = (int) ((record.getAttributeAsInt("minimum") / maxMaximum) * 100d); - int avgWidth = (int) ((record.getAttributeAsInt("average") / maxMaximum) * 100d); - int maxWidth = (int) ((record.getAttributeAsInt("maximum") / maxMaximum) * 100d); - - if (record instanceof ListGridRecord) { - ListGridRecord listGridRecord = (ListGridRecord) record; - listGridRecord.setBackgroundComponent(new HTMLFlow("<div style="width: " + minWidth - + "%; height: 33%; background-color: #A5B391;"> </div>" + "<div style="width: " + avgWidth - + "%; height: 33%; background-color: #A5B391;"> </div>" + "<div style="width: " + maxWidth - + "%; height: 33%; background-color: #A5B391;"> </div>")); - } - } - } - - @Override - public ListGridRecord copyValues(CallTimeDataComposite from) { - ListGridRecord record = new ListGridRecord(); - - record.setAttribute("callDestination", from.getCallDestination()); - - record.setAttribute("count", from.getCount()); - record.setAttribute("minimum", from.getMinimum()); - record.setAttribute("average", from.getAverage()); - record.setAttribute("maximum", from.getMaximum()); - record.setAttribute("total", from.getTotal()); - - return record; - } -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java deleted file mode 100644 index 894a1b3..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime; - -import java.util.EnumSet; - -import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.data.Criteria; -import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.grid.CellFormatter; -import com.smartgwt.client.widgets.grid.ListGridField; -import com.smartgwt.client.widgets.grid.ListGridRecord; - -import org.rhq.core.domain.criteria.ResourceCriteria; -import org.rhq.core.domain.measurement.DataType; -import org.rhq.core.domain.measurement.MeasurementDefinition; -import org.rhq.core.domain.measurement.MeasurementSchedule; -import org.rhq.core.domain.resource.Resource; -import org.rhq.core.domain.resource.ResourceType; -import org.rhq.core.domain.util.PageList; -import org.rhq.enterprise.gui.coregui.client.CoreGUI; -import org.rhq.enterprise.gui.coregui.client.components.table.Table; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; -import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; -import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLayout; - -/** - * @author Greg Hinkle - */ -public class CallTimeView extends LocatableLayout { - - private Resource resource; - private int scheduleId; - - public CallTimeView(String locatorId, Resource resource) { - super(locatorId); - this.resource = resource; - } - - @Override - protected void onDraw() { - super.onDraw(); - - ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(), - EnumSet.of(ResourceTypeRepository.MetadataType.measurements), - new ResourceTypeRepository.TypeLoadedCallback() { - public void onTypesLoaded(ResourceType type) { - - for (final MeasurementDefinition def : type.getMetricDefinitions()) { - if (def.getDataType() == DataType.CALLTIME) { - - ResourceCriteria criteria = new ResourceCriteria(); - criteria.addFilterId(resource.getId()); - criteria.fetchSchedules(true); - - GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, - new AsyncCallback<PageList<Resource>>() { - public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError( - MSG.view_resource_monitor_calltime_lookupFailed(), caught); - } - - public void onSuccess(PageList<Resource> result) { - if (result.size() == 1) { - - Resource res = result.get(0); - for (MeasurementSchedule s : res.getSchedules()) { - - if (s.getDefinition().getId() == def.getId()) { - - scheduleId = s.getId(); - - setup(); - return; - } - } - } - setupNone(); - } - }); - break; - - } - - } - - } - }); - - } - - public void setupNone() { - addMember(new Label("No calltime data available for this resource")); - } - - public void setup() { - - Table table = new Table(extendLocatorId("Table"), MSG.view_resource_monitor_calltime_title(), new Criteria( - "scheduleId", String.valueOf(scheduleId))); - table.getListGrid().setAlternateRecordStyles(false); - table.setDataSource(new CallTimeDataSource()); - table.getListGrid().setUseAllDataSourceFields(true); - - final NumberFormat format = NumberFormat.getFormat("0"); - - ListGridField callDestination = new ListGridField("callDestination", MSG - .view_resource_monitor_calltime_destination()); - ListGridField count = new ListGridField("count", MSG.view_resource_monitor_calltime_count(), 70); - ListGridField minimum = new ListGridField("minimum", MSG.view_resource_monitor_calltime_minimum(), 70); - ListGridField average = new ListGridField("average", MSG.view_resource_monitor_calltime_average(), 70); - average.setCellFormatter(new CellFormatter() { - public String format(Object o, ListGridRecord listGridRecord, int i, int i1) { - return format.format(((Number) o).doubleValue()); - } - }); - ListGridField maximum = new ListGridField("maximum", MSG.view_resource_monitor_calltime_maximum(), 70); - ListGridField total = new ListGridField("total", MSG.common_title_total(), 70); - - table.getListGrid().setFields(callDestination, count, minimum, average, maximum, total); - - addMember(table); - markForRedraw(); - } - -} diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerLocal.java index 53d2523..73195ec 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerLocal.java @@ -34,7 +34,9 @@ import org.rhq.core.domain.measurement.ui.MetricDisplaySummary; @Local public interface MeasurementChartsManagerLocal {
- @Deprecated + /** + * @deprecated portal-war + */ // TODO: jmarques - this will go away once ListChildrenAction is moved to JSF List<MetricDisplaySummary> getMetricDisplaySummariesForMetrics(Subject subject, int resourceId, DataType dataType, long begin, long end, boolean narrowed, boolean enabledOnly) throws MeasurementException; @@ -52,10 +54,15 @@ public interface MeasurementChartsManagerLocal { * @return * * @throws MeasurementException + * + * @deprecated portal-war */ List<MetricDisplaySummary> getMetricDisplaySummariesForCompatibleGroup(Subject subject, int groupId, int[] measurementDefinitionIds, long begin, long end, boolean enabledOnly) throws MeasurementException;
+ /** + * @deprecated portal-war + */ List<MetricDisplaySummary> getMetricDisplaySummariesForCompatibleGroup(Subject subject, int groupId, String viewName);
/** @@ -72,17 +79,28 @@ public interface MeasurementChartsManagerLocal { * @return * * @throws MeasurementException + * + * @deprecated portal-war */ List<MetricDisplaySummary> getMetricDisplaySummariesForAutoGroup(Subject subject, int autoGroupParentResourceId, int autoGroupChildResourceTypeId, int[] measurementDefinitionIds, long begin, long end, boolean enabledOnly) throws MeasurementException;
+ /** + * @deprecated portal-war + */ List<MetricDisplaySummary> getMetricDisplaySummariesForAutoGroup(Subject subject, int parent, int type, String viewName);
+ /** + * @deprecated portal-war + */ List<MetricDisplaySummary> getMetricDisplaySummariesForResource(Subject subject, int resourceId, int[] measurementScheduleIds, long begin, long end) throws MeasurementException;
+ /** + * @deprecated portal-war + */ List<MetricDisplaySummary> getMetricDisplaySummariesForResource(Subject subject, int resourceId, String viewName) throws MeasurementException;
@@ -99,6 +117,8 @@ public interface MeasurementChartsManagerLocal { * resources values in a List for the value. * * @throws MeasurementException throws Measurement exception + * + * @deprecated portal-war */ Map<MeasurementDefinition, List<MetricDisplaySummary>> getMetricDisplaySummariesForMetricsCompare(Subject subject, int[] resourceIds, int[] measurementDefinitionIds, long begin, long end) throws MeasurementException; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java index 1878a8f..49bc2fe 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java @@ -83,6 +83,8 @@ public interface MeasurementDataManagerLocal { * @param group compatible group * * @return a Map of resource id, List of summaries for this resource + * + * @deprecated portal-war */ Map<Integer, List<MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForCompGroup(Subject subject, ResourceGroup group, long beginTime, long endTime); @@ -91,10 +93,15 @@ public interface MeasurementDataManagerLocal { * Get the {@link MetricDisplaySummary}s for the resources passed in, that all need to be of the same * {@link ResourceType}. Summaries only contain a basic selection of fields for the purpose of filling the Child * resource popups. + * + * @deprecated portal-war */ public Map<Integer, List<MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForCompatibleResources( Subject subject, Collection<Resource> resources, long beginTime, long endTime);
+ /** + * @deprecated portal-war (it is not used at all) + */ public Map<Integer, List<MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForAutoGroup(Subject subject, int parentId, int cType, long beginTime, long endTime);
@@ -108,6 +115,8 @@ public interface MeasurementDataManagerLocal { * @param resourceIds List of primary keys of the resources we are interested in * @param begin begin time * @param end end time + * + * @deprecated portal-war */ public Map<Integer, List<MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForResourcesAndParent( Subject subject, int resourceTypeId, int parentId, List<Integer> resourceIds, long begin, long end); @@ -203,5 +212,8 @@ public interface MeasurementDataManagerLocal { List<List<MeasurementDataNumericHighLowComposite>> findDataForResource(Subject subject, int resourceId, int[] definitionIds, long beginTime, long endTime, int numPoints);
+ /** + * @deprecated portal-war (it is not used at all) + */ List<MeasurementDataNumeric> findRawData(Subject subject, int scheduleId, long startTime, long endTime); } \ No newline at end of file
rhq-commits@lists.fedorahosted.org