syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/3] syncope git commit: [SYNCOPE-1346] Ensure PropagationTask is not already in the JPA context before creating new one
Date Fri, 27 Jul 2018 07:40:22 GMT
[SYNCOPE-1346] Ensure PropagationTask is not already in the JPA context before creating new
one


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

Branch: refs/heads/2_0_X
Commit: b0d75aedfb1e1fe5fa42aa3408a269fa4302739e
Parents: 2672157
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Jul 27 09:39:43 2018 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Jul 27 09:40:06 2018 +0200

----------------------------------------------------------------------
 .../apache/syncope/core/logic/TaskLogic.java    |  2 +-
 .../AbstractPropagationTaskExecutor.java        | 23 ++++++++++++--------
 2 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b0d75aed/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index ce1b9cc..6d2edbf 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -234,7 +234,7 @@ public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
         ExecTO result = null;
         switch (taskUtil.getType()) {
             case PROPAGATION:
-                TaskExec propExec = taskExecutor.execute((PropagationTaskTO) binder.getTaskTO(task,
taskUtil, false));
+                TaskExec propExec = taskExecutor.execute(binder.<PropagationTaskTO>getTaskTO(task,
taskUtil, false));
                 result = binder.getExecTO(propExec);
                 break;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/b0d75aed/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 3c45321..178b19d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -366,15 +366,20 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
     }
 
     protected TaskExec execute(final PropagationTaskTO taskTO, final PropagationReporter
reporter) {
-        PropagationTask task = entityFactory.newEntity(PropagationTask.class);
-        task.setResource(resourceDAO.find(taskTO.getResource()));
-        task.setObjectClassName(taskTO.getObjectClassName());
-        task.setAnyTypeKind(taskTO.getAnyTypeKind());
-        task.setAnyType(taskTO.getAnyType());
-        task.setEntityKey(taskTO.getEntityKey());
-        task.setOperation(taskTO.getOperation());
-        task.setConnObjectKey(taskTO.getConnObjectKey());
-        task.setOldConnObjectKey(taskTO.getOldConnObjectKey());
+        PropagationTask task;
+        if (taskTO.getKey() == null) {
+            task = entityFactory.newEntity(PropagationTask.class);
+            task.setResource(resourceDAO.find(taskTO.getResource()));
+            task.setObjectClassName(taskTO.getObjectClassName());
+            task.setAnyTypeKind(taskTO.getAnyTypeKind());
+            task.setAnyType(taskTO.getAnyType());
+            task.setEntityKey(taskTO.getEntityKey());
+            task.setOperation(taskTO.getOperation());
+            task.setConnObjectKey(taskTO.getConnObjectKey());
+            task.setOldConnObjectKey(taskTO.getOldConnObjectKey());
+        } else {
+            task = taskDAO.find(taskTO.getKey());
+        }
         Set<Attribute> attributes = new HashSet<>();
         if (StringUtils.isNotBlank(taskTO.getAttributes())) {
             attributes.addAll(Arrays.asList(POJOHelper.deserialize(taskTO.getAttributes(),
Attribute[].class)));


Mime
View raw message