modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 30
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceInstallCount.java | 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java | 61 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java | 301 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReportResourceSearchView.java | 191 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 40 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java | 25
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReportResourceSearchView.java | 134 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 29
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 8
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 11
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 25
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 2
18 files changed, 643 insertions(+), 259 deletions(-)
New commits:
commit bd7cb6b45b1b7f3f4adbbb7e781cba9c60268f4c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 23 12:12:09 2011 -0500
Create new Drift Compliance Report
Similar to the Inventory Summary report with two differences:
1. Constrained to types that provide drift monitoring
2. Adds compliance columns
- Restored Inventory Summary Report to its former self, removing the
compliance stuff that had been added. This makes it more focused and
faster.
- Added separate SLSB support for the new report.
- Fixed a problem in the compliance queries that generated the wrong
resource count.
- Fixed sorting issue for compliance column in report's resource view
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index c2dbe74..dd5da1b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -740,31 +740,31 @@ import org.rhq.core.domain.util.Summary;
+ "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id " //
+ "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name "),
- // @NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_REPORT, query = "" //
- // + "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount( " //
- // + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(r), r.version) " //
- // + "FROM Resource r " //
- // + "WHERE r.inventoryStatus = 'COMMITTED' " //
- // + "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version " //
- // + "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version "),
+ @NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_REPORT, query = "" //
+ + "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount( " //
+ + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(r), r.version) " //
+ + "FROM Resource r " //
+ + "WHERE r.inventoryStatus = 'COMMITTED' " //
+ + "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version " //
+ + "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version "),
@NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_IN_COMPLIANCE, query = ""
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount("
- + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(r), "
+ + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(distinct r), "
+ "r.version, size(templates), 0) "
- + "FROM Resource r JOIN r.resourceType type LEFT JOIN type.driftDefinitionTemplates templates "
- + "WHERE r.inventoryStatus = 'COMMITTED' AND 0 = (" + " SELECT COUNT(defs) "
- + " FROM r.driftDefinitions defs " + " WHERE NOT defs.complianceStatus = 0) "
+ + "FROM Resource r JOIN r.resourceType type JOIN type.driftDefinitionTemplates templates "
+ + "WHERE r.inventoryStatus = 'COMMITTED' AND " //
+ + " 0 = ( SELECT COUNT(defs) FROM r.driftDefinitions defs WHERE NOT defs.complianceStatus = 0) "
+ "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version "
+ "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version "),
@NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_OUT_OF_COMPLIANCE, query = ""
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount("
- + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(r), "
+ + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(distinct r), "
+ "r.version, size(templates), 1) "
- + "FROM Resource r JOIN r.resourceType type LEFT JOIN type.driftDefinitionTemplates templates "
- + "WHERE r.inventoryStatus = 'COMMITTED' AND 0 < (" + " SELECT COUNT(defs) "
- + " FROM r.driftDefinitions defs " + " WHERE defs.complianceStatus <> 0) "
+ + "FROM Resource r JOIN r.resourceType type JOIN type.driftDefinitionTemplates templates "
+ + "WHERE r.inventoryStatus = 'COMMITTED' AND " //
+ + " 0 < ( SELECT COUNT(defs) FROM r.driftDefinitions defs WHERE defs.complianceStatus <> 0) "
+ "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version "
+ "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version ") })
@SequenceGenerator(name = "RHQ_RESOURCE_SEQ", sequenceName = "RHQ_RESOURCE_ID_SEQ")
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceInstallCount.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceInstallCount.java
index 030dcc6..877686f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceInstallCount.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceInstallCount.java
@@ -41,6 +41,15 @@ public class ResourceInstallCount implements Serializable {
public ResourceInstallCount() {
}
+ public ResourceInstallCount(String typeName, String typePlugin, ResourceCategory category, int typeId, long count) {
+ this(typeName, typePlugin, category, typeId, count, null, -1, -1);
+ }
+
+ public ResourceInstallCount(String typeName, String typePlugin, ResourceCategory category, int typeId, long count,
+ String version) {
+ this(typeName, typePlugin, category, typeId, count, version, -1, -1);
+ }
+
public ResourceInstallCount(String typeName, String typePlugin, ResourceCategory category, int typeId, long count,
String version, int numDriftTemplates, int inCompliance) {
this.count = count;
@@ -53,16 +62,6 @@ public class ResourceInstallCount implements Serializable {
this.inCompliance = inCompliance == 0;
}
-
- public ResourceInstallCount(String typeName, String typePlugin, ResourceCategory category, int typeId, long count) {
- this.count = count;
- this.typeName = typeName;
- this.typePlugin = typePlugin;
- this.category = category;
- this.typeId = typeId;
- }
-
-
public long getCount() {
return count;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index f44cf8e..5842483 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -71,6 +71,10 @@ public interface ResourceGWTService extends RemoteService {
PageList<ProblemResourceComposite> findProblemResources(long ctime, int maxItems) throws RuntimeException;
+ List<ResourceInstallCount> findResourceComplianceCounts() throws RuntimeException;
+
+ List<ResourceInstallCount> findResourceInstallCounts(boolean groupByVersions) throws RuntimeException;
+
Resource getPlatformForResource(int resourceId) throws RuntimeException;
Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc)
@@ -94,5 +98,4 @@ public interface ResourceGWTService extends RemoteService {
List<Integer> uninventoryResources(int[] resourceIds) throws RuntimeException;
- List<ResourceInstallCount> findResourceInstallCounts(boolean groupByVersions) throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
new file mode 100644
index 0000000..51e9282
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReport.java
@@ -0,0 +1,301 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.report;
+
+import java.util.HashMap;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.composite.ResourceInstallCount;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A tweaked version of the InventorySummary report that narrows the relevant types to those that support Drift
+ * monitoring, and shows the compliance state of each type.
+ *
+ * @author Jay Shaughnessy
+ */
+public class DriftComplianceReport extends LocatableVLayout implements BookmarkableView {
+
+ public static final ViewName VIEW_ID = new ViewName("DriftCompliance", MSG.view_reports_driftCompliance());
+
+ private ResourceSearchView resourceList;
+
+ public DriftComplianceReport(String locatorId) {
+ super(locatorId);
+
+ setHeight100();
+ setWidth100();
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (!viewPath.isEnd()) {
+ int resourceTypeId = Integer.parseInt(viewPath.getCurrent().getPath());
+ viewPath.next();
+ Criteria criteria;
+ if (!viewPath.isEnd()) {
+ String resourceVersion = viewPath.getCurrent().getPath();
+ criteria = createResourceSearchViewCriteria(resourceTypeId, resourceVersion);
+ } else {
+ criteria = createResourceSearchViewCriteria(resourceTypeId);
+ }
+ showResourceList(criteria);
+ } else {
+ hideResourceList();
+ }
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ addMember(new DriftComplianceReportTable(extendLocatorId("table")));
+ }
+
+ protected Criteria createResourceSearchViewCriteria(int resourceTypeId) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(ResourceDataSourceField.TYPE.propertyName(), resourceTypeId);
+ return criteria;
+ }
+
+ protected Criteria createResourceSearchViewCriteria(int resourceTypeId, String resourceVersion) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(ResourceDataSourceField.TYPE.propertyName(), resourceTypeId);
+ criteria.addCriteria("version", resourceVersion);
+ return criteria;
+ }
+
+ private void showResourceList(Criteria criteria) {
+ hideResourceList();
+ resourceList = new DriftComplianceReportResourceSearchView(extendLocatorId("resourceList"), criteria);
+ addMember(resourceList);
+ markForRedraw();
+ }
+
+ private void hideResourceList() {
+ if (resourceList != null) {
+ removeMember(resourceList);
+ resourceList.destroy();
+ resourceList = null;
+ }
+ markForRedraw();
+ }
+
+ class DriftComplianceReportTable extends Table<DriftComplianceReportTable.DataSource> {
+
+ public DriftComplianceReportTable(String locatorId) {
+ super(locatorId, VIEW_ID.getTitle());
+ setDataSource(new DataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+ ListGridField fieldTypeName = new ListGridField(DataSource.Field.TYPENAME, MSG.common_title_resource_type());
+ ListGridField fieldPlugin = new ListGridField(DataSource.Field.TYPEPLUGIN, MSG.common_title_plugin());
+ ListGridField fieldCategory = new ListGridField(DataSource.Field.CATEGORY, MSG.common_title_category());
+ ListGridField fieldVersion = new ListGridField(DataSource.Field.VERSION, MSG.common_title_version());
+ ListGridField fieldCount = new ListGridField(DataSource.Field.COUNT, MSG.common_title_count());
+
+ ListGridField fieldInCompliance = new ListGridField(DataSource.Field.IN_COMPLIANCE, MSG
+ .common_title_in_compliance());
+ HashMap<String, String> complianceIcons = new HashMap<String, String>();
+ complianceIcons.put("true", ImageManager.getAvailabilityIcon(true));
+ complianceIcons.put("false", ImageManager.getAvailabilityIcon(false));
+ fieldInCompliance.setValueIcons(complianceIcons);
+ fieldInCompliance.setType(ListGridFieldType.ICON);
+ fieldInCompliance.setCanSortClientOnly(true);
+
+ fieldTypeName.setWidth("35%");
+ fieldPlugin.setWidth("10%");
+ fieldCategory.setWidth(70);
+ fieldVersion.setWidth("*");
+ fieldCount.setWidth(60);
+ fieldInCompliance.setWidth(100);
+
+ // TODO (ips, 11/11/11): The groupBy functionality is very buggy in SmartGWT 2.4. Once they fix it
+ // uncomment these lines to allow grouping by the plugin or category fields.
+ /*getListGrid().setCanGroupBy(true);
+ fieldTypeName.setCanGroupBy(false);
+ fieldVersion.setCanGroupBy(false);
+ fieldCount.setCanGroupBy(false);
+ fieldInCompliance.setCanGroupBy(false);*/
+
+ fieldTypeName.setCellFormatter(new CellFormatter() {
+ @Override
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String url = getResourceTypeTableUrl(record);
+ if (url == null) {
+ return value.toString();
+ }
+
+ return "<a href=\"" + url + "\">" + value.toString() + "</a>";
+ }
+ });
+
+ fieldCategory.setType(ListGridFieldType.ICON);
+ fieldCategory.setShowValueIconOnly(true);
+ HashMap<String, String> categoryIcons = new HashMap<String, String>(3);
+ categoryIcons
+ .put(ResourceCategory.PLATFORM.name(), ImageManager.getResourceIcon(ResourceCategory.PLATFORM));
+ categoryIcons.put(ResourceCategory.SERVER.name(), ImageManager.getResourceIcon(ResourceCategory.SERVER));
+ categoryIcons.put(ResourceCategory.SERVICE.name(), ImageManager.getResourceIcon(ResourceCategory.SERVICE));
+ fieldCategory.setValueIcons(categoryIcons);
+ fieldCategory.setShowHover(true);
+ fieldCategory.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String cat = record.getAttribute(DataSource.Field.CATEGORY);
+ if (ResourceCategory.PLATFORM.name().equals(cat)) {
+ return MSG.common_title_platform();
+ } else if (ResourceCategory.SERVER.name().equals(cat)) {
+ return MSG.common_title_server();
+ } else if (ResourceCategory.SERVICE.name().equals(cat)) {
+ return MSG.common_title_service();
+ }
+ return "";
+ }
+ });
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid lg = (ListGrid) event.getSource();
+ ListGridRecord selected = lg.getSelectedRecord();
+ String url = getResourceTypeTableUrl(selected);
+ if (url != null) {
+ CoreGUI.goToView(url);
+ }
+ }
+ });
+
+ setListGridFields(fieldTypeName, fieldPlugin, fieldCategory, fieldVersion, fieldCount, fieldInCompliance);
+ }
+
+ private String getResourceTypeTableUrl(ListGridRecord selected) {
+ String url = null;
+ if (selected != null) {
+ int resourceTypeId = selected.getAttributeAsInt(DataSource.Field.TYPEID);
+ String version = selected.getAttribute(DataSource.Field.VERSION);
+ if (version == null) {
+ url = "#Reports/Inventory/DriftCompliance/" + resourceTypeId;
+ } else {
+ url = "#Reports/Inventory/DriftCompliance/" + resourceTypeId + "/" + version;
+ }
+ }
+ return url;
+ }
+
+ class DataSource extends RPCDataSource<ResourceInstallCount, org.rhq.core.domain.criteria.Criteria> {
+
+ public class Field {
+ public static final String COUNT = "count"; // long that we convert to int
+ public static final String TYPENAME = "typeName"; // String
+ public static final String TYPEPLUGIN = "typePlugin"; // String
+ public static final String CATEGORY = "category"; // ResourceCategory
+ public static final String TYPEID = "typeId"; // int
+ public static final String VERSION = "version"; // String
+ public static final String OBJECT = "object";
+ public static final String IN_COMPLIANCE = "inCompliance";
+ }
+
+ @Override
+ public ResourceInstallCount copyValues(Record from) {
+ return (ResourceInstallCount) from.getAttributeAsObject(DataSource.Field.OBJECT);
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceInstallCount from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(Field.COUNT, Long.valueOf(from.getCount()).intValue()); // we'll never have over Integer.MAX_VALUE, overflow not a worry
+ record.setAttribute(Field.TYPENAME, from.getTypeName());
+ record.setAttribute(Field.TYPEPLUGIN, from.getTypePlugin());
+ record.setAttribute(Field.CATEGORY, from.getCategory().name());
+ record.setAttribute(Field.TYPEID, from.getTypeId());
+ record.setAttribute(Field.VERSION, from.getVersion());
+ record.setAttribute(Field.OBJECT, from);
+
+ if (from.getNumDriftTemplates() > 0) {
+ record.setAttribute(Field.IN_COMPLIANCE, Boolean.toString(from.isInCompliance()));
+ }
+
+ return record;
+ }
+
+ @Override
+ protected org.rhq.core.domain.criteria.Criteria getFetchCriteria(DSRequest request) {
+ // we don't use criterias for this datasource, just return null
+ return null;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response,
+ final org.rhq.core.domain.criteria.Criteria unused) {
+ ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+
+ resourceService.findResourceComplianceCounts(new AsyncCallback<List<ResourceInstallCount>>() {
+
+ @Override
+ public void onSuccess(List<ResourceInstallCount> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.size());
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_reports_inventorySummary_failFetch(), caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReportResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReportResourceSearchView.java
new file mode 100644
index 0000000..e076aae
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/DriftComplianceReportResourceSearchView.java
@@ -0,0 +1,191 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.report;
+
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+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.drift.DriftComplianceStatus;
+import org.rhq.core.domain.drift.DriftDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.IconField;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+
+/**
+ * Extends the ResourceSearchView with drift compliance information.
+ *
+ * @author Jay Shaughnessy
+ * @author John Sanda
+ */
+public class DriftComplianceReportResourceSearchView extends ResourceSearchView {
+
+ private final int resourceTypeId;
+
+ public DriftComplianceReportResourceSearchView(String locatorId, Criteria criteria) {
+ super(locatorId, criteria);
+
+ setInitialCriteriaFixed(true);
+
+ this.resourceTypeId = criteria.getAttributeAsInt(ResourceDataSourceField.TYPE.propertyName());
+ };
+
+ // suppress unchecked warnings because the superclass has different generic types for the datasource
+ @SuppressWarnings("unchecked")
+ @Override
+ protected RPCDataSource getDataSourceInstance() {
+ return new DataSource();
+ }
+
+ @Override
+ protected List<ListGridField> createFields() {
+
+ List<ListGridField> fields = super.createFields();
+
+ // replace the cell formatter on the name field to go directly to drift tab
+ ListGridField nameField = null;
+ for (ListGridField field : fields) {
+ if (NAME.propertyName().equals(field.getName())) {
+ nameField = field;
+ break;
+ }
+ }
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String url = LinkManager.getResourceTabLink(record.getAttributeAsInt("id"),
+ ResourceDetailView.Tab.DRIFT, null);
+ String name = StringUtility.escapeHtml(value.toString());
+ return SeleniumUtility.getLocatableHref(url, name, null);
+ }
+ });
+
+ IconField inComplianceField = new IconField(DataSource.ATTR_IN_COMPLIANCE, MSG.common_title_in_compliance(), 95);
+ inComplianceField.setCanSortClientOnly(true);
+ fields.add(inComplianceField);
+
+ return fields;
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
+ // replace the doubleClickHandler to go directly to drift tab
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute("id");
+ CoreGUI.goToView(LinkManager.getResourceTabLink(Integer.valueOf(selectedId),
+ ResourceDetailView.Tab.DRIFT, null));
+ }
+ }
+ });
+
+ }
+
+ private class DataSource extends ResourceDatasource {
+
+ private static final String ATTR_IN_COMPLIANCE = "inCompliance";
+
+ private ResourceType resourceType;
+
+ @Override
+ public void executeFetch(final DSRequest request, final DSResponse response, final ResourceCriteria criteria) {
+
+ if (null == resourceType) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceTypeId,
+ EnumSet.of(ResourceTypeRepository.MetadataType.driftDefinitionTemplates),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ resourceType = type;
+ DataSource.super.executeFetch(request, response, criteria);
+ }
+ });
+
+ } else {
+ super.executeFetch(request, response, criteria);
+ }
+ }
+
+ @Override
+ protected ResourceCriteria getFetchCriteria(DSRequest request) {
+ ResourceCriteria criteria = super.getFetchCriteria(request);
+ criteria.fetchDriftDefinitions(true);
+
+ // filter out unsortable fields (i.e. fields sorted client-side only)
+ PageControl pageControl = getPageControl(request);
+ pageControl.removeOrderingField(ATTR_IN_COMPLIANCE);
+ criteria.setPageControl(pageControl);
+
+ return criteria;
+ }
+
+ @Override
+ public ListGridRecord copyValues(Resource from) {
+ ListGridRecord record = super.copyValues(from);
+
+ if (!resourceType.getDriftDefinitionTemplates().isEmpty()) {
+ record.setAttribute(ATTR_IN_COMPLIANCE, ImageManager.getAvailabilityIcon(!isOutOfCompliance(from)));
+ }
+ return record;
+ }
+
+ private boolean isOutOfCompliance(Resource resource) {
+ for (DriftDefinition def : resource.getDriftDefinitions()) {
+ if (def.getComplianceStatus() != DriftComplianceStatus.IN_COMPLIANCE) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 06da7a5..73c88ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -112,20 +112,20 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem recentConfigurationChangesItem = new NavigationItem(ResourceConfigurationHistoryListView.VIEW_ID,
- "subsystems/configure/Configure_16.png", new ViewFactory() {
+ NavigationItem recentConfigurationChangesItem = new NavigationItem(
+ ResourceConfigurationHistoryListView.VIEW_ID, "subsystems/configure/Configure_16.png", new ViewFactory() {
public Canvas createView() {
- return new ResourceConfigurationHistoryListView(extendLocatorId(ResourceConfigurationHistoryListView.VIEW_ID.getName()),
- getGlobalPermissions().contains(Permission.MANAGE_INVENTORY));
+ return new ResourceConfigurationHistoryListView(
+ extendLocatorId(ResourceConfigurationHistoryListView.VIEW_ID.getName()), getGlobalPermissions()
+ .contains(Permission.MANAGE_INVENTORY));
}
});
NavigationItem recentOperationsItem = new NavigationItem(OperationHistoryView.SUBSYSTEM_VIEW_ID,
"subsystems/control/Operation_16.png", new ViewFactory() {
public Canvas createView() {
- return new SubsystemOperationHistoryListView(
- extendLocatorId(OperationHistoryView.SUBSYSTEM_VIEW_ID.getName()), getGlobalPermissions()
- .contains(Permission.MANAGE_INVENTORY));
+ return new SubsystemOperationHistoryListView(extendLocatorId(OperationHistoryView.SUBSYSTEM_VIEW_ID
+ .getName()), getGlobalPermissions().contains(Permission.MANAGE_INVENTORY));
}
});
@@ -138,8 +138,8 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem alertDefinitionsItem = new NavigationItem(new ViewName("AlertDefinitions",
- MSG.view_reports_alertDefinitions()), "subsystems/alert/Alerts_16.png", new ViewFactory() {
+ NavigationItem alertDefinitionsItem = new NavigationItem(new ViewName("AlertDefinitions", MSG
+ .view_reports_alertDefinitions()), "subsystems/alert/Alerts_16.png", new ViewFactory() {
public Canvas createView() {
return new AlertDefinitionReportView(extendLocatorId(AlertDefinitionReportView.VIEW_ID.getName()));
}
@@ -174,14 +174,22 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
}, getGlobalPermissions().contains(Permission.MANAGE_INVENTORY));
- NavigationItem platformSystemInfoItem = new NavigationItem(PlatformSummaryPortlet.VIEW_ID,
- ImageManager.getResourceIcon(ResourceCategory.PLATFORM), new ViewFactory() {
- public Canvas createView() {
- return new PlatformSummaryPortlet(extendLocatorId(PlatformSummaryPortlet.VIEW_ID.getName()));
- }
- });
+ NavigationItem platformSystemInfoItem = new NavigationItem(PlatformSummaryPortlet.VIEW_ID, ImageManager
+ .getResourceIcon(ResourceCategory.PLATFORM), new ViewFactory() {
+ public Canvas createView() {
+ return new PlatformSummaryPortlet(extendLocatorId(PlatformSummaryPortlet.VIEW_ID.getName()));
+ }
+ });
+
+ NavigationItem driftComplianceItem = new NavigationItem(DriftComplianceReport.VIEW_ID, ImageManager
+ .getDriftIcon(), new ViewFactory() {
+ public Canvas createView() {
+ return new DriftComplianceReport(extendLocatorId(DriftComplianceReport.VIEW_ID.getName()));
+ }
+ }, getGlobalPermissions().contains(Permission.MANAGE_INVENTORY));
- return new NavigationSection(SECTION_INVENTORY_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
+ return new NavigationSection(SECTION_INVENTORY_VIEW_ID, inventorySummaryItem, platformSystemInfoItem,
+ driftComplianceItem);
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
index 744afdc..0947d96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
@@ -90,7 +90,7 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
private void showResourceList(Criteria criteria) {
hideResourceList();
- resourceList = new ResourceInstallReportResourceSearchView(extendLocatorId("resourceList"), criteria);
+ resourceList = new ResourceSearchView(extendLocatorId("resourceList"), criteria);
addMember(resourceList);
markForRedraw();
}
@@ -119,20 +119,18 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
ListGridField fieldVersion = new ListGridField(DataSource.Field.VERSION, MSG.common_title_version());
ListGridField fieldCount = new ListGridField(DataSource.Field.COUNT, MSG.common_title_count());
- ListGridField fieldInCompliance = new ListGridField(DataSource.Field.IN_COMPLIANCE, MSG
- .common_title_in_compliance());
- HashMap<String, String> complianceIcons = new HashMap<String, String>();
- complianceIcons.put("true", ImageManager.getAvailabilityIcon(true));
- complianceIcons.put("false", ImageManager.getAvailabilityIcon(false));
- fieldInCompliance.setValueIcons(complianceIcons);
- fieldInCompliance.setType(ListGridFieldType.ICON);
-
fieldTypeName.setWidth("35%");
fieldPlugin.setWidth("10%");
fieldCategory.setWidth(70);
fieldVersion.setWidth("*");
fieldCount.setWidth(60);
- fieldInCompliance.setWidth(100);
+
+ // TODO (ips, 11/11/11): The groupBy functionality is very buggy in SmartGWT 2.4. Once they fix it
+ // uncomment these lines to allow grouping by the plugin or category fields.
+ /*getListGrid().setCanGroupBy(true);
+ fieldTypeName.setCanGroupBy(false);
+ fieldVersion.setCanGroupBy(false);
+ fieldCount.setCanGroupBy(false); */
fieldTypeName.setCellFormatter(new CellFormatter() {
@Override
@@ -182,7 +180,7 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
}
});
- setListGridFields(fieldTypeName, fieldPlugin, fieldCategory, fieldVersion, fieldCount, fieldInCompliance);
+ setListGridFields(fieldTypeName, fieldPlugin, fieldCategory, fieldVersion, fieldCount);
}
private String getResourceTypeTableUrl(ListGridRecord selected) {
@@ -209,7 +207,6 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
public static final String TYPEID = "typeId"; // int
public static final String VERSION = "version"; // String
public static final String OBJECT = "object";
- public static final String IN_COMPLIANCE = "inCompliance";
}
@Override
@@ -229,10 +226,6 @@ public class ResourceInstallReport extends LocatableVLayout implements Bookmarka
record.setAttribute(Field.VERSION, from.getVersion());
record.setAttribute(Field.OBJECT, from);
- if (from.getNumDriftTemplates() > 0) {
- record.setAttribute(Field.IN_COMPLIANCE, Boolean.toString(from.isInCompliance()));
- }
-
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReportResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReportResourceSearchView.java
deleted file mode 100644
index 59c7ed2..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReportResourceSearchView.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * 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 and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.report;
-
-import java.util.EnumSet;
-import java.util.List;
-
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-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.drift.DriftComplianceStatus;
-import org.rhq.core.domain.drift.DriftDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.table.IconField;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Jay Shaughnessy
- * @author John Sanda
- */
-public class ResourceInstallReportResourceSearchView extends ResourceSearchView {
-
- private final int resourceTypeId;
-
- public ResourceInstallReportResourceSearchView(String locatorId, Criteria criteria) {
- super(locatorId, criteria);
-
- setInitialCriteriaFixed(true);
-
- this.resourceTypeId = criteria.getAttributeAsInt(ResourceDataSourceField.TYPE.propertyName());
- };
-
- // suppress unchecked warnings because the superclass has different generic types for the datasource
- @SuppressWarnings("unchecked")
- @Override
- protected RPCDataSource getDataSourceInstance() {
- return new DataSource();
- }
-
- @Override
- protected List<ListGridField> createFields() {
-
- List<ListGridField> fields = super.createFields();
-
- IconField inComplianceField = new IconField(DataSource.ATTR_IN_COMPLIANCE, MSG.common_title_in_compliance(), 95);
- fields.add(inComplianceField);
-
- return fields;
- }
-
- private class DataSource extends ResourceDatasource {
-
- private static final String ATTR_IN_COMPLIANCE = "inCompliance";
-
- private ResourceType resourceType;
-
- @Override
- public void executeFetch(final DSRequest request, final DSResponse response, final ResourceCriteria criteria) {
-
- if (null == resourceType) {
-
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceTypeId,
- EnumSet.of(ResourceTypeRepository.MetadataType.driftDefinitionTemplates),
- new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
- resourceType = type;
- DataSource.super.executeFetch(request, response, criteria);
- }
- });
-
- } else {
- super.executeFetch(request, response, criteria);
- }
- }
-
- @Override
- protected ResourceCriteria getFetchCriteria(DSRequest request) {
- ResourceCriteria criteria = super.getFetchCriteria(request);
- criteria.fetchDriftDefinitions(true);
- return criteria;
- }
-
- @Override
- public ListGridRecord copyValues(Resource from) {
- ListGridRecord record = super.copyValues(from);
-
- if (!resourceType.getDriftDefinitionTemplates().isEmpty()) {
- record.setAttribute(ATTR_IN_COMPLIANCE, ImageManager.getAvailabilityIcon(!isOutOfCompliance(from)));
- }
- return record;
- }
-
- private boolean isOutOfCompliance(Resource resource) {
- for (DriftDefinition def : resource.getDriftDefinitions()) {
- if (def.getComplianceStatus() != DriftComplianceStatus.IN_COMPLIANCE) {
- return true;
- }
- }
- return false;
- }
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 89e217e..d124879 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -151,6 +151,25 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
}
+ public List<ResourceInstallCount> findResourceComplianceCounts() throws RuntimeException {
+ try {
+ List<ResourceInstallCount> result = resourceManager.findResourceComplianceCounts(getSessionSubject());
+ return SerialUtility.prepare(result, "ResourceService.findResourceComplianceCounts");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ public List<ResourceInstallCount> findResourceInstallCounts(boolean groupByVersions) throws RuntimeException {
+ try {
+ List<ResourceInstallCount> result = resourceManager.findResourceInstallCounts(getSessionSubject(),
+ groupByVersions);
+ return SerialUtility.prepare(result, "ResourceService.findResourceInstallCounts");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
/** Locate ProblemResourcesComposites and generate the disambiguation reports for them.
* Criteria passed in not currently used.
*/
@@ -367,14 +386,4 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
throw getExceptionToThrowToClient(t);
}
}
-
- public List<ResourceInstallCount> findResourceInstallCounts(boolean groupByVersions) throws RuntimeException {
- try {
- List<ResourceInstallCount> result = resourceManager.findResourceInstallCounts(getSessionSubject(),
- groupByVersions);
- return SerialUtility.prepare(result, "ResourceService.findResourceInstallCounts");
- } catch (Throwable t) {
- throw getExceptionToThrowToClient(t);
- }
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 42064bb..b7edd70 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1671,6 +1671,7 @@ view_reportsTop_title = Reports
view_reports_alertDefinitions = Alert Definitions
view_reports_alertDefinitions_parentHover = Click to go to the parent alert definition
view_reports_alertDefinitions_resTypeLoadError = Cannot get the template resource type - unable to view the alert template.
+view_reports_driftCompliance = Drift Compliance
view_reports_inventorySummary_failFetch = Failed to get inventory summary
view_reports_platforms = Platform Utilization
view_reports_subsystems = Subsystems
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 614fcb8..af27641 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -528,6 +528,8 @@ view_admin_systemSettings_AvailabilityPurge_name = Lösche Verfügbarkeitsdaten,
view_admin_systemSettings_DriftFilePurge_name = Lösche ungenutzte Drift-Dateine, die älter sind als
view_admin_systemSettings_LDAPBindPW_name = Passwort
view_admin_systemSettings_TraitPurge_name = Lösche Trait-Daten, die älter sind als
+view_admin_systemSettings_dumpToLogFailed = Schreiben der Systeminformation in die Server-Log-Datei ist fehlgeschlagen
+view_admin_systemSettings_dumpedToLog = System informationen wurden erfolgreich in die Server-Log-Datei geschrieben
##view_admin_systemSettings_group_drift = Drift Server Configuration Settings
view_admin_systemSettings_saveFailure = Das Speichern der Systemeinstellungen ist fehlgeschlagen
view_admin_systemSettings_savedSettings = Sie haben die Systemeinstellungen erfolgreich gespeichert
@@ -1038,7 +1040,7 @@ view_dashboards_title = Dashboard
##view_drift_category_fileRemoved = File Removed
##view_drift_confirm_deleteAllDefs = Delete all drift detection definitions?
##view_drift_confirm_deleteDefs = Delete the selected drift detection definition(s)?
-view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
+##view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
##view_drift_failure_deleteDefs = Failed to delete some or all drift detection definitions.
##view_drift_failure_deleteTemplates = Failed to delete some or all of the drift templates
##view_drift_failure_detectNow = Failed to submit drift detection run request
@@ -1452,6 +1454,10 @@ view_remoteAgentInstall_stopAgent = Agent anhalten
view_reportsTop_description = Dieser Abschnitt bietet Zugang zu applikationsweiten Berichten
view_reportsTop_title = Berichte
view_reports_alertDefinitions = Alarmierungskriterien
+##view_reports_alertDefinitions_parentHover = Click to go to the parent alert definition
+##view_reports_alertDefinitions_resTypeLoadError = Cannot get the template resource type - unable to view the alert template.
+##view_reports_driftCompliance = Drift Compliance
+##view_reports_inventorySummary_failFetch = Failed to get inventory summary
view_reports_platforms = Cpu- und Speicherauslastung
view_reports_subsystems = Subsysteme
##view_resourceResourceGroupList_error_fetchFailure = Failed to fetch Resource''s groups.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 7946cab..2823d98 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1180,7 +1180,7 @@ view_dashboards_title = ダッシュボード
##view_drift_category_fileRemoved = File Removed
##view_drift_confirm_deleteAllDefs = Delete all drift detection definitions?
##view_drift_confirm_deleteDefs = Delete the selected drift detection definition(s)?
-view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
+##view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
##view_drift_failure_deleteDefs = Failed to delete some or all drift detection definitions.
##view_drift_failure_deleteTemplates = Failed to delete some or all of the drift templates
##view_drift_failure_detectNow = Failed to submit drift detection run request
@@ -1659,6 +1659,7 @@ view_reportsTop_title = レポート
view_reports_alertDefinitions = アラート定義
view_reports_alertDefinitions_parentHover = クリックすると親のアラート定義へ行きます
view_reports_alertDefinitions_resTypeLoadError = テンプレートリソースタイプを取得できません - アラートテンプレートの閲覧ができません
+##view_reports_driftCompliance = Drift Compliance
view_reports_inventorySummary_failFetch = インベントリサマリーの取得に失敗しました
view_reports_platforms = プラットフォーム利用率
view_reports_subsystems = サブシステム
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index db56109..5e84274 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -631,6 +631,8 @@ view_admin_systemSettings_TraitPurge_desc = How old measurement trait data must
view_admin_systemSettings_TraitPurge_name = Delete Measurement Traits Older Than
view_admin_systemSettings_cannotLoadServerDetails = Cannot load server details
view_admin_systemSettings_cannotLoadSettings = Cannot obtain the current system settings
+##view_admin_systemSettings_dumpToLogFailed = Writing of system info to server log file failed
+##view_admin_systemSettings_dumpedToLog = System info was successfully written to server log file
view_admin_systemSettings_fixBeforeSaving = Please fix the invalid values before saving
view_admin_systemSettings_group_baseline = Automatic Baseline Configuration Properties
view_admin_systemSettings_group_dataMgr = Data Manager Configuration Properties
@@ -1209,7 +1211,7 @@ view_drift_category_fileChanged = Arquivo alterado
##view_drift_category_fileRemoved = Arquivo removido
##view_drift_confirm_deleteAllDefs = Delete all drift detection definitions?
##view_drift_confirm_deleteDefs = Delete the selected drift detection definition(s)?
-view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
+##view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
##view_drift_failure_deleteDefs = Failed to delete some or all drift detection definitions.
##view_drift_failure_deleteTemplates = Failed to delete some or all of the drift templates
view_drift_failure_detectNow = Falha ao submeter a requisi��o de detec��o do drift
@@ -1775,9 +1777,10 @@ view_remoteAgentInstall_updateStatus = Status da Atualiza\u00E7\u00E3o
view_reportsTop_description = This section provides access to global reports.
view_reportsTop_title = Relat\u00F3rios
view_reports_alertDefinitions = Defini\u00E7\u00E3o de Alertas
-view_reports_alertDefinitions_parentHover = Click to go to the parent alert definition
-view_reports_alertDefinitions_resTypeLoadError = Cannot get the template resource type - unable to view the alert template.
-view_reports_inventorySummary_failFetch = Failed to get inventory summary
+##view_reports_alertDefinitions_parentHover = Click to go to the parent alert definition
+##view_reports_alertDefinitions_resTypeLoadError = Cannot get the template resource type - unable to view the alert template.
+##view_reports_driftCompliance = Drift Compliance
+##view_reports_inventorySummary_failFetch = Failed to get inventory summary
view_reports_platforms = Utiliza\u00E7\u00E3o de Mem\u00F3ria e CPU
view_reports_subsystems = Subsistemas
view_resourceResourceGroupList_error_fetchFailure = Failed to fetch Resource''s groups.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index dad3952..a79d3ba 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1189,7 +1189,7 @@ view_dashboards_title = \u7edf\u8ba1\u8868\u76d8
##view_drift_category_fileRemoved = File Removed
##view_drift_confirm_deleteAllDefs = Delete all drift detection definitions?
##view_drift_confirm_deleteDefs = Delete the selected drift detection definition(s)?
-view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
+##view_drift_confirm_deleteTemplate = Warning! Deleting this template will also cause all attached drift definitions to be deleted as well. Those attached definitions along with all of their snapshots will be permanently removed from the system. Detached definitions will not be removed. Are you sure you want to continue?
##view_drift_failure_deleteDefs = Failed to delete some or all drift detection definitions.
##view_drift_failure_deleteTemplates = Failed to delete some or all of the drift templates
##view_drift_failure_detectNow = Failed to submit drift detection run request
@@ -1669,6 +1669,7 @@ view_reportsTop_title = \u62a5\u8868
view_reports_alertDefinitions = \u544a\u8b66\u5b9a\u4e49
view_reports_alertDefinitions_parentHover = \u70b9\u51fb\u5230\u7236\u7ea7\u544a\u8b66\u83dc\u5355
view_reports_alertDefinitions_resTypeLoadError = \u65e0\u6cd5\u83b7\u53d6\u8d44\u6e90\u6a21\u677f\u7c7b\u578b - \u65e0\u6cd5\u67e5\u770b\u544a\u8b66\u6a21\u677f.
+##view_reports_driftCompliance = Drift Compliance
view_reports_inventorySummary_failFetch = \u83b7\u53d6\u7edf\u8ba1\u6e05\u5355\u5931\u8d25
view_reports_platforms = \u5e73\u53f0\u4f7f\u7528\u7387\u62a5\u8868
view_reports_subsystems = \u5b50\u7cfb\u7edf\u62a5\u8868
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index f87fa14..418bd0f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2372,20 +2372,25 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
@SuppressWarnings("unchecked")
@RequiredPermission(Permission.MANAGE_INVENTORY)
public List<ResourceInstallCount> findResourceInstallCounts(Subject subject, boolean groupByVersions) {
+ String queryName = groupByVersions ? Resource.QUERY_RESOURCE_VERSION_REPORT : Resource.QUERY_RESOURCE_REPORT;
+ Query query = entityManager.createNamedQuery(queryName);
+ List<ResourceInstallCount> results = query.getResultList();
+
+ return results;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public List<ResourceInstallCount> findResourceComplianceCounts(Subject subject) {
Query query = null;
List<ResourceInstallCount> results = null;
- if (!groupByVersions) {
- query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_REPORT);
- results = query.getResultList();
- } else {
- //query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_VERSION_REPORT);
- query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_IN_COMPLIANCE);
- results = query.getResultList();
+ query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_IN_COMPLIANCE);
+ results = query.getResultList();
- query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_OUT_OF_COMPLIANCE);
- results.addAll(query.getResultList());
- }
+ query = entityManager.createNamedQuery(Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_OUT_OF_COMPLIANCE);
+ results.addAll(query.getResultList());
return results;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 841428b..420f4d0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -485,6 +485,8 @@ public interface ResourceManagerLocal {
*/
List<Integer> uninventoryResources(Subject subject, int[] resourceIds);
+ List<ResourceInstallCount> findResourceComplianceCounts(Subject subject);
+
List<ResourceInstallCount> findResourceInstallCounts(Subject subject, boolean groupByVersions);
PageList<ResourceComposite> findResourceCompositesByCriteria(Subject subject, ResourceCriteria criteria);
commit 76f8f62c5920fdb349887822778a893c59b73061
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 21 15:38:50 2011 -0500
[Bug 755712 - Drift carousel view previous button generates exception]
Fix some issues with carousel filtering/next/previous buttons. There
were a few issues in play.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
index 8503487..55e3cbc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
@@ -433,8 +433,11 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
if (null != carouselStartFilter) {
int newEnd = carouselStartFilter + 1;
setCarouselEndFilter(newEnd);
+
+ // it's ok if this is higher than the current max, the actual fetch will make sure the
+ // values are sane.
+ setCarouselStartFilter(carouselStartFilter + carouselSizeFilter);
}
- setCarouselStartFilter(null);
buildCarousel(true);
}
@@ -449,6 +452,7 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
newStart = (newStart < carouselSizeFilter) ? carouselSizeFilter : newStart;
setCarouselStartFilter(newStart);
}
+
setCarouselEndFilter(null);
buildCarousel(true);
@@ -803,7 +807,7 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
}
try {
- carouselStartFilter = Integer.valueOf((String) criteriaMap.get(FILTER_CAROUSEL_START));
+ carouselStartFilter = (Integer) criteriaMap.get(FILTER_CAROUSEL_START);
} catch (Exception e) {
carouselStartFilter = null;
}
@@ -1054,12 +1058,6 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
}
protected void setCarouselStartFilter(Integer carouselStartFilter) {
- // bump up the start filter max if need be
- Integer max = getCarouselStartFilterMax();
- if (null != max && max < carouselStartFilter) {
- setCarouselStartFilterMax(carouselStartFilter);
- }
-
this.carouselStartFilter = carouselStartFilter;
if (null != carouselStartFilter) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
index 4489472..544ef81 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
@@ -70,7 +70,7 @@ public class DriftCarouselView extends BookmarkableCarousel implements DetailsVi
private int driftDefId;
private EntityContext context;
private boolean hasWriteAccess;
- private Integer maxCarouselEndFilter;
+ private Integer maxSnapshotVersion;
private ArrayList<Record> selectedRecords = new ArrayList<Record>();
private boolean useDriftDetailsView;
@@ -157,11 +157,9 @@ public class DriftCarouselView extends BookmarkableCarousel implements DetailsVi
}
});
+ // descending order, so highest changeset version first
if (null == carouselStart) {
carouselStart = changeSet.getVersion();
- if (null == maxCarouselEndFilter) {
- maxCarouselEndFilter = carouselStart;
- }
}
carouselEnd = changeSet.getVersion();
@@ -169,20 +167,20 @@ public class DriftCarouselView extends BookmarkableCarousel implements DetailsVi
break;
}
}
+ if (null == maxSnapshotVersion || maxSnapshotVersion < carouselStart) {
+ maxSnapshotVersion = carouselStart;
+ setCarouselStartFilterMax(maxSnapshotVersion);
+ }
+
+ setCarouselStartFilter(carouselStart);
+ setCarouselEndFilter(carouselEnd);
+ setCarouselSizeFilter(carouselSize);
if (!isRefresh) {
DriftCarouselView.super.onDraw();
} else {
DriftCarouselView.this.refreshCarouselInfo();
}
-
- Integer currentStartFilterMax = getCarouselStartFilterMax();
- if (null == currentStartFilterMax || currentStartFilterMax < carouselStart) {
- setCarouselStartFilterMax(carouselStart);
- }
- setCarouselStartFilter(carouselStart);
- setCarouselEndFilter(carouselEnd);
- setCarouselSizeFilter(carouselSize);
}
public void onFailure(Throwable caught) {
@@ -220,30 +218,29 @@ public class DriftCarouselView extends BookmarkableCarousel implements DetailsVi
* @param changeSetCriteria
*/
private void addCarouselCriteria(GenericDriftChangeSetCriteria changeSetCriteria) {
- Integer carouselStartFilter;
- Integer carouselEndFilter;
-
- // if no startFilter is set then include changesets up to the most recent
- try {
- carouselStartFilter = Integer.valueOf(getCarouselStartFilter());
- if (carouselStartFilter > 0) {
- changeSetCriteria.addFilterEndVersion(String.valueOf(carouselStartFilter));
- }
- } catch (Exception e) {
- carouselStartFilter = null;
+ Integer startVersion; // low snapshot version (carouselEndFilter)
+ Integer endVersion; // high snapshot version (carouselStartFilter)
+
+ // if no startFilter is set then don't limit the endVersion
+ endVersion = getCarouselStartFilter();
+ if (null != endVersion) {
+ changeSetCriteria.addFilterEndVersion(String.valueOf(endVersion));
}
// if no endFilter is set then include changesets greater than 0 (never include 0, the initial snapshot)
- try {
- carouselEndFilter = Integer.valueOf(getCarouselEndFilter());
- if (carouselEndFilter < 1) {
- carouselEndFilter = 1;
- } else if (carouselEndFilter <= maxCarouselEndFilter) {
- changeSetCriteria.addFilterStartVersion(String.valueOf(carouselEndFilter));
- }
- } catch (Exception e) {
- carouselEndFilter = null;
+ // else ensure endFilter is not greater than makes sense
+ startVersion = getCarouselEndFilter();
+ if (null == startVersion || 1 > startVersion) {
+ startVersion = 1;
+
+ } else if (null != endVersion && startVersion > endVersion) {
+ startVersion = endVersion;
+ }
+
+ if (null != maxSnapshotVersion && startVersion > maxSnapshotVersion) {
+ startVersion = maxSnapshotVersion;
}
+ changeSetCriteria.addFilterStartVersion(String.valueOf(startVersion));
// apply the drift-level carousel filters in order to filter out changesets that have no applicab;e drift
Criteria criteria = getCurrentCriteria();