syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject syncope git commit: [SYNCOPE-1027] improve provision mappings management from administration console
Date Tue, 28 Feb 2017 11:44:44 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 8e6c61b7d -> ad3445906


[SYNCOPE-1027] improve provision mappings management from administration console


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

Branch: refs/heads/2_0_X
Commit: ad34459063e2959e9aecd5a6f795839946c7cc89
Parents: 8e6c61b
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Tue Feb 28 12:43:10 2017 +0100
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Tue Feb 28 12:43:10 2017 +0100

----------------------------------------------------------------------
 .../resources/ProvisionWizardBuilder.java       | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ad344590/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
index 827c367..7e7f375 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.StringUtils;
@@ -241,8 +242,8 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO>
imple
         Mapping mapping = new Mapping(modelObject);
         mapping.setOutputMarkupId(true);
 
-        MappingItemTransformersTogglePanel mapItemTransformers =
-                new MappingItemTransformersTogglePanel(mapping, pageRef);
+        MappingItemTransformersTogglePanel mapItemTransformers
+                = new MappingItemTransformersTogglePanel(mapping, pageRef);
         addOuterObject(mapItemTransformers);
         JEXLTransformersTogglePanel jexlTransformers = new JEXLTransformersTogglePanel(mapping,
pageRef);
         addOuterObject(jexlTransformers);
@@ -257,9 +258,29 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO>
imple
 
     @Override
     protected Serializable onApplyInternal(final ProvisionTO modelObject) {
+        final List<ProvisionTO> provisions;
         if (modelObject.getKey() == null) {
-            this.resourceTO.getProvisions().add(modelObject);
+            provisions
+                    = ListUtils.select(this.resourceTO.getProvisions(), new Predicate<ProvisionTO>()
{
+
+                        @Override
+                        public boolean evaluate(final ProvisionTO object) {
+                            return !modelObject.getAnyType().equals(object.getAnyType());
+                        }
+                    });
+        } else {
+            provisions
+                    = ListUtils.select(this.resourceTO.getProvisions(), new Predicate<ProvisionTO>()
{
+
+                        @Override
+                        public boolean evaluate(final ProvisionTO object) {
+                            return !modelObject.getKey().equals(object.getKey());
+                        }
+                    });
         }
+        provisions.add(modelObject);
+        this.resourceTO.getProvisions().clear();
+        this.resourceTO.getProvisions().addAll(provisions);
         return modelObject;
     }
 }


Mime
View raw message