syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1426176 - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/to/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope/console/pages/panels/ console/src/main/java/org/apache/syncope...
Date Thu, 27 Dec 2012 12:10:46 GMT
Author: ilgrosso
Date: Thu Dec 27 12:10:46 2012
New Revision: 1426176

URL: http://svn.apache.org/viewvc?rev=1426176&view=rev
Log:
[SYNCOPE-172] Now showing role propagation status after CRUD

Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/client/to/ConnObjectTO.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/to/ConnObjectTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/to/ConnObjectTO.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/to/ConnObjectTO.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/to/ConnObjectTO.java Thu
Dec 27 12:10:46 2012
@@ -23,8 +23,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.codehaus.jackson.annotate.JsonIgnore;
 import org.apache.syncope.client.AbstractBaseBean;
+import org.codehaus.jackson.annotate.JsonIgnore;
 
 public class ConnObjectTO extends AbstractBaseBean {
 
@@ -59,13 +59,13 @@ public class ConnObjectTO extends Abstra
         Map<String, AttributeTO> result;
 
         if (attributes == null) {
-            result = Collections.emptyMap();
+            result = Collections.<String, AttributeTO>emptyMap();
         } else {
             result = new HashMap<String, AttributeTO>(attributes.size());
             for (AttributeTO attributeTO : attributes) {
                 result.put(attributeTO.getSchema(), attributeTO);
             }
-            result = Collections.unmodifiableMap(result);
+            result = Collections.<String, AttributeTO>unmodifiableMap(result);
         }
 
         return result;

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
Thu Dec 27 12:10:46 2012
@@ -231,6 +231,11 @@ public class ResultStatusModalPage exten
         attributes.addAll(beforeAttrMap.keySet());
         attributes.addAll(afterAttrMap.keySet());
 
+        if (!(attributable instanceof UserTO)) {
+            attributes.remove("__PASSWORD__");
+            attributes.remove("__ENABLE__");
+        }
+
         final List<String> profile = new ArrayList<String>();
         profile.addAll(attributes);
         profile.removeAll(head);

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java Thu Dec
27 12:10:46 2012
@@ -18,6 +18,13 @@
  */
 package org.apache.syncope.console.pages;
 
+import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.pages.panels.AbstractSearchResultPanel;
+import org.apache.syncope.console.pages.panels.AbstractSearchResultPanel.EventDataWrapper;
+import org.apache.syncope.console.pages.panels.UserSearchPanel;
+import org.apache.syncope.console.pages.panels.UserSearchResultPanel;
+import org.apache.syncope.console.rest.UserRestClient;
 import org.apache.wicket.Page;
 import org.apache.wicket.Session;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -30,13 +37,6 @@ import org.apache.wicket.extensions.ajax
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.syncope.client.search.NodeCond;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.pages.panels.AbstractSearchResultPanel;
-import org.apache.syncope.console.pages.panels.AbstractSearchResultPanel.EventDataWrapper;
-import org.apache.syncope.console.pages.panels.UserSearchPanel;
-import org.apache.syncope.console.pages.panels.UserSearchResultPanel;
-import org.apache.syncope.console.rest.UserRestClient;
 import org.apache.wicket.spring.injection.annot.SpringBean;
 
 public class Users extends BasePage {

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
Thu Dec 27 12:10:46 2012
@@ -19,6 +19,7 @@
 package org.apache.syncope.console.pages.panels;
 
 import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.console.rest.RoleRestClient;
 import org.apache.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel;
 import org.apache.wicket.PageReference;
@@ -27,39 +28,56 @@ import org.apache.wicket.markup.html.pan
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RoleSummaryPanel extends Panel {
 
     private static final long serialVersionUID = 643769814985593156L;
 
+    /**
+     * Logger.
+     */
+    private static final Logger LOG = LoggerFactory.getLogger(RoleSummaryPanel.class);
+
     @SpringBean
     private RoleRestClient restClient;
 
     private RoleTO selectedNode;
 
-    private Fragment fragment;
+    private final Fragment fragment;
 
     private RoleTabPanel roleTabPanel;
 
     private TreeActionLinkPanel actionLink;
 
-    private PageReference callerPageRef;
+    private final PageReference callerPageRef;
 
-    private ModalWindow window;
+    private final ModalWindow window;
 
     public RoleSummaryPanel(final String id, final ModalWindow window, final PageReference
callerPageRef) {
         this(id, window, callerPageRef, null);
     }
 
     public RoleSummaryPanel(final String id, final ModalWindow window, final PageReference
callerPageRef,
-            final Long selectedNodeId) {
+            Long selectedNodeId) {
 
         super(id);
 
         this.callerPageRef = callerPageRef;
         this.window = window;
 
-        this.selectedNode = selectedNodeId != null && selectedNodeId != 0 ? restClient.read(selectedNodeId)
: null;
+        if (selectedNodeId == null || selectedNodeId == 0) {
+            this.selectedNode = null;
+        } else {
+            try {
+                this.selectedNode = restClient.read(selectedNodeId);
+            } catch (SyncopeClientCompositeErrorException e) {
+                LOG.error("Could not read {}", selectedNodeId, e);
+                this.selectedNode = null;
+                selectedNodeId = null;
+            }
+        }
 
         fragment = new Fragment("roleSummaryPanel", selectedNodeId == null ? "fakerootFrag"
                 : (selectedNodeId == 0 ? "rootPanel" : "roleViewPanel"), this);

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
Thu Dec 27 12:10:46 2012
@@ -21,7 +21,6 @@ package org.apache.syncope.console.pages
 import org.apache.syncope.client.search.MembershipCond;
 import org.apache.syncope.client.search.NodeCond;
 import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.console.commons.XMLRolesReader;
 import org.apache.syncope.console.rest.UserRestClient;
 import org.apache.syncope.console.wicket.markup.html.tree.TreeActionLinkPanel;
 import org.apache.wicket.PageReference;
@@ -41,9 +40,6 @@ public class RoleTabPanel extends Panel 
     private static final long serialVersionUID = 859236186975983959L;
 
     @SpringBean
-    private XMLRolesReader xmlRolesReader;
-
-    @SpringBean
     private UserRestClient restClient;
 
     public RoleTabPanel(final String id, final RoleTO roleTO, final ModalWindow window,

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java
Thu Dec 27 12:10:46 2012
@@ -79,15 +79,8 @@ public class RoleRestClient extends Abst
     }
 
     public RoleTO read(final Long id) {
-        RoleTO roleTO = null;
-
-        try {
-            roleTO = SyncopeSession.get().getRestTemplate().getForObject(
-                    baseURL + "role/read/{roleId}.json", RoleTO.class, id);
-        } catch (SyncopeClientCompositeErrorException e) {
-            LOG.error("While reading a role", e);
-        }
-        return roleTO;
+        return SyncopeSession.get().getRestTemplate().getForObject(
+                baseURL + "role/read/{roleId}.json", RoleTO.class, id);
     }
 
     public RoleTO update(final RoleMod roleMod) {

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java?rev=1426176&r1=1426175&r2=1426176&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
Thu Dec 27 12:10:46 2012
@@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.syncope.client.to.RoleTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.console.commons.XMLRolesReader;
+import org.apache.syncope.console.pages.ResultStatusModalPage;
 import org.apache.syncope.console.pages.RoleModalPage;
 import org.apache.syncope.console.pages.Roles;
 import org.apache.syncope.console.rest.RoleRestClient;
@@ -67,7 +68,7 @@ public class TreeActionLinkPanel extends
         fragment = new Fragment("menuPanel", idRole == 0
                 ? "fakerootFrag"
                 : "roleFrag", this);
-        
+
         fragment.setOutputMarkupId(true);
 
         final AjaxLink createRoleLink = new IndicatingAjaxLink("createRoleLink") {
@@ -102,6 +103,8 @@ public class TreeActionLinkPanel extends
         if (idRole != 0) {
             final AjaxLink updateRoleLink = new IndicatingAjaxLink("updateRoleLink") {
 
+                private static final long serialVersionUID = -7978723352517770644L;
+
                 @Override
                 public void onClick(final AjaxRequestTarget target) {
                     window.setPageCreator(new ModalWindow.PageCreator() {
@@ -128,17 +131,30 @@ public class TreeActionLinkPanel extends
 
             final AjaxLink dropRoleLink = new IndicatingDeleteOnConfirmAjaxLink("dropRoleLink")
{
 
+                private static final long serialVersionUID = -7978723352517770644L;
+
                 @Override
                 public void onClick(final AjaxRequestTarget target) {
                     try {
-                        restClient.delete(idRole);
-                        getSession().info(getString("operation_succeded"));
-                    } catch (SyncopeClientCompositeErrorException e) {
-                        LOG.error("While deleting role " + idRole, e);
-                        getSession().error(getString("operation_error"));
-                    }
+                        final RoleTO roleTO = (RoleTO) restClient.delete(idRole);
+
+                        ((Roles) callerPageRef.getPage()).setModalResult(true);
 
-                    setResponsePage(new Roles(null));
+                        window.setPageCreator(new ModalWindow.PageCreator() {
+
+                            private static final long serialVersionUID = -7834632442532690940L;
+
+                            @Override
+                            public Page createPage() {
+                                return new ResultStatusModalPage(window, roleTO);
+                            }
+                        });
+
+                        window.show(target);
+                    } catch (SyncopeClientCompositeErrorException scce) {
+                        error(getString("operation_error") + ": " + scce.getMessage());
+                        target.add(((Roles) callerPageRef.getPage()).getFeedbackPanel());
+                    }
                 }
             };
 



Mime
View raw message