From: <jma...@rh...> - 2009-03-11 20:44:12
|
<!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] [3386] on second thought, let's throw an application-specific exception, then handle it appropriate at the managed bean layer; </title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3386</dd> <dt>Author</dt> <dd>jmarques</dd> <dt>Date</dt> <dd>2009-03-11 15:44:06 -0500 (Wed, 11 Mar 2009)</dd> </dl> <h3>Log Message</h3> <pre>on second thought, let's throw an application-specific exception, then handle it appropriate at the managed bean layer; </pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguidefinitiongroupGroupDefinitionUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupdefinitionGroupDefinitionManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupdefinitionGroupDefinitionManagerLocaljava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguidefinitiongroupGroupDefinitionUIBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionUIBean.java (3385 => 3386)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionUIBean.java 2009-03-11 20:38:50 UTC (rev 3385) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionUIBean.java 2009-03-11 20:44:06 UTC (rev 3386) </span><span class="lines">@@ -21,6 +21,8 @@ </span><span class="cx"> import javax.faces.application.FacesMessage; import javax.faces.model.DataModel; </span><span class="add">+import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; </span><span class="cx"> import org.jetbrains.annotations.NotNull; import org.rhq.core.domain.auth.Subject; </span><span class="lines">@@ -40,6 +42,8 @@ </span><span class="cx"> public class GroupDefinitionUIBean extends PagedDataTableUIBean { public static final String MANAGED_BEAN_NAME = "GroupDefinitionUIBean"; </span><span class="add">+ private static final Log log = LogFactory.getLog(GroupDefinitionUIBean.class); + </span><span class="cx"> private GroupDefinition groupDefinition; public GroupDefinitionUIBean() { </span><span class="lines">@@ -122,7 +126,14 @@ </span><span class="cx"> GroupDefinitionManagerLocal groupDefinitionManager = LookupUtil.getGroupDefinitionManager(); </span><span class="rem">- return groupDefinitionManager.getManagedResourceGroups(user, groupDefinitionId, pc); </span><span class="add">+ try { + return groupDefinitionManager.getManagedResourceGroups(user, groupDefinitionId, pc); + } catch (GroupDefinitionException gde) { + FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to retrieve managed groups: " + + gde.getMessage()); + log.error("Failed to retrieve managed groups", gde); + return new PageList<ResourceGroupComposite>(); + } </span><span class="cx"> } } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupdefinitionGroupDefinitionManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java (3385 => 3386)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java 2009-03-11 20:38:50 UTC (rev 3385) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java 2009-03-11 20:44:06 UTC (rev 3386) </span><span class="lines">@@ -433,7 +433,7 @@ </span><span class="cx"> @RequiredPermission(Permission.MANAGE_INVENTORY) public PageList<ResourceGroupComposite> getManagedResourceGroups(Subject subject, int groupDefinitionId, </span><span class="rem">- PageControl pc) { </span><span class="add">+ PageControl pc) throws GroupDefinitionException { </span><span class="cx"> pc.initDefaultOrderingField("rg.name"); Connection conn = null; </span><span class="lines">@@ -464,6 +464,8 @@ </span><span class="cx"> Object[] next = new Object[] { upCount, downCount, groupId }; rawResults.add(next); } </span><span class="add">+ } catch (Throwable t) { + throw new GroupDefinitionException(t); </span><span class="cx"> } finally { JDBCUtil.safeClose(conn, stmt, null); } </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupdefinitionGroupDefinitionManagerLocaljava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java (3385 => 3386)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java 2009-03-11 20:38:50 UTC (rev 3385) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java 2009-03-11 20:44:06 UTC (rev 3386) </span><span class="lines">@@ -29,6 +29,7 @@ </span><span class="cx"> import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionAlreadyExistsException; import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionCreateException; import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionDeleteException; </span><span class="add">+import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionException; </span><span class="cx"> import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionNotFoundException; import org.rhq.enterprise.server.resource.group.definition.exception.GroupDefinitionUpdateException; import org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator; </span><span class="lines">@@ -54,7 +55,8 @@ </span><span class="cx"> Integer calculateGroupMembership_helper(Subject subject, int groupDefinitionId, ExpressionEvaluator.Result result) throws GroupDefinitionNotFoundException, ResourceGroupUpdateException, GroupDefinitionNotFoundException; </span><span class="rem">- PageList<ResourceGroupComposite> getManagedResourceGroups(Subject subject, int groupDefinitionId, PageControl pc); </span><span class="add">+ PageList<ResourceGroupComposite> getManagedResourceGroups(Subject subject, int groupDefinitionId, PageControl pc) + throws GroupDefinitionException; </span><span class="cx"> PageList<GroupDefinition> getGroupDefinitions(Subject subject, PageControl pc); </span> </pre> </div> </div> </body> </html> |