syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skylar...@apache.org
Subject syncope git commit: [SYNCOPE-1161] New option to clone a resource
Date Thu, 03 Aug 2017 13:04:57 GMT
Repository: syncope
Updated Branches:
  refs/heads/master e624f369d -> 0c2414c1a


[SYNCOPE-1161] New option to clone a resource


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

Branch: refs/heads/master
Commit: 0c2414c1ab7a700d83768dd95e7f6379ff2fa6b6
Parents: e624f36
Author: skylark17 <matteo.alessandroni@tirasa.net>
Authored: Thu Aug 3 14:16:43 2017 +0200
Committer: skylark17 <matteo.alessandroni@tirasa.net>
Committed: Thu Aug 3 15:04:28 2017 +0200

----------------------------------------------------------------------
 .../console/topology/TopologyTogglePanel.java   | 54 ++++++++++++++++++++
 .../SyncopeConsoleApplication.properties        |  1 +
 .../SyncopeConsoleApplication_it.properties     |  1 +
 .../SyncopeConsoleApplication_pt_BR.properties  |  1 +
 .../SyncopeConsoleApplication_ru.properties     |  1 +
 .../console/topology/TopologyTogglePanel.html   |  3 ++
 .../topology/TopologyTogglePanel.properties     |  1 +
 .../topology/TopologyTogglePanel_it.properties  |  1 +
 .../TopologyTogglePanel_pt_BR.properties        |  1 +
 .../topology/TopologyTogglePanel_ru.properties  |  1 +
 10 files changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
index ac55f7a..df1e273 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
@@ -40,9 +40,12 @@ import org.apache.syncope.client.console.tasks.PullTasks;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.IndicatingOnConfirmAjaxLink;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.resources.AbstractResourceWizardBuilder;
 import org.apache.syncope.client.console.wizards.resources.ResourceProvisionPanel;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
+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;
@@ -583,6 +586,57 @@ public class TopologyTogglePanel extends TogglePanel<Serializable>
{
         MetaDataRoleAuthorizationStrategy.authorize(history, RENDER, StandardEntitlement.RESOURCE_HISTORY_LIST);
         fragment.add(history);
 
+        // [SYNCOPE-1161] - Option to clone a resource
+        AjaxLink<String> clone = new IndicatingOnConfirmAjaxLink<String>("clone",
"confirmClone", true) {
+
+            private static final long serialVersionUID = -7978723352517770644L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                try {
+                    ResourceTO resource = resourceRestClient.read(node.getKey());
+                    resource.setKey("Copy of " + resource.getKey());
+                    // reset some resource objects keys
+                    if (resource.getOrgUnit() != null) {
+                        resource.getOrgUnit().setKey(null);
+                        for (ItemTO item : resource.getOrgUnit().getItems()) {
+                            item.setKey(null);
+                        }
+                    }
+                    for (ProvisionTO provision : resource.getProvisions()) {
+                        provision.setKey(null);
+                        if (provision.getMapping() != null) {
+                            for (ItemTO item : provision.getMapping().getItems()) {
+                                item.setKey(null);
+                            }
+                            provision.getMapping().getLinkingItems().clear();
+                        }
+                        provision.getVirSchemas().clear();
+                    }
+                    resourceRestClient.create(resource);
+
+                    // refresh Topology
+                    send(pageRef.getPage(), Broadcast.DEPTH, new AbstractResourceWizardBuilder.CreateEvent(
+                            resource.getKey(),
+                            resource.getKey(),
+                            TopologyNode.Kind.RESOURCE,
+                            resource.getConnector(),
+                            target));
+
+                    SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+                    toggle(target, false);
+                } catch (SyncopeClientException e) {
+                    LOG.error("While cloning resource {}", node.getKey(), e);
+                    SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+                            ? e.getClass().getName() : e.getMessage());
+                }
+                ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+            }
+
+        };
+        MetaDataRoleAuthorizationStrategy.authorize(clone, RENDER, StandardEntitlement.RESOURCE_CREATE);
+        fragment.add(clone);
+
         return fragment;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
index 56df013..59143bf 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
@@ -31,6 +31,7 @@ confirmUnlink=Do you really want to remove the link between the selected
item(s)
 confirmUnassign=Do you really want to remove the assignment between the selected item(s)
and the resource?
 confirmDeprovision=Do you really want to de-provision the selected item(s)?
 confirmProvision=Do you really want to provision the selected item(s)?
+confirmClone=Do you really want to clone the selected item(s)?
 
 dropDownChoiceField.nullValid=Choose one
 DateTimeField$HoursValidator=Hour value must be in range (1, 12)

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
index f039403..1f13919 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
@@ -31,6 +31,7 @@ confirmUnlink=Vuoi davvero procedere rimuovendo il link con la risorsa?
 confirmUnassign=Vuoi davvero procedere rimuovendo l'assegnamento sulla risorsa?
 confirmDeprovision=Vuoi davvero procedere con il de-provisioning?
 confirmProvision=Vuoi davvero procedere con il provisioning?
+confirmClone=Vuoi davvero procedere con la duplicazione?
 
 dropDownChoiceField.nullValid=Seleziona
 DateTimeField$HoursValidator=L'ora deve essere nell'intervallo (1,12)

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
index c746a66..b292d50 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
@@ -31,6 +31,7 @@ confirmUnlink=Voc\u00ea realmente deseja apagar o v\u00ednculo entre o item
e de
 confirmUnassign=Voc\u00ea realmente deseja apagar a atribui\u00e7\u00e3o entre o item e de
recursos?
 confirmDeprovision=Voc\u00ea realmente de-provision item?
 confirmProvision=Voc\u00ea realmente provision item?
+confirmClone=Voc\u00ea realmente deseja clonar este item(s) selecionado?
 
 dropDownChoiceField.nullValid=Escolha um
 DateTimeField$HoursValidator=O seu valor precisa estar entre (1, 12)

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
index ef6ea6e..62183d7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
@@ -31,6 +31,7 @@ confirmUnlink=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u043
 confirmUnassign=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e
\u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435
\u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445
\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432?
 confirmDeprovision=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e
\u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043e\u0437\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435
\u043e\u0431\u044a\u0435\u043a\u0442\u044b?
 confirmProvision=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e
\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c
\u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b?
+confirmClone=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e
\u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c
\u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b\u003f
 dropDownChoiceField.nullValid=\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435
 DateTimeField$HoursValidator=\u0427\u0430\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b
\u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435
(1, 12)
 error=\u041e\u0448\u0438\u0431\u043a\u0430

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.html
b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.html
index c596813..892ec31 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.html
@@ -72,6 +72,9 @@ under the License.
         <wicket:enclosure child="history">
           <li><a href="#" wicket:id="history"><i class="fa fa-history"></i><wicket:message
key="resource.menu.history"/></a></li>
         </wicket:enclosure>
+        <wicket:enclosure child="clone">
+          <li><a href="#" wicket:id="clone"><i class="fa fa-clone"></i><wicket:message
key="resource.menu.clone"/></a></li>
+        </wicket:enclosure>
         <wicket:enclosure child="delete">
           <li><a href="#" wicket:id="delete"><i class="fa fa-minus"></i><wicket:message
key="resource.menu.remove"/></a></li>
         </wicket:enclosure>

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
index 08c0e53..60e4c18 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
@@ -29,6 +29,7 @@ resource.menu.edit=Edit resource
 resource.menu.provision=Edit provision rules
 resource.menu.explore=Explore resource
 resource.menu.history=Configuration history
+resource.menu.clone=Clone resource
 
 task.custom.list=Custom tasks
 task.propagation.list=Propagation tasks {0}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_it.properties
index 1493852..dd16d75 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_it.properties
@@ -29,6 +29,7 @@ resource.menu.edit=Modifica risorsa
 resource.menu.provision=Modifica regole di provisioning
 resource.menu.explore=Esplora risorsa
 resource.menu.history=Storico delle configurazioni
+resource.menu.clone=Duplica risorsa
 
 task.custom.list=Task personalizzati
 task.propagation.list=Task di propagazione {0}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_pt_BR.properties
index d6f9756..ce3fa05 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_pt_BR.properties
@@ -29,6 +29,7 @@ resource.menu.edit=Alterar recurso
 resource.menu.provision=Alterar regras de provision
 resource.menu.explore=Explorar recurso
 resource.menu.history=Hist\u00f3rico de configura\u00e7\u00e3o
+resource.menu.clone=Clone recurso
 
 task.custom.list=Custom tasks
 task.propagation.list=Propagation tasks {0}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0c2414c1/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_ru.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_ru.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_ru.properties
index 1106c65..07b3b09 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel_ru.properties
@@ -30,6 +30,7 @@ resource.menu.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435
 resource.menu.provision=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430
\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f
 resource.menu.explore=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0440\u0435\u0441\u0443\u0440\u0441\u0430
 resource.menu.history=\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438
+resource.menu.clone=\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441
 
 task.custom.list=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435
\u0437\u0430\u0434\u0430\u0447\u0438
 task.propagation.list=\u0417\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f
\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 {0}


Mime
View raw message