Repository: syncope
Updated Branches:
  refs/heads/master 64129fcab -> 191a91dc1


[SYNCOPE-156] group owner management completed


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/191a91dc
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/191a91dc
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/191a91dc

Branch: refs/heads/master
Commit: 191a91dc11cafd866d250bffceab5c1e257b9666
Parents: 64129fc
Author: fmartelli <fabio.marte...@gmail.com>
Authored: Thu Dec 17 10:30:20 2015 +0100
Committer: fmartelli <fabio.marte...@gmail.com>
Committed: Thu Dec 17 10:30:20 2015 +0100

----------------------------------------------------------------------
 .../client/console/wizards/any/Ownership.java   | 25 +++++++++++++-------
 .../META-INF/resources/css/syncopeConsole.css   |  2 +-
 2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/191a91dc/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
index c7881a5..11c2469 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
@@ -21,6 +21,8 @@ package org.apache.syncope.client.console.wizards.any;
 import 
de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggle;
 import 
de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggleConfig;
 import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.search.GroupSearchPanel;
@@ -58,6 +60,8 @@ public class Ownership extends WizardStep {
 
     private static final long serialVersionUID = 855618618337931784L;
 
+    private final Pattern owner = Pattern.compile("\\[\\(\\d+\\)\\] .*");
+
     private final GroupHandler handler;
 
     private final WebMarkupContainer ownerContainer;
@@ -103,11 +107,6 @@ public class Ownership extends WizardStep {
             public Boolean getObject() {
                 return isGroupOwnership.getObject();
             }
-
-            @Override
-            public void setObject(final Boolean object) {
-
-            }
         }, config) {
 
             private static final long serialVersionUID = 1L;
@@ -197,7 +196,8 @@ public class Ownership extends WizardStep {
                         if (groupHandler.getInnerObject().getUserOwner() == 
null) {
                             return StringUtils.EMPTY;
                         } else {
-                            return 
String.valueOf(groupHandler.getInnerObject().getUserOwner());
+                            UserTO userTO = 
userRestClient.read(groupHandler.getInnerObject().getUserOwner());
+                            return String.format("[%d] %s", userTO.getKey(), 
userTO.getUsername());
                         }
                     }
 
@@ -206,7 +206,10 @@ public class Ownership extends WizardStep {
                         if (StringUtils.isBlank(object)) {
                             groupHandler.getInnerObject().setUserOwner(null);
                         } else {
-                            
groupHandler.getInnerObject().setUserOwner(Long.parseLong(object));
+                            final Matcher matcher = owner.matcher(object);
+                            if (matcher.matches()) {
+                                
groupHandler.getInnerObject().setUserOwner(Long.parseLong(matcher.group(1)));
+                            }
                         }
                     }
                 }, false);
@@ -237,7 +240,8 @@ public class Ownership extends WizardStep {
                         if (groupHandler.getInnerObject().getGroupOwner() == 
null) {
                             return StringUtils.EMPTY;
                         } else {
-                            return 
String.valueOf(groupHandler.getInnerObject().getGroupOwner());
+                            GroupTO groupTO = 
groupRestClient.read(groupHandler.getInnerObject().getGroupOwner());
+                            return String.format("[%d] %s", groupTO.getKey(), 
groupTO.getName());
                         }
                     }
 
@@ -246,7 +250,10 @@ public class Ownership extends WizardStep {
                         if (StringUtils.isBlank(object)) {
                             groupHandler.getInnerObject().setGroupOwner(null);
                         } else {
-                            
groupHandler.getInnerObject().setGroupOwner(Long.parseLong(object));
+                            final Matcher matcher = owner.matcher(object);
+                            if (matcher.matches()) {
+                                
groupHandler.getInnerObject().setGroupOwner(Long.parseLong(matcher.group(1)));
+                            }
                         }
                     }
                 }, false);

http://git-wip-us.apache.org/repos/asf/syncope/blob/191a91dc/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css 
b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
index 36874d0..17863dc 100644
--- 
a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
+++ 
b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
@@ -339,7 +339,7 @@ END - Style for Information panel
 }
 
 div.searchResult{
-  margin-top: 30px;
+  padding-top: 30px;
   display: block;
   clear: both;
 }

Reply via email to