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/01/23 15:56:41 UTC

[2/2] syncope git commit: [SYNCOPE-1000] Now finding the right localized message

[SYNCOPE-1000] Now finding the right localized message


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

Branch: refs/heads/master
Commit: 7899b4d9cced869450c0c69e85249b7710e718c5
Parents: 5852032
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Mon Jan 23 16:56:18 2017 +0100
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Mon Jan 23 16:56:32 2017 +0100

----------------------------------------------------------------------
 .../resources/ProvisionWizardBuilder.java       |   4 +-
 .../resources/ResourceProvisionPanel.java       | 160 +++++++++----------
 .../resources/ResourceProvisionPanel.properties |   2 +-
 .../ResourceProvisionPanel_it.properties        |   2 +-
 .../ResourceProvisionPanel_pt_BR.properties     |   2 +-
 .../ResourceProvisionPanel_ru.properties        |   6 +-
 6 files changed, 86 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/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 8466c56..827c367 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
@@ -241,8 +241,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);

http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/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 dd6c7de..fbe4907 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
@@ -179,14 +179,14 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
                         ? null
                         : IteratorUtils.find(list.iterator(), new Predicate<ProvisionTO>() {
 
-                    @Override
-                    public boolean evaluate(final ProvisionTO in) {
-                        return ((item.getKey() == null && in.getKey() == null)
-                                || (in.getKey() != null && in.getKey().equals(item.getKey())))
-                                && ((item.getAnyType() == null && in.getAnyType() == null)
-                                || (in.getAnyType() != null && in.getAnyType().equals(item.getAnyType())));
-                    }
-                });
+                            @Override
+                            public boolean evaluate(final ProvisionTO in) {
+                                return ((item.getKey() == null && in.getKey() == null)
+                                        || (in.getKey() != null && in.getKey().equals(item.getKey())))
+                                        && ((item.getAnyType() == null && in.getAnyType() == null)
+                                        || (in.getAnyType() != null && in.getAnyType().equals(item.getAnyType())));
+                            }
+                        });
             }
 
             @Override
@@ -209,82 +209,82 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
         builder.
                 addAction(new ActionLink<ProvisionTO>() {
 
-            private static final long serialVersionUID = -3722207913631435504L;
+                    private static final long serialVersionUID = -3722207913631435504L;
 
-            @Override
-            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
-                send(ResourceProvisionPanel.this, Broadcast.DEPTH,
-                        new AjaxWizard.NewItemActionEvent<>(provisionTO, 2, target).setResourceModel(
-                        new StringResourceModel("inner.provision.mapping",
-                        ResourceProvisionPanel.this,
-                        Model.of(provisionTO))));
-            }
-        }, ActionLink.ActionType.MAPPING, StandardEntitlement.RESOURCE_UPDATE).
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
+                        send(ResourceProvisionPanel.this, Broadcast.DEPTH,
+                                new AjaxWizard.NewItemActionEvent<>(provisionTO, 2, target).setResourceModel(
+                                        new StringResourceModel("inner.provision.mapping",
+                                                ResourceProvisionPanel.this,
+                                                Model.of(provisionTO))));
+                    }
+                }, ActionLink.ActionType.MAPPING, StandardEntitlement.RESOURCE_UPDATE).
                 addAction(new ActionLink<ProvisionTO>() {
 
-            private static final long serialVersionUID = -7780999687733432439L;
+                    private static final long serialVersionUID = -7780999687733432439L;
 
-            @Override
-            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
-                try {
-                    SyncopeConsoleSession.get().getService(ResourceService.class).
-                            setLatestSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
-                    SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
-                } catch (Exception e) {
-                    LOG.error("While setting latest sync token for {}/{}",
-                            resourceTO.getKey(), provisionTO.getAnyType(), e);
-                    SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
-                            getName() : e.getMessage());
-                }
-                ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
-            }
-        }, ActionLink.ActionType.SET_LATEST_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE).
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
+                        try {
+                            SyncopeConsoleSession.get().getService(ResourceService.class).
+                                    setLatestSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
+                            SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+                        } catch (Exception e) {
+                            LOG.error("While setting latest sync token for {}/{}",
+                                    resourceTO.getKey(), provisionTO.getAnyType(), e);
+                            SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+                                    getName() : e.getMessage());
+                        }
+                        ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+                    }
+                }, ActionLink.ActionType.SET_LATEST_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE).
                 addAction(new ActionLink<ProvisionTO>() {
 
-            private static final long serialVersionUID = -7780999687733432439L;
+                    private static final long serialVersionUID = -7780999687733432439L;
 
-            @Override
-            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
-                try {
-                    SyncopeConsoleSession.get().getService(ResourceService.class).
-                            removeSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
-                    SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
-                } catch (Exception e) {
-                    LOG.error("While removing sync token for {}/{}",
-                            resourceTO.getKey(), provisionTO.getAnyType(), e);
-                    SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
-                            getName() : e.getMessage());
-                }
-                ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
-            }
-        }, ActionLink.ActionType.REMOVE_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE).
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
+                        try {
+                            SyncopeConsoleSession.get().getService(ResourceService.class).
+                                    removeSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
+                            SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+                        } catch (Exception e) {
+                            LOG.error("While removing sync token for {}/{}",
+                                    resourceTO.getKey(), provisionTO.getAnyType(), e);
+                            SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+                                    getName() : e.getMessage());
+                        }
+                        ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+                    }
+                }, ActionLink.ActionType.REMOVE_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE).
                 addAction(new ActionLink<ProvisionTO>() {
 
-            private static final long serialVersionUID = -3722207913631435534L;
+                    private static final long serialVersionUID = -3722207913631435534L;
 
-            @Override
-            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
-                final ProvisionTO clone = SerializationUtils.clone(provisionTO);
-                clone.setKey(null);
-                clone.setAnyType(null);
-                clone.setObjectClass(null);
-                send(ResourceProvisionPanel.this, Broadcast.DEPTH,
-                        new AjaxWizard.NewItemActionEvent<>(clone, target).setResourceModel(
-                        new StringResourceModel("inner.provision.clone",
-                        ResourceProvisionPanel.this,
-                        Model.of(provisionTO))));
-            }
-        }, ActionLink.ActionType.CLONE, StandardEntitlement.RESOURCE_CREATE).
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
+                        final ProvisionTO clone = SerializationUtils.clone(provisionTO);
+                        clone.setKey(null);
+                        clone.setAnyType(null);
+                        clone.setObjectClass(null);
+                        send(ResourceProvisionPanel.this, Broadcast.DEPTH,
+                                new AjaxWizard.NewItemActionEvent<>(clone, target).setResourceModel(
+                                        new StringResourceModel("inner.provision.clone",
+                                                ResourceProvisionPanel.this,
+                                                Model.of(provisionTO))));
+                    }
+                }, ActionLink.ActionType.CLONE, StandardEntitlement.RESOURCE_CREATE).
                 addAction(new ActionLink<ProvisionTO>() {
 
-            private static final long serialVersionUID = -3722207913631435544L;
+                    private static final long serialVersionUID = -3722207913631435544L;
 
-            @Override
-            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
-                resourceTO.getProvisions().remove(provisionTO);
-                send(ResourceProvisionPanel.this, Broadcast.DEPTH, new ListViewReload<>(target));
-            }
-        }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_DELETE);
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
+                        resourceTO.getProvisions().remove(provisionTO);
+                        send(ResourceProvisionPanel.this, Broadcast.DEPTH, new ListViewReload<>(target));
+                    }
+                }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_DELETE);
 
         builder.addNewItemPanelBuilder(wizard);
 
@@ -295,8 +295,6 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
     @Override
     public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
         try {
-            boolean connObjectKeyError = false;
-
             final Collection<ProvisionTO> provisions = new ArrayList<>(resourceTO.getProvisions());
 
             for (ProvisionTO provision : provisions) {
@@ -304,7 +302,7 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
                     if (provision.getMapping() == null || provision.getMapping().getItems().isEmpty()) {
                         resourceTO.getProvisions().remove(provision);
                     } else {
-                        long uConnObjectKeyCount = IterableUtils.countMatches(
+                        long connObjectKeyCount = IterableUtils.countMatches(
                                 provision.getMapping().getItems(), new Predicate<MappingItemTO>() {
 
                             @Override
@@ -313,18 +311,16 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {
                             }
                         });
 
-                        connObjectKeyError = uConnObjectKeyCount != 1;
+                        if (connObjectKeyCount != 1) {
+                            throw new RuntimeException(provision.getAnyType() + ": "
+                                    + new StringResourceModel("connObjectKeyValidation", ResourceProvisionPanel.this).
+                                            getString());
+                        }
                     }
                 }
             }
 
-            final ResourceTO res;
-            if (connObjectKeyError) {
-                throw new RuntimeException(new StringResourceModel("connObjectKeyValidation").getString());
-            } else {
-                new ResourceRestClient().update(resourceTO);
-                res = resourceTO;
-            }
+            new ResourceRestClient().update(resourceTO);
             SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
             modal.close(target);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.properties
index 267c1c8..862627a 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.properties
@@ -33,7 +33,7 @@ intAttrName=Internal attribute
 enforceMandatoryCondition=Enforce mandatory condition
 fieldName=Field name
 
-connObjectKeyValidation=There must be exactly one AccountId
+connObjectKeyValidation=There must be exactly one Remote Key
 propagationMode=Propagation mode
 connObjectLink=Object Link
 enable=Enable

http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_it.properties
index fe7aff5..f388910 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_it.properties
@@ -33,7 +33,7 @@ intAttrName=Attributo interno
 enforceMandatoryCondition=Abilita mandatory condition
 fieldName=Nome campo
 
-connObjectKeyValidation=Deve essere definito esattamente un AccountId
+connObjectKeyValidation=Deve essere definito esattamente una Chiave remota
 propagationMode=Modalit\u00e0 di propagazione
 connObjectLink=ID Remoto
 enable=Abilita

http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_pt_BR.properties
index 66c2d70..856a378 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_pt_BR.properties
@@ -33,7 +33,7 @@ intAttrName=Atributo interno
 enforceMandatoryCondition=Aplicar condi\u00e7\u00e3o obrigat\u00f3ria
 fieldName=Nome do Campo
 
-connObjectKeyValidation=Precisa ser exatamente um Identificador de Conta
+connObjectKeyValidation=Precisa ser exatamente um Remote Key
 propagationMode=Modo de propaga\u00e7\u00e3o
 connObjectLink=Remote ID
 enable=Habilitado

http://git-wip-us.apache.org/repos/asf/syncope/blob/7899b4d9/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_ru.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_ru.properties
index dfc734b..142ff17 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel_ru.properties
@@ -19,12 +19,12 @@ anyType=\u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430
 objectClass=\u041a\u043b\u0430\u0441\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430
 __ACCOUNT__=\u0423\u0427\u0415\u0422\u041d\u0410\u042f \u0417\u0410\u041f\u0418\u0421\u042c
 __GROUP__=\u0413\u0420\u0423\u041f\u041f\u0410
-auxClasses=\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b
+auxClasses=\u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447
 
 extAttrName=\u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b
 entity=\u041e\u0431\u044a\u0435\u043a\u0442
 groupSchema=\u0410\u0442\u0440\u0438\u0431\u0443\u0442 \u0433\u0440\u0443\u043f\u043f\u044b
-connObjectKey=\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u0430
+connObjectKey=\u0414\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447
 transformers=\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432
 mandatoryCondition=\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439
 password=\u041f\u0430\u0440\u043e\u043b\u044c
@@ -34,7 +34,7 @@ intAttrName=\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0430\
 enforceMandatoryCondition=\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 (\u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e)
 fieldName=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f
 
-connObjectKeyValidation=\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d
+connObjectKeyValidation=\u0422\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430
 propagationMode=\u0420\u0435\u0436\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439
 connObjectLink=\u0421\u0432\u044f\u0437\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432
 enable=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c