[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ò <ilgro...@apache.org>
Authored: Tue Sep 5 10:02:09 2017 +0200
Committer: Francesco Chicchiriccò <ilgro...@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;
             }
         };
     }

Reply via email to