syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject syncope git commit: [SYNCOPE-807] Fixed
Date Wed, 06 Apr 2016 11:50:10 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 692e1f91c -> 0e89478de


[SYNCOPE-807] Fixed


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

Branch: refs/heads/master
Commit: 0e89478de51df598b10bfb22b93f173d6fe4ca2b
Parents: 692e1f9
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Apr 6 13:50:01 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Apr 6 13:50:01 2016 +0200

----------------------------------------------------------------------
 .../syncope/client/console/pages/Realms.java    |  11 +-
 .../client/console/panels/RealmChoicePanel.java |  19 +--
 .../client/console/panels/RealmDetails.java     |  74 ++++++++--
 .../console/panels/ResourceSecurityPanel.java   | 140 +++++++------------
 .../html/form/AjaxDropDownChoicePanel.java      |   3 +-
 .../wicket/markup/html/form/PolicyRenderer.java |  45 ++++++
 .../syncope/client/console/pages/Realms.html    |   3 -
 .../console/panels/RealmDetails.properties      |  19 +++
 .../console/panels/RealmDetails_it.properties   |  19 +++
 .../panels/RealmDetails_pt_BR.properties        |  19 +++
 .../console/panels/ResourceSecurityPanel.html   |   4 +-
 .../panels/ResourceSecurityPanel.properties     |   4 +-
 .../panels/ResourceSecurityPanel_it.properties  |   4 +-
 .../ResourceSecurityPanel_pt_BR.properties      |   4 +-
 .../html/form/AjaxDropDownChoicePanel.html      |   3 -
 .../java/data/RealmDataBinderImpl.java          |  25 ++--
 16 files changed, 258 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
index 2ee818f..0002d62 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
@@ -24,7 +24,7 @@ import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.Realm;
 import org.apache.syncope.client.console.panels.RealmModalPanel;
 import org.apache.syncope.client.console.panels.RealmChoicePanel;
-import org.apache.syncope.client.console.panels.RealmChoicePanel.ChoosenRealm;
+import org.apache.syncope.client.console.panels.RealmChoicePanel.ChosenRealm;
 import org.apache.syncope.client.console.rest.RealmRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.common.lib.to.RealmTO;
@@ -75,6 +75,7 @@ public class Realms extends BasePage {
             @Override
             public void onClose(final AjaxRequestTarget target) {
                 target.add(realmChoicePanel.reloadRealmTree(target));
+                target.add(content);
                 modal.show(false);
             }
         });
@@ -86,9 +87,9 @@ public class Realms extends BasePage {
     public void onEvent(final IEvent<?> event) {
         super.onEvent(event);
 
-        if (event.getPayload() instanceof ChoosenRealm) {
+        if (event.getPayload() instanceof ChosenRealm) {
             @SuppressWarnings("unchecked")
-            final ChoosenRealm<RealmTO> choosenRealm = ChoosenRealm.class.cast(event.getPayload());
+            final ChosenRealm<RealmTO> choosenRealm = ChosenRealm.class.cast(event.getPayload());
             updateRealmContent(choosenRealm.getObj());
             choosenRealm.getTarget().add(content);
         }
@@ -151,10 +152,10 @@ public class Realms extends BasePage {
                     realmRestClient.delete(realmTO.getFullPath());
                     RealmTO parent = realmChoicePanel.moveToParentRealm(realmTO.getKey());
                     target.add(realmChoicePanel.reloadRealmTree(target));
-                    
+
                     info(getString(Constants.OPERATION_SUCCEEDED));
                     updateRealmContent(parent);
-                    target.add(content);                  
+                    target.add(content);
                 } catch (Exception e) {
                     LOG.error("While deleting realm", e);
                     // Escape line breaks

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
index 0a33538..eed2a4e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
@@ -70,10 +70,10 @@ public class RealmChoicePanel extends Panel {
         this.pageRef = pageRef;
         tree = new HashMap<>();
 
-        final RealmTO def = new RealmTO();
-        def.setName("/");
-        def.setFullPath("/");
-        model = Model.of(def);
+        RealmTO fakeRootRealm = new RealmTO();
+        fakeRootRealm.setName("/");
+        fakeRootRealm.setFullPath("/");
+        model = Model.of(fakeRootRealm);
 
         ldm = new LoadableDetachableModel<List<Pair<String, RealmTO>>>()
{
 
@@ -96,8 +96,11 @@ public class RealmChoicePanel extends Panel {
 
             @Override
             protected List<Pair<String, RealmTO>> load() {
+                Map<Long, Pair<RealmTO, List<RealmTO>>> map = reloadRealmParentMap();
+                model.setObject(map.get(1L).getKey());
+
                 final List<Pair<String, RealmTO>> full = new ArrayList<>();
-                getChildren(full, 0L, reloadRealmParentMap(), StringUtils.EMPTY);
+                getChildren(full, 0L, map, StringUtils.EMPTY);
                 return full;
             }
         };
@@ -138,7 +141,7 @@ public class RealmChoicePanel extends Panel {
                             model.setObject(realmTO);
                             label.setDefaultModelObject(model.getObject().getFullPath());
                             target.add(label);
-                            send(pageRef.getPage(), Broadcast.EXACT, new ChoosenRealm<>(realmTO,
target));
+                            send(pageRef.getPage(), Broadcast.EXACT, new ChosenRealm<>(realmTO,
target));
                         }
                     });
                 }
@@ -232,13 +235,13 @@ public class RealmChoicePanel extends Panel {
         return null;
     }
 
-    public static class ChoosenRealm<T> {
+    public static class ChosenRealm<T> {
 
         private final AjaxRequestTarget target;
 
         private final T obj;
 
-        public ChoosenRealm(final T obj, final AjaxRequestTarget target) {
+        public ChosenRealm(final T obj, final AjaxRequestTarget target) {
             this.obj = obj;
             this.target = target;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
index c27b6cb..4958f9e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
@@ -18,14 +18,26 @@
  */
 package org.apache.syncope.client.console.panels;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.panel.Fragment;
 import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,6 +47,36 @@ public class RealmDetails extends Panel {
 
     protected static final Logger LOG = LoggerFactory.getLogger(RealmDetails.class);
 
+    private final PolicyRestClient policyRestClient = new PolicyRestClient();
+
+    private final IModel<Map<Long, String>> accountPolicies = new LoadableDetachableModel<Map<Long,
String>>() {
+
+        private static final long serialVersionUID = -2012833443695917883L;
+
+        @Override
+        protected Map<Long, String> load() {
+            Map<Long, String> res = new HashMap<>();
+            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT))
{
+                res.put(policyTO.getKey(), policyTO.getDescription());
+            }
+            return res;
+        }
+    };
+
+    private final IModel<Map<Long, String>> passwordPolicies = new LoadableDetachableModel<Map<Long,
String>>() {
+
+        private static final long serialVersionUID = -2012833443695917883L;
+
+        @Override
+        protected Map<Long, String> load() {
+            Map<Long, String> res = new HashMap<>();
+            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD))
{
+                res.put(policyTO.getKey(), policyTO.getDescription());
+            }
+            return res;
+        }
+    };
+
     private final WebMarkupContainer container;
 
     public RealmDetails(final String id, final RealmTO realmTO) {
@@ -42,30 +84,46 @@ public class RealmDetails extends Panel {
     }
 
     public RealmDetails(
-            final String id, final RealmTO realmTO, final ActionLinksPanel<?> actions,
final boolean unwraped) {
+            final String id,
+            final RealmTO realmTO,
+            final ActionLinksPanel<?> actions,
+            final boolean unwrapped) {
+
         super(id);
 
         container = new WebMarkupContainer("container");
         container.setOutputMarkupId(true);
-        container.setRenderBodyOnly(unwraped);
+        container.setRenderBodyOnly(unwrapped);
         add(container);
 
-        final FieldPanel<String> name = new AjaxTextFieldPanel(
+        FieldPanel<String> name = new AjaxTextFieldPanel(
                 "name", "name", new PropertyModel<String>(realmTO, "name"), false);
         name.addRequiredLabel();
         container.add(name);
 
-        final FieldPanel<String> fullPath = new AjaxTextFieldPanel(
+        FieldPanel<String> fullPath = new AjaxTextFieldPanel(
                 "fullPath", "fullPath", new PropertyModel<String>(realmTO, "fullPath"),
false);
         fullPath.setEnabled(false);
         container.add(fullPath);
 
-        final FieldPanel<String> accountPolicy = new AjaxTextFieldPanel(
-                "accountPolicy", "accountPolicy", new PropertyModel<String>(realmTO,
"accountPolicy"), false);
+        AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<>(
+                "accountPolicy",
+                new ResourceModel("accountPolicy", "accountPolicy").getObject(),
+                new PropertyModel<Long>(realmTO, "accountPolicy"),
+                false);
+        accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
+        accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
+        ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
         container.add(accountPolicy);
 
-        final FieldPanel<String> passwordPolicy = new AjaxTextFieldPanel(
-                "passwordPolicy", "passwordPolicy", new PropertyModel<String>(realmTO,
"passwordPolicy"), false);
+        AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<>(
+                "passwordPolicy",
+                new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
+                new PropertyModel<Long>(realmTO, "passwordPolicy"),
+                false);
+        passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
+        passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
+        ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
         container.add(passwordPolicy);
 
         if (actions == null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
index ad56e9e..25e22ce 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
@@ -23,11 +23,11 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer;
 import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
@@ -41,139 +41,97 @@ public class ResourceSecurityPanel extends Panel {
 
     private final PolicyRestClient policyRestClient = new PolicyRestClient();
 
-    private IModel<Map<Long, String>> passwordPolicies = null;
+    private final IModel<Map<Long, String>> passwordPolicies = new LoadableDetachableModel<Map<Long,
String>>() {
 
-    private IModel<Map<Long, String>> accountPolicies = null;
+        private static final long serialVersionUID = 5275935387613157437L;
 
-    private IModel<Map<Long, String>> pullPolicies = null;
-
-    public ResourceSecurityPanel(final String id, final IModel<ResourceTO> model) {
-
-        super(id);
-
-        final WebMarkupContainer container = new WebMarkupContainer("container");
-        container.setOutputMarkupId(true);
-        container.setRenderBodyOnly(true);
-        add(container);
-
-        setOutputMarkupId(true);
+        @Override
+        protected Map<Long, String> load() {
+            Map<Long, String> res = new HashMap<>();
+            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD))
{
+                res.put(policyTO.getKey(), policyTO.getDescription());
+            }
+            return res;
+        }
+    };
 
-        passwordPolicies = new LoadableDetachableModel<Map<Long, String>>() {
+    private final IModel<Map<Long, String>> accountPolicies = new LoadableDetachableModel<Map<Long,
String>>() {
 
-            private static final long serialVersionUID = 5275935387613157437L;
+        private static final long serialVersionUID = -2012833443695917883L;
 
-            @Override
-            protected Map<Long, String> load() {
-                Map<Long, String> res = new HashMap<>();
-                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD))
{
-                    res.put(policyTO.getKey(), policyTO.getDescription());
-                }
-                return res;
+        @Override
+        protected Map<Long, String> load() {
+            Map<Long, String> res = new HashMap<>();
+            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT))
{
+                res.put(policyTO.getKey(), policyTO.getDescription());
             }
-        };
+            return res;
+        }
+    };
 
-        accountPolicies = new LoadableDetachableModel<Map<Long, String>>() {
+    private final IModel<Map<Long, String>> pullPolicies = new LoadableDetachableModel<Map<Long,
String>>() {
 
-            private static final long serialVersionUID = -2012833443695917883L;
+        private static final long serialVersionUID = -2012833443695917883L;
 
-            @Override
-            protected Map<Long, String> load() {
-                Map<Long, String> res = new HashMap<>();
-                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT))
{
-                    res.put(policyTO.getKey(), policyTO.getDescription());
-                }
-                return res;
+        @Override
+        protected Map<Long, String> load() {
+            Map<Long, String> res = new HashMap<>();
+            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PULL))
{
+                res.put(policyTO.getKey(), policyTO.getDescription());
             }
-        };
-
-        pullPolicies = new LoadableDetachableModel<Map<Long, String>>() {
+            return res;
+        }
+    };
 
-            private static final long serialVersionUID = -2012833443695917883L;
+    public ResourceSecurityPanel(final String id, final IModel<ResourceTO> model) {
+        super(id);
+        setOutputMarkupId(true);
 
-            @Override
-            protected Map<Long, String> load() {
-                Map<Long, String> res = new HashMap<>();
-                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PULL))
{
-                    res.put(policyTO.getKey(), policyTO.getDescription());
-                }
-                return res;
-            }
-        };
+        final WebMarkupContainer container = new WebMarkupContainer("container");
+        container.setOutputMarkupId(true);
+        container.setRenderBodyOnly(true);
+        add(container);
 
         // -------------------------------
-        // Password policy specification
+        // Password policy selection
         // -------------------------------
-        final AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<Long>(
+        AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<>(
                 "passwordPolicy",
                 new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
                 new PropertyModel<Long>(model, "passwordPolicy"),
                 false);
-
-        passwordPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PASSWORD));
+        passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
         passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
         ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
         container.add(passwordPolicy);
         // -------------------------------
 
         // -------------------------------
-        // Account policy specification
+        // Account policy selection
         // -------------------------------
-        final AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<Long>(
+        AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<>(
                 "accountPolicy",
                 new ResourceModel("accountPolicy", "accountPolicy").getObject(),
                 new PropertyModel<Long>(model, "accountPolicy"),
                 false);
-
-        accountPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.ACCOUNT));
-        accountPolicy.setChoices(new ArrayList<Long>(accountPolicies.getObject().keySet()));
+        accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
+        accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
         ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
         container.add(accountPolicy);
         // -------------------------------
 
         // -------------------------------
-        // Pull policy specification
+        // Pull policy selection
         // -------------------------------
         AjaxDropDownChoicePanel<Long> pullPolicy = new AjaxDropDownChoicePanel<>(
                 "pullPolicy",
                 new ResourceModel("pullPolicy", "pullPolicy").getObject(),
                 new PropertyModel<Long>(model, "pullPolicy"),
                 false);
-
-        pullPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PULL));
-        pullPolicy.setChoices(new ArrayList<Long>(pullPolicies.getObject().keySet()));
+        pullPolicy.setChoiceRenderer(new PolicyRenderer(pullPolicies));
+        pullPolicy.setChoices(new ArrayList<>(pullPolicies.getObject().keySet()));
         ((DropDownChoice<?>) pullPolicy.getField()).setNullValid(true);
         container.add(pullPolicy);
         // -------------------------------
     }
-
-    private class PolicyRenderer extends ChoiceRenderer<Long> {
-
-        private static final long serialVersionUID = 8060500161321947000L;
-
-        private final PolicyType type;
-
-        PolicyRenderer(final PolicyType type) {
-            super();
-            this.type = type;
-        }
-
-        @Override
-        public Object getDisplayValue(final Long object) {
-            switch (type) {
-                case ACCOUNT:
-                    return accountPolicies.getObject().get(object);
-                case PASSWORD:
-                    return passwordPolicies.getObject().get(object);
-                case PULL:
-                    return pullPolicies.getObject().get(object);
-                default:
-                    return "";
-            }
-        }
-
-        @Override
-        public String getIdValue(final Long object, final int index) {
-            return String.valueOf(object != null ? object : 0L);
-        }
-    };
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
index 0ca72be..f08684f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
@@ -46,7 +46,6 @@ public class AjaxDropDownChoicePanel<T extends Serializable> extends
FieldPanel<
 
         field = new BootstrapSelect<>(
                 "dropDownChoiceField", model, Collections.<T>emptyList(), new ChoiceRenderer<T>());
-
         add(field.setLabel(new Model<>(name)).setOutputMarkupId(true));
 
         if (enableOnBlur) {
@@ -84,7 +83,7 @@ public class AjaxDropDownChoicePanel<T extends Serializable> extends
FieldPanel<
         BootstrapSelect.class.cast(field).setNullValid(validity);
         return this;
     }
-    
+
     @Override
     @SuppressWarnings("unchecked")
     public FieldPanel<T> clone() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
new file mode 100644
index 0000000..a3fdbb0
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.wicket.markup.html.form;
+
+import java.util.Map;
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
+import org.apache.wicket.model.IModel;
+
+public class PolicyRenderer extends ChoiceRenderer<Long> {
+
+    private static final long serialVersionUID = 8060500161321947000L;
+
+    private final IModel<Map<Long, String>> policies;
+
+    public PolicyRenderer(final IModel<Map<Long, String>> policies) {
+        super();
+        this.policies = policies;
+    }
+
+    @Override
+    public Object getDisplayValue(final Long object) {
+        return policies.getObject().get(object);
+    }
+
+    @Override
+    public String getIdValue(final Long object, final int index) {
+        return String.valueOf(object != null ? object : 0L);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
index 3588eb5..649c884 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Realms.html
@@ -18,9 +18,6 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
   <wicket:extend>
-    <script lang="text/javascript">
-
-    </script>
     <section class="content-header">
       <h1>&nbsp;</h1>
       <ol class="breadcrumb">

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
new file mode 100644
index 0000000..a5e8d78
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+fullPath=Path
+accountPolicy=Account Policy
+passwordPolicy=Password Policy

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
new file mode 100644
index 0000000..0b97cf9
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_it.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+fullPath=Percorso
+accountPolicy=Account Policy
+passwordPolicy=Password Policy

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
new file mode 100644
index 0000000..5d68eda
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/RealmDetails_pt_BR.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+fullPath=Caminho
+accountPolicy=Pol\u00edtica de Conta
+passwordPolicy=Pol\u00edtica de Senha

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.html
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.html
index f39d19e..5177e26 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.html
@@ -19,10 +19,10 @@ under the License.
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
   <wicket:panel>
     <div wicket:id="container" class="summarize">
-      <span wicket:id="passwordPolicy">
+      <span wicket:id="accountPolicy">
         [panel for dynamic input type markup]
       </span>
-      <span wicket:id="accountPolicy">
+      <span wicket:id="passwordPolicy">
         [panel for dynamic input type markup]
       </span>
       <span wicket:id="pullPolicy">

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.properties
index 279e499..0d2d9c4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel.properties
@@ -14,6 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-passwordPolicy = Password Policy
-accountPolicy = Account Policy
+passwordPolicy=Password Policy
+accountPolicy=Account Policy
 pullPolicy=Pull Policy

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_it.properties
index 279e499..0d2d9c4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_it.properties
@@ -14,6 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-passwordPolicy = Password Policy
-accountPolicy = Account Policy
+passwordPolicy=Password Policy
+accountPolicy=Account Policy
 pullPolicy=Pull Policy

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_pt_BR.properties
index 4c774d5..48e925f 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceSecurityPanel_pt_BR.properties
@@ -14,6 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-passwordPolicy = Pol\u00edtica de Senha
-accountPolicy = Pol\u00edtica de Conta
+passwordPolicy=Pol\u00edtica de Senha
+accountPolicy=Pol\u00edtica de Conta
 pullPolicy=Pol\u00edtica de Pull

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.html
b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.html
index b9af868..c4b3da7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.html
@@ -17,9 +17,6 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-  <head>
-    <title>Drop down choice</title>
-  </head>
   <wicket:extend>
     <wicket:enclosure child="field-label">
       <label wicket:id="field-label">[LABEL]</label><span wicket:id="required"/>

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e89478d/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
index 7771f06..70e7877 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -134,24 +134,29 @@ public class RealmDataBinderImpl implements RealmDataBinder {
         realm.setName(realmTO.getName());
         realm.setParent(realmTO.getParent() == 0 ? null : realmDAO.find(realmTO.getParent()));
 
-        if (realmTO.getPasswordPolicy() != null) {
-            Policy policy = policyDAO.find(realmTO.getPasswordPolicy());
-            if (policy instanceof PasswordPolicy) {
-                realm.setPasswordPolicy((PasswordPolicy) policy);
+        if (realmTO.getAccountPolicy() == null) {
+            realm.setAccountPolicy(null);
+        } else {
+            Policy policy = policyDAO.find(realmTO.getAccountPolicy());
+            if (policy instanceof AccountPolicy) {
+                realm.setAccountPolicy((AccountPolicy) policy);
             } else {
                 SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPolicy);
-                sce.getElements().add("Expected " + PasswordPolicy.class.getSimpleName()
+                sce.getElements().add("Expected " + AccountPolicy.class.getSimpleName()
                         + ", found " + policy.getClass().getSimpleName());
                 throw sce;
             }
         }
-        if (realmTO.getAccountPolicy() != null) {
-            Policy policy = policyDAO.find(realmTO.getAccountPolicy());
-            if (policy instanceof AccountPolicy) {
-                realm.setAccountPolicy((AccountPolicy) policy);
+
+        if (realmTO.getPasswordPolicy() == null) {
+            realm.setPasswordPolicy(null);
+        } else {
+            Policy policy = policyDAO.find(realmTO.getPasswordPolicy());
+            if (policy instanceof PasswordPolicy) {
+                realm.setPasswordPolicy((PasswordPolicy) policy);
             } else {
                 SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPolicy);
-                sce.getElements().add("Expected " + AccountPolicy.class.getSimpleName()
+                sce.getElements().add("Expected " + PasswordPolicy.class.getSimpleName()
                         + ", found " + policy.getClass().getSimpleName());
                 throw sce;
             }


Mime
View raw message