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 2017/09/05 08:04:41 UTC

[1/2] syncope git commit: [SYNCOPE-1203] Now considering realms too

Repository: syncope
Updated Branches:
  refs/heads/2_0_X 838edcc2b -> 047c510c4
  refs/heads/master df4bd83c9 -> faba42e2f


[SYNCOPE-1203] Now considering realms too


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

Branch: refs/heads/2_0_X
Commit: 047c510c46751752b8813531e61efa311be01494
Parents: 838edcc
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Sep 5 10:02:09 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Sep 5 10:02:09 2017 +0200

----------------------------------------------------------------------
 .../resources/ResourceProvisionPanel.java       | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/047c510c/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
index f9fea37..69d321e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
@@ -23,12 +23,10 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.IteratorUtils;
 import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.collections4.Predicate;
-import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
@@ -338,23 +336,19 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
 
             @Override
             protected List<String> load() {
-                final List<String> currentlyAdded = new ArrayList<>();
-
-                CollectionUtils.collect(resourceTO.getProvisions(), new Transformer<ProvisionTO, String>() {
-
-                    @Override
-                    public String transform(final ProvisionTO provisionTO) {
-                        return provisionTO.getAnyType();
-                    }
-                }, currentlyAdded);
-
-                return ListUtils.select(new AnyTypeRestClient().list(), new Predicate<String>() {
+                List<String> anyTypes = ListUtils.select(new AnyTypeRestClient().list(), new Predicate<String>() {
 
                     @Override
                     public boolean evaluate(final String key) {
-                        return !currentlyAdded.contains(key);
+                        return resourceTO.getProvision(key) == null;
                     }
                 });
+                if (resourceTO.getOrgUnit() == null) {
+                    anyTypes.add(SyncopeConstants.REALM_ANYTYPE);
+                }
+
+                Collections.sort(anyTypes, new AnyTypeRestClient.AnyTypeKeyComparator());
+                return anyTypes;
             }
         };
     }


[2/2] syncope git commit: [SYNCOPE-1203] Now considering realms too

Posted by il...@apache.org.
[SYNCOPE-1203] Now considering realms too


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

Branch: refs/heads/master
Commit: faba42e2ff3fb725bd05205e5c8b22930e8af7a1
Parents: df4bd83
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Sep 5 10:02:09 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Sep 5 10:04:33 2017 +0200

----------------------------------------------------------------------
 .../wizards/resources/ResourceProvisionPanel.java    | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/faba42e2/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
index ac7ccc3..194bd5a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
@@ -40,7 +40,6 @@ import org.apache.syncope.client.console.wizards.WizardMgtPanel;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.ItemTO;
-import org.apache.syncope.common.lib.to.ProvisionTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.PageReference;
@@ -316,13 +315,15 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
 
             @Override
             protected List<String> load() {
-                final List<String> currentlyAdded = new ArrayList<>();
-
-                currentlyAdded.addAll(resourceTO.getProvisions().stream().
-                        map(ProvisionTO::getAnyType).collect(Collectors.toList()));
+                List<String> anyTypes = new AnyTypeRestClient().list().stream().
+                        filter(anyType -> !resourceTO.getProvision(anyType).isPresent()).
+                        collect(Collectors.toList());
+                if (resourceTO.getOrgUnit() == null) {
+                    anyTypes.add(SyncopeConstants.REALM_ANYTYPE);
+                }
 
-                return new AnyTypeRestClient().list().stream().
-                        filter(anyType -> !currentlyAdded.contains(anyType)).collect(Collectors.toList());
+                Collections.sort(anyTypes, new AnyTypeRestClient.AnyTypeKeyComparator());
+                return anyTypes;
             }
         };
     }