You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/11/15 15:40:17 UTC

svn commit: r1409811 - /incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java

Author: ilgrosso
Date: Thu Nov 15 14:40:16 2012
New Revision: 1409811

URL: http://svn.apache.org/viewvc?rev=1409811&view=rev
Log:
Fixing an annoying (but harmless) stackatrace when creating root role(s)

Modified:
    incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java

Modified: incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java?rev=1409811&r1=1409810&r2=1409811&view=diff
==============================================================================
--- incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java (original)
+++ incubator/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java Thu Nov 15 14:40:16 2012
@@ -18,6 +18,9 @@
  */
 package org.apache.syncope.console.pages.panels;
 
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.console.rest.RoleRestClient;
+import org.apache.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.event.IEvent;
@@ -26,9 +29,6 @@ import org.apache.wicket.markup.html.pan
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.console.rest.RoleRestClient;
-import org.apache.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel;
 
 public class RoleSummaryPanel extends Panel {
 
@@ -56,21 +56,21 @@ public class RoleSummaryPanel extends Pa
         this.callerPageRef = callerPageRef;
         this.window = window;
 
-        fragment = new Fragment("rolePanel", this.selectedNode == null
+        fragment = new Fragment("rolePanel",
+                this.selectedNode == null
                 ? "fakerootFrag"
-                : (this.selectedNode.getId() != 0
-                        ? "roleViewPanel"
-                        : "rootPanel"), this);
+                : (this.selectedNode.getId() == 0 ? "rootPanel" : "roleViewPanel"),
+                this);
 
         if (this.selectedNode != null) {
-            if (this.selectedNode.getId() != 0) {
-                roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, window, callerPageRef);
-                roleTabPanel.setOutputMarkupId(true);
-                fragment.add(roleTabPanel);
-            } else {
+            if (this.selectedNode.getId() == 0) {
                 actionLink = new TreeActionLinkPanel("actionLink", this.selectedNode.getId(),
                         new CompoundPropertyModel(this.selectedNode), window, callerPageRef);
                 fragment.add(actionLink);
+            } else {
+                roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, window, callerPageRef);
+                roleTabPanel.setOutputMarkupId(true);
+                fragment.add(roleTabPanel);
             }
         }
 
@@ -86,25 +86,21 @@ public class RoleSummaryPanel extends Pa
         super.onEvent(event);
 
         if (event.getPayload() instanceof TreeNodeClickUpdate) {
-
             final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
 
-            this.selectedNode = restClient.readRole(update.getSelectedNodeId());
-
-            fragment = new Fragment("rolePanel", (update.getSelectedNodeId() != 0
-                    ? "roleViewPanel"
-                    : "rootPanel"), this);
+            fragment = new Fragment("rolePanel", (update.getSelectedNodeId() == 0
+                    ? "rootPanel" : "roleViewPanel"), this);
 
-            if (update.getSelectedNodeId() != 0) {
-
-                roleTabPanel = new RoleTabPanel("nodeViewPanel", this.selectedNode, window, callerPageRef);
-                roleTabPanel.setOutputMarkupId(true);
-                fragment.addOrReplace(roleTabPanel);
-            } else {
+            if (update.getSelectedNodeId() == 0) {
                 actionLink = new TreeActionLinkPanel("actionLink", update.getSelectedNodeId(),
                         new CompoundPropertyModel(this.selectedNode), window, callerPageRef);
                 actionLink.setOutputMarkupId(true);
                 fragment.addOrReplace(actionLink);
+            } else {
+                this.selectedNode = restClient.readRole(update.getSelectedNodeId());
+                roleTabPanel = new RoleTabPanel("nodeViewPanel", this.selectedNode, window, callerPageRef);
+                roleTabPanel.setOutputMarkupId(true);
+                fragment.addOrReplace(roleTabPanel);
             }
 
             replace(fragment);
@@ -124,7 +120,9 @@ public class RoleSummaryPanel extends Pa
             this.selectedNodeId = selectedNodeId;
         }
 
-        /** @return ajax request target */
+        /**
+         * @return ajax request target
+         */
         public AjaxRequestTarget getTarget() {
             return target;
         }