<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [3288] update group plugin config GUI to use new and improved infra (http://jira.rhq-project.org/browse/RHQ-1561 and http://jira.rhq-project.org/browse/RHQ-1562)</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3288</dd> <dt>Author</dt> <dd>ispringer</dd> <dt>Date</dt> <dd>2009-03-03 22:45:00 -0600 (Tue, 03 Mar 2009)</dd> </dl> <h3>Log Message</h3> <pre>update group plugin config GUI to use new and improved infra (http://jira.rhq-project.org/browse/RHQ-1561 and http://jira.rhq-project.org/browse/RHQ-1562)</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationConfigurationjava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java</a></li> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationPluginConfigurationUpdatejava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java</a></li> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationgroupAggregatePluginConfigurationUpdatejava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregatePluginConfigurationUpdate.java</a></li> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationgroupAggregateResourceConfigurationUpdatejava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregateResourceConfigurationUpdate.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyDetailsUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyHistoryUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyHistoryUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebappWEBINFjsfmanagedbeansresourcegroupinventorybeansxml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans-resource-group/inventory-beans.xml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebappWEBINFjsfnavigationresourcegroupinventorynavigationxml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation-resource-group/inventory-navigation.xml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqgroupinventoryeditconnectionxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/edit-connection.xhtml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqgroupinventoryviewconnectionxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view-connection.xhtml</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverconfigurationConfigurationManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverconfigurationConfigurationManagerLocaljava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverconfigurationjobAbstractAggregateConfigurationUpdateJobjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/job/AbstractAggregateConfigurationUpdateJob.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverconfigurationjobAggregatePluginConfigurationUpdateJobjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/job/AggregatePluginConfigurationUpdateJob.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverconfigurationjobAggregateResourceConfigurationUpdateJobjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/job/AggregateResourceConfigurationUpdateJob.java</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupAbstractGroupPluginConfigurationUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupEditGroupPluginConfigurationUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupGroupPluginConfigurationUtilityjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/GroupPluginConfigurationUtility.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupPluginConfigurationUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupPluginConfigurationUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqgroupinventoryconnectionHistoryxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/connectionHistory.xhtml</a></li> </ul> <h3>Removed Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupEditGroupConnectionPropertiesUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupConnectionPropertiesUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertiesUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertiesUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyDetailsHeaderUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsHeaderUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqgroupinventorylistpluginconfigurationupdatehistoryxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/list-plugin-configuration-update-history.xhtml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainwebapprhqgroupinventoryviewpluginconfigurationupdatedetailsxhtml">rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view-plugin-configuration-update-details.xhtml</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationConfigurationjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -111,11 +111,21 @@ </span><span class="cx"> + " FROM ResourceGroup rg " // + " JOIN rg.implicitResources r " // + " WHERE rg.id = :resourceGroupId"), </span><span class="add">+ @NamedQuery(name = Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_ID, query = "" // + + "SELECT r.id, r.pluginConfiguration " // + + " FROM ResourceGroup rg " // + + " JOIN rg.implicitResources r " // + + " WHERE rg.id = :resourceGroupId"), </span><span class="cx"> @NamedQuery(name = Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_AGGREGATE_ID, query = "" // + "SELECT res.id, cu.configuration " // + " FROM ResourceConfigurationUpdate cu " // + " JOIN cu.resource res " // + " WHERE cu.aggregateConfigurationUpdate.id = :aggregateConfigurationUpdateId"), </span><span class="add">+ @NamedQuery(name = Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_AGGREGATE_ID, query = "" // + + "SELECT res.id, cu.configuration " // + + " FROM PluginConfigurationUpdate cu " // + + " JOIN cu.resource res " // + + " WHERE cu.aggregateConfigurationUpdate.id = :aggregateConfigurationUpdateId"), </span><span class="cx"> @NamedQuery(name = Configuration.QUERY_DELETE_PROPERTIES_BY_CONFIGURATION_IDS, query = "" // + "DELETE FROM Property p WHERE p.configuration.id IN ( :configurationIds )"), @NamedQuery(name = Configuration.QUERY_DELETE_CONFIGURATIONS_BY_CONFIGURATION_IDs, query = "" // </span><span class="lines">@@ -131,7 +141,9 @@ </span><span class="cx"> public static final String QUERY_GET_PLUGIN_CONFIG_BY_RESOURCE_ID = "Configuration.getPluginConfigByResourceId"; public static final String QUERY_GET_RESOURCE_CONFIG_BY_RESOURCE_ID = "Configuration.getResourceConfigByResourceId"; public static final String QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_ID = "Configuration.getResourceConfigMapByGroupId"; </span><span class="add">+ public static final String QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_ID = "Configuration.getPluginConfigMapByGroupId"; </span><span class="cx"> public static final String QUERY_GET_RESOURCE_CONFIG_MAP_BY_AGGREGATE_ID = "Configuration.getResourceConfigMapByAggregateId"; </span><span class="add">+ public static final String QUERY_GET_PLUGIN_CONFIG_MAP_BY_AGGREGATE_ID = "Configuration.getPluginConfigMapByAggregateId"; </span><span class="cx"> public static final String QUERY_DELETE_PROPERTIES_BY_CONFIGURATION_IDS = "Property.deleteByConfigurationIds"; public static final String QUERY_DELETE_CONFIGURATIONS_BY_CONFIGURATION_IDs = "Configuration.deleteByConfigurationIdS"; </span></pre></div> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationPluginConfigurationUpdatejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PluginConfigurationUpdate.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -105,7 +105,7 @@ </span><span class="cx"> public static final String QUERY_FIND_ALL_IN_STATUS = "PluginConfigurationUpdate.findAllInStatus"; public static final String QUERY_FIND_ALL_BY_RESOURCE_ID = "PluginConfigurationUpdate.findAllByResourceId"; public static final String QUERY_FIND_CURRENTLY_ACTIVE_CONFIG = "PluginConfigurationUpdate.findCurrentlyActiveConfig"; </span><span class="rem">- public static final String QUERY_FIND_LATEST_BY_RESOURCE_ID = "PluginConfigurationUpdate.findByResource"; </span><span class="add">+ public static final String QUERY_FIND_LATEST_BY_RESOURCE_ID = "PluginConfigurationUpdate.findLatestByResourceId"; </span><span class="cx"> public static final String QUERY_FIND_COMPOSITE_BY_PARENT_UPDATE_ID = "PluginConfigurationUpdate.findCompositeByParentUpdateId"; public static final String QUERY_FIND_BY_PARENT_UPDATE_ID = "PluginConfigurationUpdate.findByParentUpdateId"; public static final String QUERY_FIND_STATUS_BY_PARENT_UPDATE_ID = "PluginConfigurationUpdate.findStatusByParentUpdateId"; </span></pre></div> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationgroupAggregatePluginConfigurationUpdatejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregatePluginConfigurationUpdate.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregatePluginConfigurationUpdate.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregatePluginConfigurationUpdate.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -48,10 +48,18 @@ </span><span class="cx"> @NamedQueries( { @NamedQuery(name = AggregatePluginConfigurationUpdate.QUERY_FIND_BY_GROUP_ID, query = "SELECT apcu " + "FROM AggregatePluginConfigurationUpdate AS apcu " + "WHERE apcu.group.id = :groupId"), </span><span class="add">+ @NamedQuery(name = AggregatePluginConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID, query = "" // + + "SELECT cgu " // + + " FROM AggregatePluginConfigurationUpdate cgu " // + + " WHERE cgu.group.id = :groupId " // + + " AND cgu.modifiedTime = ( SELECT MAX(cgu2.modifiedTime) " // + + " FROM AggregatePluginConfigurationUpdate cgu2 " // + + " WHERE cgu2.group.id = :groupId ) "), </span><span class="cx"> @NamedQuery(name = AggregatePluginConfigurationUpdate.QUERY_DELETE_BY_ID, query = "DELETE " + "FROM AggregatePluginConfigurationUpdate AS apcu " + "WHERE apcu.id IN ( :ids ) ") }) public class AggregatePluginConfigurationUpdate extends AbstractAggregateConfigurationUpdate { public static final String QUERY_FIND_BY_GROUP_ID = "AggregatePluginConfigurationUpdate.findByGroupId"; </span><span class="add">+ public static final String QUERY_FIND_LATEST_BY_GROUP_ID = "AggregatePluginConfigurationUpdate.findLatestByGroupId"; </span><span class="cx"> public static final String QUERY_DELETE_BY_ID = "AggregatePluginConfigurationUpdate.deleteById"; private static final long serialVersionUID = 1L; </span><span class="lines">@@ -62,10 +70,14 @@ </span><span class="cx"> protected AggregatePluginConfigurationUpdate() { } // JPA </span><span class="rem">- public AggregatePluginConfigurationUpdate(ResourceGroup group, Configuration aggregateConfiguration, - String subjectName) { </span><span class="add">+ public AggregatePluginConfigurationUpdate(ResourceGroup group, + String subjectName) { </span><span class="cx"> super(group, subjectName); </span><span class="rem">- this.configuration = aggregateConfiguration.deepCopy(false); </span><span class="add">+ //this.configuration = aggregateConfiguration.deepCopy(false); + // TODO (ips, 02/13/09): This is a temporary workaround - we don't really need to store a Configuration at all, + // since it can be recalculated from the member configs when needed, but the AbstractConfigurationUpdate + // base class requires the configuration field to be non-null. + this.configuration = new Configuration(); </span><span class="cx"> } public void setConfigurationUpdates(List<PluginConfigurationUpdate> configurationUpdates) { </span></pre></div> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainconfigurationgroupAggregateResourceConfigurationUpdatejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregateResourceConfigurationUpdate.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregateResourceConfigurationUpdate.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/AggregateResourceConfigurationUpdate.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -64,7 +64,8 @@ </span><span class="cx"> public AggregateResourceConfigurationUpdate(ResourceGroup group, String subjectName) { super(group, subjectName); // TODO (ips, 02/13/09): This is a temporary workaround - we don't really need to store a Configuration at all, </span><span class="rem">- // but the AbstractConfigurationUpdate base class requires the configuration field to be non-null. </span><span class="add">+ // since it can be recalculated from the member configs when needed, but the AbstractConfigurationUpdate + // base class requires the configuration field to be non-null. </span><span class="cx"> this.configuration = new Configuration(); } </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupAbstractGroupPluginConfigurationUIBeanjavafromrev3273rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiconfigurationgroupAbstractGroupResourceConfigurationUIBeanjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java (from rev 3273, rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/AbstractGroupResourceConfigurationUIBean.java) (0 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java (rev 0) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -0,0 +1,121 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 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.inventory.group; + +import java.util.Map; + +import javax.faces.application.FacesMessage; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.resource.group.GroupCategory; +import org.rhq.core.domain.resource.group.ResourceGroup; +import org.rhq.core.gui.configuration.propset.ConfigurationSet; +import org.rhq.core.gui.util.FacesContextUtility; +import org.rhq.enterprise.gui.legacy.ParamConstants; +import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; +import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal; +import org.rhq.enterprise.server.resource.ResourceManagerLocal; +import org.rhq.enterprise.server.util.LookupUtil; + +import org.jboss.seam.faces.Redirect; + +/** + * An abstract base class for the Seam components for viewing and editing group plugin Configurations. Requires the + * 'groupId' request parameter to be specified. + * + * @author Ian Springer + */ +public abstract class AbstractGroupPluginConfigurationUIBean +{ + private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); + private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager(); + + private ResourceGroup group; + private Map<Integer, Configuration> pluginConfigurations; + private ConfigurationSet configurationSet; + + /** + * Load the ConfigurationDefinition and member Configurations for the current compatible group. + */ + protected void loadConfigurations() + { + try + { + this.group = loadGroup(); + this.pluginConfigurations = this.configurationManager.getPluginConfigurationsForCompatibleGroup( + EnterpriseFacesContextUtility.getSubject(), this.group.getId()); + } + catch (Exception e) + { + // NOTE: In order for this message to be displayed, an EL expression referencing the managed bean must + // be on the page somewhere above the h:messages tag. + FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to load group plugin configuration.", + e); + e.printStackTrace(); + return; + } + this.configurationSet = GroupPluginConfigurationUtility.buildConfigurationSet( + EnterpriseFacesContextUtility.getSubject(), this.group, this.pluginConfigurations); + Redirect.instance().setParameter(ParamConstants.GROUP_ID_PARAM, this.group.getId()); + return; + } + + private ResourceGroup loadGroup() throws Exception + { + ResourceGroup group; + try + { + group = EnterpriseFacesContextUtility.getResourceGroup(); + } + catch (Exception e) + { + throw new Exception("No group is associated with this request ('groupId' request parameter is not set)."); + } + if (group.getGroupCategory() != GroupCategory.COMPATIBLE) + { + throw new Exception("Group with id " + group.getId() + " is not a compatible group."); + } + return group; + } + + public ConfigurationManagerLocal getConfigurationManager() + { + return configurationManager; + } + + public ResourceManagerLocal getResourceManager() + { + return resourceManager; + } + + public ResourceGroup getGroup() + { + return group; + } + + public Map<Integer, Configuration> getPluginConfigurations() + { + return pluginConfigurations; + } + + public ConfigurationSet getConfigurationSet() + { + return configurationSet; + } +} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupAbstractGroupPluginConfigurationUIBeanjava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/AbstractGroupPluginConfigurationUIBean.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Deleted: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupConnectionPropertiesUIBean.java </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupConnectionPropertiesUIBean.java 2009-03-04 04:41:24 UTC (rev 3287) </span><span class="add">+++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupConnectionPropertiesUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -1,75 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.inventory.group; - -import javax.faces.application.FacesMessage; - -import org.quartz.SchedulerException; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.resource.group.ResourceGroup; -import org.rhq.core.gui.configuration.ConfigurationMaskingUtility; -import org.rhq.core.gui.util.FacesContextUtility; -import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; -import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal; -import org.rhq.enterprise.server.configuration.ConfigurationUpdateException; -import org.rhq.enterprise.server.util.LookupUtil; - -public class EditGroupConnectionPropertiesUIBean extends ViewGroupConnectionPropertiesUIBean { - public static final String MANAGED_BEAN_NAME = "EditConnectionPropertiesUIBean"; - - private static final String OUTCOME_SUCCESS = "success"; - private static final String OUTCOME_FAILURE = "failure"; - - private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); - - public String begin() { - return OUTCOME_SUCCESS; - } - - public String update() { - ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition()); - - Subject subject = EnterpriseFacesContextUtility.getSubject(); - ResourceGroup resourceGroup = EnterpriseFacesContextUtility.getResourceGroup(); - Configuration aggregateConfiguration = getConfiguration(); - - try { - this.configurationManager.scheduleAggregatePluginConfigurationUpdate(subject, resourceGroup.getId(), - aggregateConfiguration); - - FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, - "Group connection property update has been submitted for asynchronous processing."); - return OUTCOME_SUCCESS; - } catch (SchedulerException se) { - FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, - "There was an error scheduling the group connection property update"); - return OUTCOME_FAILURE; - } catch (ConfigurationUpdateException cue) { - FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, cue.getMessage()); - return OUTCOME_FAILURE; - } - } - - public String cancel() { - FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "No connection properties were updated."); - return OUTCOME_SUCCESS; - } -} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupEditGroupPluginConfigurationUIBeanjavafromrev3273rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiconfigurationgroupEditGroupResourceConfigurationUIBeanjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java (from rev 3273, rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/EditGroupResourceConfigurationUIBean.java) (0 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java (rev 0) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -0,0 +1,91 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 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.inventory.group; + +import javax.faces.application.FacesMessage; + +import org.rhq.core.gui.util.FacesContextUtility; +import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; + +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.Begin; +import org.jboss.seam.annotations.Create; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.annotations.End; +import org.jboss.seam.core.Conversation; +import org.jboss.seam.faces.Redirect; + +/** + * A POJO Seam component that handles loading and updating of plugin configurations across a compatible Group. + * + * @author Ian Springer + */ +@Name("EditGroupPluginConfigurationUIBean") +@Scope(ScopeType.CONVERSATION) +public class EditGroupPluginConfigurationUIBean extends AbstractGroupPluginConfigurationUIBean { + public static final String VIEW_ID = "/rhq/group/inventory/edit-connection.xhtml"; + + @In(value = "org.jboss.seam.faces.redirect") + private Redirect redirect; + + @Create + @Begin + public void init() { + loadConfigurations(); + return; + } + + /** + * Asynchronously persist the group member Configurations to the DB as well as push them out to the corresponding + * Agents. This gets called when user clicks the SAVE button. + */ + public void updateConfigurations() { + try { + // TODO: See if there's some way for the config renderer to handle calling applyAggregateConfiguration(), + // so the managed bean doesn't have to worry about doing it. + getConfigurationSet().applyAggregateConfiguration(); + getConfigurationManager().scheduleAggregatePluginConfigurationUpdate(EnterpriseFacesContextUtility + .getSubject(), getGroup().getId(), getPluginConfigurations()); + } catch (Exception e) { + FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, + "Failed to schedule group Resource Configuration update - cause: " + e); + this.redirect.setViewId(VIEW_ID); + this.redirect.execute(); + return; + } + FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Group plugin Configuration update scheduled."); + Conversation.instance().endBeforeRedirect(); + this.redirect.setViewId(ViewGroupConnectionPropertyHistoryUIBean.VIEW_ID); + this.redirect.execute(); + return; + } + + /** + * End the convo and redirect back to view-connection.xhtml. This gets called when user clicks the CANCEL button. + */ + @End + public void cancel() { + FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Edit canceled."); + this.redirect.setViewId(ViewGroupPluginConfigurationUIBean.VIEW_ID); + this.redirect.execute(); + return; + } +} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupEditGroupPluginConfigurationUIBeanjava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/EditGroupPluginConfigurationUIBean.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Copied: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/GroupPluginConfigurationUtility.java (from rev 3273, rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/GroupResourceConfigurationUtility.java) </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/GroupPluginConfigurationUtility.java (rev 0) </span><span class="add">+++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/GroupPluginConfigurationUtility.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -0,0 +1,56 @@ </span><span class="add">+package org.rhq.enterprise.gui.inventory.group; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.rhq.core.domain.auth.Subject; +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; +import org.rhq.core.domain.resource.Resource; +import org.rhq.core.domain.resource.group.ResourceGroup; +import org.rhq.core.gui.configuration.propset.ConfigurationSet; +import org.rhq.core.gui.configuration.propset.ConfigurationSetMember; +import org.rhq.enterprise.server.util.LookupUtil; + +/** + * Helper methods shared by various group plugin config managed beans. + * + * @author Ian Springer + */ +public class GroupPluginConfigurationUtility +{ + public static ConfigurationSet buildConfigurationSet(Subject subject, ResourceGroup group, + Map<Integer, Configuration> configs) { + List<ConfigurationSetMember> configurationSetMembers = new ArrayList<ConfigurationSetMember>(configs.size()); + for (Integer resourceId : configs.keySet()) { + String label = GroupPluginConfigurationUtility.createResourceHierarchyLabel(resourceId); + Configuration configuration = configs.get(resourceId); + ConfigurationSetMember configurationSetMember = new ConfigurationSetMember(label, configuration); + configurationSetMembers.add(configurationSetMember); + } + ConfigurationDefinition definition = getConfigurationDefinition(subject, group); + ConfigurationSet configurationSet = new ConfigurationSet(definition, configurationSetMembers); + return configurationSet; + } + + private static String createResourceHierarchyLabel(Integer resourceId) { + List<Resource> resourceLineage = LookupUtil.getResourceManager().getResourceLineage(resourceId); + String previousName = resourceLineage.get(0).getName(); + StringBuilder label = new StringBuilder(previousName); + for (int i = 1; i < resourceLineage.size(); i++) { + Resource resource = resourceLineage.get(i); + String name = resource.getName(); + name = (name.startsWith(previousName)) ? name.substring(previousName.length()) : name; + label.append(" > ").append(name); + } + return label.toString(); + } + + public static ConfigurationDefinition getConfigurationDefinition(Subject subject, ResourceGroup group) { + Integer resourceTypeId = group.getResourceType().getId(); + ConfigurationDefinition configurationDefinition = LookupUtil.getConfigurationManager() + .getPluginConfigurationDefinitionForResourceType(subject, resourceTypeId); + return configurationDefinition; + } +} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupGroupPluginConfigurationUtilityjava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/GroupPluginConfigurationUtility.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info"> Deleted: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertiesUIBean.java </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertiesUIBean.java 2009-03-04 04:41:24 UTC (rev 3287) </span><span class="add">+++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertiesUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -1,114 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.inventory.group; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; -import org.rhq.core.domain.resource.ResourceType; -import org.rhq.core.domain.resource.group.ResourceGroup; -import org.rhq.core.gui.configuration.ConfigurationMaskingUtility; -import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; -import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -public class ViewGroupConnectionPropertiesUIBean { - public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertiesUIBean"; - - private static final String SUCCESS_OUTCOME = "success"; - - protected ConfigurationDefinition configurationDefinition; - protected Configuration configuration; - protected ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); - - public ViewGroupConnectionPropertiesUIBean() { - this.configurationDefinition = lookupConfigurationDefinition(); - if (this.configurationDefinition != null) { - this.configuration = lookupConfiguration(); - } - } - - @Nullable - public ConfigurationDefinition getConfigurationDefinition() { - return this.configurationDefinition; - } - - public void setConfigurationDefinition(@NotNull - ConfigurationDefinition configurationDefinition) { - this.configurationDefinition = configurationDefinition; - } - - @Nullable - public Configuration getConfiguration() { - return this.configuration; - } - - public void setConfiguration(@NotNull - Configuration configuration) { - this.configuration = configuration; - } - - @Nullable - protected ConfigurationDefinition lookupConfigurationDefinition() { - Subject subject = EnterpriseFacesContextUtility.getSubject(); - ResourceGroup resourceGroup = EnterpriseFacesContextUtility.getResourceGroup(); - ResourceType resourceType = resourceGroup.getResourceType(); - - ConfigurationDefinition configurationDefinition = null; - configurationDefinition = this.configurationManager.getPluginConfigurationDefinitionForResourceType(subject, - resourceType.getId()); - return configurationDefinition; - } - - @Nullable - protected Configuration lookupConfiguration() { - ResourceGroup compatibleGroup = EnterpriseFacesContextUtility.getResourceGroup(); - Configuration aggregateConfiguration = null; - - try { - aggregateConfiguration = configurationManager - .getAggregatePluginConfigurationForCompatibleGroup(compatibleGroup); - - if (aggregateConfiguration != null) { - ConfigurationMaskingUtility.maskConfiguration(aggregateConfiguration, this.configurationDefinition); - } - } catch (Exception e) { - // do nothing, let null bubble up so that this object finishes constructing itself - aggregateConfiguration = null; - } - - return aggregateConfiguration; - } - - public String editConfiguration() { - return SUCCESS_OUTCOME; - } - - public String getNullConfigurationDefinitionMessage() { - return "Cannot calculate an effective plugin configuration definition for this group."; - } - - public String getNullConfigurationMessage() { - return "Some Resource in this group does not have its plugin configuration initialized, " - + "or this group contains mixed Resource types when it should only contain one."; - } -} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyDetailsHeaderUIBeanjava"></a> <div class="delfile"><h4>Deleted: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsHeaderUIBean.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsHeaderUIBean.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsHeaderUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -1,50 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.inventory.group; - -import org.jetbrains.annotations.Nullable; -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.group.AggregatePluginConfigurationUpdate; -import org.rhq.core.gui.configuration.ConfigurationMaskingUtility; -import org.rhq.core.gui.util.FacesContextUtility; - -public class ViewGroupConnectionPropertyDetailsHeaderUIBean extends ViewGroupConnectionPropertiesUIBean { - public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertyDetailsHeaderUIBean"; - - @Nullable - @Override - protected Configuration lookupConfiguration() { - Configuration aggregateConfiguration = null; - - try { - int updateId = FacesContextUtility.getRequiredRequestParameter("apcuId", Integer.class); - AggregatePluginConfigurationUpdate update = configurationManager - .getAggregatePluginConfigurationById(updateId); - aggregateConfiguration = update.getConfiguration(); - - if (aggregateConfiguration != null) { - ConfigurationMaskingUtility.maskConfiguration(aggregateConfiguration, this.configurationDefinition); - } - } catch (IllegalArgumentException iae) { - // do nothing, let null bubble up so that this object finishes constructing itself - } - - return aggregateConfiguration; - } -} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyDetailsUIBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyDetailsUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -18,13 +18,18 @@ </span><span class="cx"> */ package org.rhq.enterprise.gui.inventory.group; </span><span class="add">+import java.util.Map; + </span><span class="cx"> import javax.faces.model.DataModel; import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite; </span><span class="add">+import org.rhq.core.domain.configuration.Configuration; </span><span class="cx"> import org.rhq.core.domain.resource.group.ResourceGroup; import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; </span><span class="add">+import org.rhq.core.domain.auth.Subject; </span><span class="cx"> import org.rhq.core.gui.util.FacesContextUtility; </span><span class="add">+import org.rhq.core.gui.configuration.propset.ConfigurationSet; </span><span class="cx"> import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean; import org.rhq.enterprise.gui.common.paging.PageControlView; import org.rhq.enterprise.gui.common.paging.PagedListDataModel; </span><span class="lines">@@ -34,9 +39,14 @@ </span><span class="cx"> public class ViewGroupConnectionPropertyDetailsUIBean extends PagedDataTableUIBean { public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertyDetailsUIBean"; </span><span class="add">+ public static final String VIEW_ID = "/rhq/group/inventory/view-plugin-configuration-update-details.xhtml"; </span><span class="cx"> private ResourceGroup resourceGroup; </span><span class="add">+ private Map<Integer, Configuration> pluginConfigurations; + private ConfigurationSet configurationSet; </span><span class="cx"> </span><span class="add">+ private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); + </span><span class="cx"> @Override public DataModel getDataModel() { if (dataModel == null) { </span><span class="lines">@@ -47,6 +57,24 @@ </span><span class="cx"> return dataModel; } </span><span class="add">+ public ConfigurationSet getConfigurationSet() { + if (this.configurationSet == null) { + Subject subject = EnterpriseFacesContextUtility.getSubject(); + ResourceGroup group = EnterpriseFacesContextUtility.getResourceGroup(); + int groupPluginConfigurationUpdateId = getPluginResourceConfigurationUpdateId(); + + this.pluginConfigurations = this.configurationManager + .getPluginConfigurationMapForAggregateUpdate(groupPluginConfigurationUpdateId); + this.configurationSet = GroupPluginConfigurationUtility.buildConfigurationSet(subject, group, + this.pluginConfigurations); + } + return configurationSet; + } + + private int getPluginResourceConfigurationUpdateId() { + return FacesContextUtility.getRequiredRequestParameter("apcuId", Integer.class); + } + </span><span class="cx"> private class ListGroupConnectionPropertyUpdateDetailsDataModel extends PagedListDataModel<ConfigurationUpdateComposite> { private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupConnectionPropertyHistoryUIBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyHistoryUIBean.java (3287 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyHistoryUIBean.java 2009-03-04 04:41:24 UTC (rev 3287) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupConnectionPropertyHistoryUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -30,12 +30,14 @@ </span><span class="cx"> import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean; import org.rhq.enterprise.gui.common.paging.PageControlView; import org.rhq.enterprise.gui.common.paging.PagedListDataModel; </span><span class="add">+import org.rhq.enterprise.gui.common.Outcomes; </span><span class="cx"> import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility; import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal; import org.rhq.enterprise.server.util.LookupUtil; public class ViewGroupConnectionPropertyHistoryUIBean extends PagedDataTableUIBean { public static final String MANAGED_BEAN_NAME = "ViewGroupConnectionPropertyHistoryUIBean"; </span><span class="add">+ public static final String VIEW_ID = "/rhq/group/inventory/connectionHistory.xhtml"; </span><span class="cx"> private ResourceGroup resourceGroup; private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager(); </span><span class="lines">@@ -44,7 +46,7 @@ </span><span class="cx"> return "viewHistory"; } </span><span class="rem">- public String deleteSelected() { </span><span class="add">+ public String deleteSelectedUpdates() { </span><span class="cx"> Subject subject = EnterpriseFacesContextUtility.getSubject(); ResourceGroup resourceGroup = EnterpriseFacesContextUtility.getResourceGroup(); </span><span class="lines">@@ -67,7 +69,7 @@ </span><span class="cx"> "Failed to delete selected group connection property updates.", e); } </span><span class="rem">- return "success"; </span><span class="add">+ return Outcomes.SUCCESS; </span><span class="cx"> } @Override </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupPluginConfigurationUIBeanjavafromrev3273rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiconfigurationgroupViewGroupResourceConfigurationUIBeanjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupPluginConfigurationUIBean.java (from rev 3273, rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/group/ViewGroupResourceConfigurationUIBean.java) (0 => 3288)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupPluginConfigurationUIBean.java (rev 0) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupPluginConfigurationUIBean.java 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -0,0 +1,58 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 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.inventory.group; + +import org.jboss.seam.ScopeType; +import org.jboss.seam.faces.Redirect; +import org.jboss.seam.annotations.Create; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.annotations.End; +import org.jboss.seam.annotations.In; + +/** + * A POJO Seam component that handles loading plugin configurations across a compatible Group in view-only mode. + * + * @author Ian Springer + */ +@Name("ViewGroupPluginConfigurationUIBean") +@Scope(ScopeType.EVENT) +public class ViewGroupPluginConfigurationUIBean extends AbstractGroupPluginConfigurationUIBean +{ + public static final String VIEW_ID = "/rhq/group/inventory/view-connection.xhtml"; + + @In(value = "org.jboss.seam.faces.redirect") + private Redirect redirect; + + @Create + public void init() { + loadConfigurations(); + return; + } + + /** + * Redirect to editCurrent.xhtml. This gets called when user clicks the EDIT button. + */ + @End + public void edit() { + this.redirect.setViewId(EditGroupPluginConfigurationUIBean.VIEW_ID); + this.redirect.execute(); + return; + } +} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiinventorygroupViewGroupPluginConfigurationUIBeanjava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ViewGroupPluginConfigurationUIBean.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans-resource-group/inventory-beans.xml </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans-resource-group/inventory-beans.xml 2009-03-04 04:41:24 UTC (rev 3287) </span><span class="add">+++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans-resource-group/inventory-beans.xml 2009-03-04 04:45:00 UTC (rev 3288) </span><span class="lines">@@ -21,18 +21,6 @@ </span><span class="cx"> </managed-bean> <managed-bean> </span><span class="rem">- <managed-bean-name>ViewGroupConnectionPropertiesUIBean</managed-bean-name> - <managed-bean-class>org.rhq.enterprise.gui.inventory.group.ViewGroupConnectionPropertiesUIBean</managed-bean-class> - <managed-bean-scope>request</managed-bean-scope> - </managed-bean> - - <managed-bean> - <managed-bean-name>ViewGroupConnectionPropertyDetailsHeaderUIBean</managed-bean-name> - ... [truncated message content] |