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 2018/06/25 08:39:58 UTC

[1/2] syncope git commit: SYNCOPE-1303: fix content migration from 1.2 to 2.0.9-SNAPSHOT

Repository: syncope
Updated Branches:
  refs/heads/2_0_X 129006d85 -> 270a327d4
  refs/heads/master d7d06bc08 -> 909af6808


SYNCOPE-1303: fix content migration from 1.2 to 2.0.9-SNAPSHOT


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

Branch: refs/heads/2_0_X
Commit: 270a327d4322766ad115cc94c1ccda458354024e
Parents: 129006d
Author: lorenzo <lo...@tirasa.net>
Authored: Mon Jun 25 10:22:25 2018 +0200
Committer: lorenzo <lo...@tirasa.net>
Committed: Mon Jun 25 10:22:25 2018 +0200

----------------------------------------------------------------------
 .../cli/commands/migrate/MigrateConf.java       | 29 ++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/270a327d/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
index 85b60df..8b4884d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
@@ -344,6 +344,15 @@ public class MigrateConf {
                                 writer.writeAttribute("id", lastUUID);
                                 writer.writeAttribute(
                                         "description", getAttributeValue(reader, "description"));
+                                String specificationAttr = getAttributeValue(reader, "specification");
+                                if (StringUtils.isNotBlank(specificationAttr)) {
+                                    ObjectNode templateRead = (ObjectNode) OBJECT_MAPPER.readTree(specificationAttr);
+                                    JsonNode conflictResolutionAction = templateRead.get("conflictResolutionAction");
+                                    ObjectNode templateWrite = OBJECT_MAPPER.createObjectNode();
+                                    templateWrite.set("conflictResolutionAction", conflictResolutionAction);
+                                    writer.writeAttribute(
+                                            "specification", OBJECT_MAPPER.writeValueAsString(templateWrite));
+                                }
                                 writer.writeEndElement();
                                 break;
 
@@ -668,8 +677,16 @@ public class MigrateConf {
                                 String userTemplate = getAttributeValue(reader, "userTemplate");
                                 if (StringUtils.isNotBlank(userTemplate)) {
                                     ObjectNode template = (ObjectNode) OBJECT_MAPPER.readTree(userTemplate);
-                                    JsonNode plainAttrs = template.remove("attrs");
+                                    JsonNode plainAttrs = template.remove("attributes");
                                     template.set("plainAttrs", plainAttrs);
+                                    template.remove("id");
+                                    template.set("key", null);
+                                    template.remove("readonly");
+                                    JsonNode derAttrs = template.remove("derivedAttributes");
+                                    template.set("derAttrs", derAttrs);
+                                    JsonNode virAttrs = template.remove("virtualAttributes");
+                                    template.set("virAttrs", virAttrs);
+                                    template.remove("propagationStatuses");
 
                                     writer.writeStartElement("AnyTemplatePullTask");
                                     writer.writeAttribute("id", UUID.randomUUID().toString());
@@ -681,8 +698,16 @@ public class MigrateConf {
                                 String roleTemplate = getAttributeValue(reader, "roleTemplate");
                                 if (StringUtils.isNotBlank(roleTemplate)) {
                                     ObjectNode template = (ObjectNode) OBJECT_MAPPER.readTree(roleTemplate);
-                                    JsonNode plainAttrs = template.remove("attrs");
+                                    JsonNode plainAttrs = template.remove("attributes");
                                     template.set("plainAttrs", plainAttrs);
+                                    template.remove("id");
+                                    template.set("key", null);
+                                    template.remove("readonly");
+                                    JsonNode derAttrs = template.remove("derivedAttributes");
+                                    template.set("derAttrs", derAttrs);
+                                    JsonNode virAttrs = template.remove("virtualAttributes");
+                                    template.set("virAttrs", virAttrs);
+                                    template.remove("propagationStatuses");
 
                                     writer.writeStartElement("AnyTemplatePullTask");
                                     writer.writeAttribute("id", UUID.randomUUID().toString());


[2/2] syncope git commit: SYNCOPE-1303: fix content migration from 1.2 to 2.0.9-SNAPSHOT - This closes #78

Posted by il...@apache.org.
SYNCOPE-1303: fix content migration from 1.2 to 2.0.9-SNAPSHOT - This closes #78


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

Branch: refs/heads/master
Commit: 909af68081e1efdfc04fd19e1a298cb621477e08
Parents: d7d06bc
Author: lorenzo <lo...@tirasa.net>
Authored: Mon Jun 25 10:22:25 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Jun 25 10:39:39 2018 +0200

----------------------------------------------------------------------
 .../cli/commands/migrate/MigrateConf.java       | 29 ++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/909af680/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
index 85b60df..8b4884d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/migrate/MigrateConf.java
@@ -344,6 +344,15 @@ public class MigrateConf {
                                 writer.writeAttribute("id", lastUUID);
                                 writer.writeAttribute(
                                         "description", getAttributeValue(reader, "description"));
+                                String specificationAttr = getAttributeValue(reader, "specification");
+                                if (StringUtils.isNotBlank(specificationAttr)) {
+                                    ObjectNode templateRead = (ObjectNode) OBJECT_MAPPER.readTree(specificationAttr);
+                                    JsonNode conflictResolutionAction = templateRead.get("conflictResolutionAction");
+                                    ObjectNode templateWrite = OBJECT_MAPPER.createObjectNode();
+                                    templateWrite.set("conflictResolutionAction", conflictResolutionAction);
+                                    writer.writeAttribute(
+                                            "specification", OBJECT_MAPPER.writeValueAsString(templateWrite));
+                                }
                                 writer.writeEndElement();
                                 break;
 
@@ -668,8 +677,16 @@ public class MigrateConf {
                                 String userTemplate = getAttributeValue(reader, "userTemplate");
                                 if (StringUtils.isNotBlank(userTemplate)) {
                                     ObjectNode template = (ObjectNode) OBJECT_MAPPER.readTree(userTemplate);
-                                    JsonNode plainAttrs = template.remove("attrs");
+                                    JsonNode plainAttrs = template.remove("attributes");
                                     template.set("plainAttrs", plainAttrs);
+                                    template.remove("id");
+                                    template.set("key", null);
+                                    template.remove("readonly");
+                                    JsonNode derAttrs = template.remove("derivedAttributes");
+                                    template.set("derAttrs", derAttrs);
+                                    JsonNode virAttrs = template.remove("virtualAttributes");
+                                    template.set("virAttrs", virAttrs);
+                                    template.remove("propagationStatuses");
 
                                     writer.writeStartElement("AnyTemplatePullTask");
                                     writer.writeAttribute("id", UUID.randomUUID().toString());
@@ -681,8 +698,16 @@ public class MigrateConf {
                                 String roleTemplate = getAttributeValue(reader, "roleTemplate");
                                 if (StringUtils.isNotBlank(roleTemplate)) {
                                     ObjectNode template = (ObjectNode) OBJECT_MAPPER.readTree(roleTemplate);
-                                    JsonNode plainAttrs = template.remove("attrs");
+                                    JsonNode plainAttrs = template.remove("attributes");
                                     template.set("plainAttrs", plainAttrs);
+                                    template.remove("id");
+                                    template.set("key", null);
+                                    template.remove("readonly");
+                                    JsonNode derAttrs = template.remove("derivedAttributes");
+                                    template.set("derAttrs", derAttrs);
+                                    JsonNode virAttrs = template.remove("virtualAttributes");
+                                    template.set("virAttrs", virAttrs);
+                                    template.remove("propagationStatuses");
 
                                     writer.writeStartElement("AnyTemplatePullTask");
                                     writer.writeAttribute("id", UUID.randomUUID().toString());