syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1602430 [2/2] - in /syncope/trunk: common/src/main/java/org/apache/syncope/common/to/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope/console/pages/panels/ console/src/main/resources/org/apa...
Date Fri, 13 Jun 2014 13:59:00 GMT
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
Fri Jun 13 13:58:59 2014
@@ -42,7 +42,6 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.beans.TaskExec;
 import org.apache.syncope.core.persistence.dao.TaskDAO;
 import org.apache.syncope.core.propagation.ConnectorFactory;
-import org.apache.syncope.core.propagation.DefaultPropagationActions;
 import org.apache.syncope.core.propagation.PropagationActions;
 import org.apache.syncope.core.propagation.PropagationReporter;
 import org.apache.syncope.core.propagation.PropagationTaskExecutor;
@@ -116,24 +115,21 @@ public abstract class AbstractPropagatio
         return execute(task, null);
     }
 
-    protected PropagationActions getPropagationActions(final ExternalResource resource) {
-        PropagationActions result = null;
+    protected List<PropagationActions> getPropagationActions(final ExternalResource
resource) {
+        List<PropagationActions> result = new ArrayList<PropagationActions>();
 
-        if (StringUtils.isNotBlank(resource.getPropagationActionsClassName())) {
-            try {
-                Class<?> actionsClass = Class.forName(resource.getPropagationActionsClassName());
-                result = (PropagationActions) ApplicationContextProvider.getBeanFactory().
-                        createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE,
true);
-            } catch (ClassNotFoundException e) {
-                LOG.error("Invalid PropagationAction class name '{}' for resource {}",
-                        resource, resource.getPropagationActionsClassName(), e);
+        if (!resource.getPropagationActionsClassNames().isEmpty()) {
+            for (String className : resource.getPropagationActionsClassNames()) {
+                try {
+                    Class<?> actionsClass = Class.forName(className);
+                    result.add((PropagationActions) ApplicationContextProvider.getBeanFactory().
+                            createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE,
true));
+                } catch (ClassNotFoundException e) {
+                    LOG.error("Invalid PropagationAction class name '{}' for resource {}",
resource, className, e);
+                }
             }
         }
 
-        if (result == null) {
-            result = new DefaultPropagationActions();
-        }
-
         return result;
     }
 
@@ -327,7 +323,7 @@ public abstract class AbstractPropagatio
 
     @Override
     public TaskExec execute(final PropagationTask task, final PropagationReporter reporter)
{
-        final PropagationActions actions = getPropagationActions(task.getResource());
+        final List<PropagationActions> actions = getPropagationActions(task.getResource());
 
         final Date startDate = new Date();
 
@@ -351,7 +347,9 @@ public abstract class AbstractPropagatio
             // Try to read remote object (user / group) BEFORE any actual operation
             beforeObj = getRemoteObject(task, connector, false);
 
-            actions.before(task, beforeObj);
+            for (PropagationActions action : actions) {
+                action.before(task, beforeObj);
+            }
 
             switch (task.getPropagationOperation()) {
                 case CREATE:
@@ -440,7 +438,9 @@ public abstract class AbstractPropagatio
             }
         }
 
-        actions.after(task, execution, afterObj);
+        for (PropagationActions action : actions) {
+            action.after(task, execution, afterObj);
+        }
 
         notificationManager.createTasks(
                 AuditElements.EventCategoryType.PROPAGATION,
@@ -531,7 +531,7 @@ public abstract class AbstractPropagatio
                     new ObjectClass(task.getObjectClassName()),
                     new Uid(accountId),
                     connector.getOperationOptions(AttributableUtil.getInstance(task.getSubjectType()).
-                    getMappingItems(task.getResource(), MappingPurpose.PROPAGATION)));
+                            getMappingItems(task.getResource(), MappingPurpose.PROPAGATION)));
         } catch (TimeoutException toe) {
             LOG.debug("Request timeout", toe);
             throw toe;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java
Fri Jun 13 13:58:59 2014
@@ -104,10 +104,10 @@ public class PriorityPropagationTaskExec
         public int compare(final PropagationTask task1, final PropagationTask task2) {
             int prop1 = task1.getResource().getPropagationPriority() == null
                     ? Integer.MIN_VALUE
-                    : task1.getResource().getPropagationPriority().intValue();
+                    : task1.getResource().getPropagationPriority();
             int prop2 = task2.getResource().getPropagationPriority() == null
                     ? Integer.MIN_VALUE
-                    : task2.getResource().getPropagationPriority().intValue();
+                    : task2.getResource().getPropagationPriority();
 
             return prop1 > prop2
                     ? 1

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
Fri Jun 13 13:58:59 2014
@@ -141,7 +141,8 @@ public class ResourceDataBinder {
             resource.setRserializedSyncToken(null);
         }
 
-        resource.setPropagationActionsClassName(resourceTO.getPropagationActionsClassName());
+        resource.getPropagationActionsClassNames().clear();
+        resource.getPropagationActionsClassNames().addAll(resourceTO.getPropagationActionsClassNames());
 
         return resource;
     }
@@ -337,7 +338,7 @@ public class ResourceDataBinder {
         resourceTO.setUsyncToken(resource.getUserializedSyncToken());
         resourceTO.setRsyncToken(resource.getRserializedSyncToken());
 
-        resourceTO.setPropagationActionsClassName(resource.getPropagationActionsClassName());
+        resourceTO.getPropagationActionsClassNames().addAll(resource.getPropagationActionsClassNames());
 
         return resourceTO;
     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/TaskDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/TaskDataBinder.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/TaskDataBinder.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/TaskDataBinder.java
Fri Jun 13 13:58:59 2014
@@ -68,7 +68,7 @@ public class TaskDataBinder {
      */
     private static final Logger LOG = LoggerFactory.getLogger(TaskDataBinder.class);
 
-    private static final String[] IGNORE_TASK_PROPERTIES = { "executions", "resource", };
+    private static final String[] IGNORE_TASK_PROPERTIES = { "executions", "resource" };
 
     private static final String[] IGNORE_TASK_EXECUTION_PROPERTIES = { "id", "task" };
 
@@ -113,12 +113,14 @@ public class TaskDataBinder {
             if (syncTaskTO.getUserTemplate() != null) {
                 UserTO template = syncTaskTO.getUserTemplate();
 
-                if (StringUtils.isNotBlank(template.getUsername()) && !JexlUtil.
-                        isExpressionValid(template.getUsername())) {
+                if (StringUtils.isNotBlank(template.getUsername())
+                        && !JexlUtil.isExpressionValid(template.getUsername())) {
+
                     sce.getElements().add("Invalid JEXL: " + template.getUsername());
                 }
-                if (StringUtils.isNotBlank(template.getPassword()) && !JexlUtil.
-                        isExpressionValid(template.getPassword())) {
+                if (StringUtils.isNotBlank(template.getPassword())
+                        && !JexlUtil.isExpressionValid(template.getPassword())) {
+
                     sce.getElements().add("Invalid JEXL: " + template.getPassword());
                 }
 
@@ -155,7 +157,8 @@ public class TaskDataBinder {
         task.setSyncStatus(taskTO.isSyncStatus());
         task.setMatchigRule(taskTO.getMatchigRule());
         task.setUnmatchigRule(taskTO.getUnmatchigRule());
-        task.setActionsClassName(taskTO.getActionsClassName());
+        task.getActionsClassNames().clear();
+        task.getActionsClassNames().addAll(taskTO.getActionsClassNames());
     }
 
     public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil) {
@@ -192,7 +195,6 @@ public class TaskDataBinder {
         Class<? extends Task> taskClass = taskUtil.taskClass();
         Class<? extends AbstractTaskTO> taskTOClass = taskUtil.taskTOClass();
 
-
         if (taskClass == null || !taskClass.equals(task.getClass())) {
             throw new ClassCastException(
                     String.format("taskUtil is type %s but task is not: %s", taskClass, task.getClass()));
@@ -297,6 +299,7 @@ public class TaskDataBinder {
                 ((SyncTaskTO) taskTO).setDescription(((SyncTask) task).getDescription());
                 ((SyncTaskTO) taskTO).setResource(((SyncTask) task).getResource().getName());
                 break;
+
             case PUSH:
                 if (!(task instanceof PushTask)) {
                     throw new ClassCastException("taskUtil is type Push but task is not PushTask:
"

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java
Fri Jun 13 13:58:59 2014
@@ -86,9 +86,9 @@ public abstract class AbstractSyncJob<T 
     /**
      * SyncJob actions.
      */
-    protected A actions;
+    protected List<A> actions;
 
-    public void setActions(final A actions) {
+    public void setActions(final List<A> actions) {
         this.actions = actions;
     }
 
@@ -326,11 +326,13 @@ public abstract class AbstractSyncJob<T 
 
             final UMapping uMapping = syncTask.getResource().getUmapping();
             if (uMapping != null && uMapping.getAccountIdItem() == null) {
-                throw new JobExecutionException("Invalid user account id mapping for resource
" + syncTask.getResource());
+                throw new JobExecutionException(
+                        "Invalid user account id mapping for resource " + syncTask.getResource());
             }
             final RMapping rMapping = syncTask.getResource().getRmapping();
             if (rMapping != null && rMapping.getAccountIdItem() == null) {
-                throw new JobExecutionException("Invalid role account id mapping for resource
" + syncTask.getResource());
+                throw new JobExecutionException(
+                        "Invalid role account id mapping for resource " + syncTask.getResource());
             }
             if (uMapping == null && rMapping == null) {
                 return "No mapping configured for both users and roles: aborting...";

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java
Fri Jun 13 13:58:59 2014
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.sync.impl;
 
 import java.util.Collection;
+import java.util.List;
 import org.apache.syncope.common.types.ConflictResolutionAction;
 import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.connid.ConnObjectUtil;
@@ -104,15 +105,15 @@ public abstract class AbstractSyncopeRes
 
     protected ConflictResolutionAction resAct;
 
-    protected A actions;
+    protected List<A> actions;
 
     protected T syncTask;
 
-    public A getActions() {
+    public List<A> getActions() {
         return actions;
     }
 
-    public void setActions(A actions) {
+    public void setActions(final List<A> actions) {
         this.actions = actions;
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/DBPasswordSyncActions.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/DBPasswordSyncActions.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/DBPasswordSyncActions.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/DBPasswordSyncActions.java
Fri Jun 13 13:58:59 2014
@@ -38,13 +38,15 @@ import org.springframework.beans.factory
 import org.springframework.transaction.annotation.Transactional;
 
 /**
- * A SyncActions implementation which allows the ability to import passwords from a Database

+ * A SyncActions implementation which allows the ability to import passwords from a Database
  * backend, where the passwords are hashed according to the password cipher algorithm property
  * of the (DB) Connector and HEX-encoded.
  */
 public class DBPasswordSyncActions extends DefaultSyncActions {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(DBPasswordSyncActions.class);
+    private static final Logger LOG = LoggerFactory.getLogger(DBPasswordSyncActions.class);
+
+    private static final String CLEARTEXT = "CLEARTEXT";
 
     @Autowired
     private UserDAO userDAO;
@@ -64,19 +66,21 @@ public class DBPasswordSyncActions exten
             String password = ((UserTO) subject).getPassword();
             if (password != null) {
                 Connector connector = handler.getConnector();
-                
                 ConnInstance connInstance = connector.getActiveConnInstance();
-                Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
-                String cipherAlgorithm = "CLEARTEXT";
-                while (propertyIterator.hasNext()) {
+                
+                String cipherAlgorithm = CLEARTEXT;
+                boolean found = false;
+                for (Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
+                        propertyIterator.hasNext() && !found;) {
+
                     ConnConfProperty property = propertyIterator.next();
                     if ("cipherAlgorithm".equals(property.getSchema().getName())
                             && property.getValues() != null && !property.getValues().isEmpty())
{
+
                         cipherAlgorithm = (String) property.getValues().get(0);
-                        break;
                     }
                 }
-                if (!"CLEARTEXT".equals(cipherAlgorithm)) {
+                if (!CLEARTEXT.equals(cipherAlgorithm)) {
                     try {
                         encodedPassword = password;
                         cipher = CipherAlgorithm.valueOf(cipherAlgorithm);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/PushJob.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/PushJob.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/PushJob.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/PushJob.java Fri Jun
13 13:58:59 2014
@@ -91,14 +91,16 @@ public class PushJob extends AbstractSyn
         final SyncopePushResultHandler handler =
                 (SyncopePushResultHandler) ((DefaultListableBeanFactory) ApplicationContextProvider.
                 getApplicationContext().getBeanFactory()).createBean(
-                SyncopePushResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
+                        SyncopePushResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
         handler.setConnector(connector);
         handler.setDryRun(dryRun);
         handler.setResults(results);
         handler.setSyncTask(pushTask);
         handler.setActions(actions);
 
-        actions.beforeAll(handler);
+        for (PushActions action : actions) {
+            action.beforeAll(handler);
+        }
 
         if (uMapping != null) {
             final int count = userDAO.count(authorizations);
@@ -135,7 +137,9 @@ public class PushJob extends AbstractSyn
             }
         }
 
-        actions.afterAll(handler, results);
+        for (PushActions action : actions) {
+            action.afterAll(handler, results);
+        }
 
         final String result = createReport(results, pushTask.getResource().getSyncTraceLevel(),
dryRun);
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java Fri Jun
13 13:58:59 2014
@@ -99,7 +99,7 @@ public class SyncJob extends AbstractSyn
         final SyncopeSyncResultHandler handler =
                 (SyncopeSyncResultHandler) ((DefaultListableBeanFactory) ApplicationContextProvider.
                 getApplicationContext().getBeanFactory()).createBean(
-                SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
+                        SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
         handler.setConnector(connector);
         handler.setActions(actions);
         handler.setDryRun(dryRun);
@@ -107,7 +107,9 @@ public class SyncJob extends AbstractSyn
         handler.setResults(results);
         handler.setSyncTask(syncTask);
 
-        actions.beforeAll(handler);
+        for (SyncActions action : actions) {
+            action.beforeAll(handler);
+        }
         try {
             SyncToken latestUSyncToken = null;
             if (uMapping != null && !syncTask.isFullReconciliation()) {
@@ -162,7 +164,9 @@ public class SyncJob extends AbstractSyn
             LOG.error("While setting role owners", e);
         }
 
-        actions.afterAll(handler, results);
+        for (SyncActions action : actions) {
+            action.afterAll(handler, results);
+        }
 
         final String result = createReport(results, syncTask.getResource().getSyncTraceLevel(),
dryRun);
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopePushResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopePushResultHandler.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopePushResultHandler.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopePushResultHandler.java
Fri Jun 13 13:58:59 2014
@@ -139,21 +139,27 @@ public class SyncopePushResultHandler ex
                 switch (getSyncTask().getUnmatchigRule()) {
                     case ASSIGN:
                         result.setOperation(ResourceOperation.CREATE);
-                        actions.beforeAssign(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeAssign(this, values, toBeHandled);
+                        }
                         controller.assign(
                                 toBeHandled.getId(),
                                 Collections.singleton(getSyncTask().getResource().getName()),
true, null);
                         break;
                     case PROVISION:
                         result.setOperation(ResourceOperation.CREATE);
-                        actions.beforeProvision(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeProvision(this, values, toBeHandled);
+                        }
                         controller.provision(
                                 toBeHandled.getId(),
                                 Collections.singleton(getSyncTask().getResource().getName()),
true, null);
                         break;
                     case UNLINK:
                         result.setOperation(ResourceOperation.NONE);
-                        actions.beforeUnlink(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeUnlink(this, values, toBeHandled);
+                        }
                         controller.unlink(
                                 toBeHandled.getId(), Collections.singleton(getSyncTask().getResource().getName()));
                         break;
@@ -166,7 +172,9 @@ public class SyncopePushResultHandler ex
                 switch (getSyncTask().getMatchigRule()) {
                     case UPDATE:
                         result.setOperation(ResourceOperation.UPDATE);
-                        actions.beforeUpdate(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeUpdate(this, values, toBeHandled);
+                        }
 
                         AbstractPropagationTaskExecutor.createOrUpdate(
                                 oclass,
@@ -181,13 +189,17 @@ public class SyncopePushResultHandler ex
                         break;
                     case DEPROVISION:
                         result.setOperation(ResourceOperation.DELETE);
-                        actions.beforeDeprovision(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeDeprovision(this, values, toBeHandled);
+                        }
                         controller.deprovision(
                                 toBeHandled.getId(), Collections.singleton(getSyncTask().getResource().getName()));
                         break;
                     case UNASSIGN:
                         result.setOperation(ResourceOperation.DELETE);
-                        actions.beforeUnassign(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeUnassign(this, values, toBeHandled);
+                        }
                         controller.unlink(
                                 toBeHandled.getId(), Collections.singleton(getSyncTask().getResource().getName()));
                         controller.deprovision(
@@ -195,13 +207,17 @@ public class SyncopePushResultHandler ex
                         break;
                     case LINK:
                         result.setOperation(ResourceOperation.NONE);
-                        actions.beforeLink(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeLink(this, values, toBeHandled);
+                        }
                         controller.link(
                                 toBeHandled.getId(), Collections.singleton(getSyncTask().getResource().getName()));
                         break;
                     case UNLINK:
                         result.setOperation(ResourceOperation.NONE);
-                        actions.beforeUnlink(this, values, toBeHandled);
+                        for (PushActions action : actions) {
+                            action.beforeUnlink(this, values, toBeHandled);
+                        }
                         controller.unlink(
                                 toBeHandled.getId(), Collections.singleton(getSyncTask().getResource().getName()));
                         break;
@@ -222,7 +238,9 @@ public class SyncopePushResultHandler ex
             LOG.warn("Error pushing {} towards {}", toBeHandled, getSyncTask().getResource(),
e);
             throw new JobExecutionException(e);
         } finally {
-            actions.after(this, values, toBeHandled, result);
+            for (PushActions action : actions) {
+                action.after(this, values, toBeHandled, result);
+            }
             notificationManager.createTasks(
                     AuditElements.EventCategoryType.PUSH,
                     AttributableType.USER.name().toLowerCase(),

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
Fri Jun 13 13:58:59 2014
@@ -350,7 +350,7 @@ public class SyncopeSyncResultHandler ex
 
         final List<ConnectorObject> found = connector.search(objectClass,
                 new EqualsFilter(new Name(name)), connector.getOperationOptions(
-                attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)));
+                        attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)));
 
         if (found.isEmpty()) {
             LOG.debug("No {} found on {} with __NAME__ {}", objectClass, syncTask.getResource(),
name);
@@ -397,7 +397,12 @@ public class SyncopeSyncResultHandler ex
 
         subjectTO.getResources().add(getSyncTask().getResource().getName());
 
-        return create(subjectTO, actions.beforeAssign(this, delta, subjectTO), attrUtil,
"assign", dryRun);
+        SyncDelta _delta = delta;
+        for (SyncActions action : actions) {
+            _delta = action.beforeAssign(this, _delta, subjectTO);
+        }
+
+        return create(subjectTO, _delta, attrUtil, "assign", dryRun);
     }
 
     protected List<SyncResult> create(
@@ -407,12 +412,17 @@ public class SyncopeSyncResultHandler ex
         final AbstractAttributableTO subjectTO =
                 connObjectUtil.getAttributableTO(delta.getObject(), syncTask, attrUtil);
 
-        return create(subjectTO, actions.beforeCreate(this, delta, subjectTO), attrUtil,
"provision", dryRun);
+        SyncDelta _delta = delta;
+        for (SyncActions action : actions) {
+            _delta = action.beforeCreate(this, _delta, subjectTO);
+        }
+
+        return create(subjectTO, _delta, attrUtil, "provision", dryRun);
     }
 
     private List<SyncResult> create(
             final AbstractAttributableTO subjectTO,
-            SyncDelta delta,
+            final SyncDelta delta,
             final AttributableUtil attrUtil,
             final String operation,
             final boolean dryRun)
@@ -517,7 +527,9 @@ public class SyncopeSyncResultHandler ex
                     delta);
         }
 
-        actions.after(this, delta, actual, result);
+        for (SyncActions action : actions) {
+            action.after(this, delta, actual, result);
+        }
         return Collections.singletonList(result);
     }
 
@@ -529,7 +541,9 @@ public class SyncopeSyncResultHandler ex
         UserMod userMod = connObjectUtil.getAttributableMod(
                 id, delta.getObject(), before, syncTask, AttributableUtil.getInstance(AttributableType.USER));
 
-        delta = actions.beforeUpdate(this, delta, before, userMod);
+        for (SyncActions action : actions) {
+            delta = action.beforeUpdate(this, delta, before, userMod);
+        }
 
         if (dryRun) {
             return new AbstractMap.SimpleEntry<UserTO, UserTO>(before, before);
@@ -582,7 +596,9 @@ public class SyncopeSyncResultHandler ex
         taskExecutor.execute(tasks);
 
         final UserTO after = userDataBinder.getUserTO(updated.getResult().getKey().getId());
-        actions.after(this, delta, after, result);
+        for (SyncActions action : actions) {
+            action.after(this, delta, after, result);
+        }
 
         return new AbstractMap.SimpleEntry<UserTO, UserTO>(before, after);
     }
@@ -595,7 +611,9 @@ public class SyncopeSyncResultHandler ex
         RoleMod roleMod = connObjectUtil.getAttributableMod(
                 id, delta.getObject(), before, syncTask, AttributableUtil.getInstance(AttributableType.ROLE));
 
-        delta = actions.beforeUpdate(this, delta, before, roleMod);
+        for (SyncActions action : actions) {
+            delta = action.beforeUpdate(this, delta, before, roleMod);
+        }
 
         if (dryRun) {
             return new AbstractMap.SimpleEntry<RoleTO, RoleTO>(before, before);
@@ -625,7 +643,9 @@ public class SyncopeSyncResultHandler ex
 
         final RoleTO after = roleDataBinder.getRoleTO(updated.getResult());
 
-        actions.after(this, delta, after, result);
+        for (SyncActions action : actions) {
+            action.after(this, delta, after, result);
+        }
 
         return new AbstractMap.SimpleEntry<RoleTO, RoleTO>(before, after);
     }
@@ -759,16 +779,22 @@ public class SyncopeSyncResultHandler ex
             try {
                 if (!dryRun) {
                     if (unlink) {
-                        actions.beforeUnassign(this, delta, before);
+                        for (SyncActions action : actions) {
+                            action.beforeUnassign(this, delta, before);
+                        }
                         controller.unlink(id, Collections.<String>singleton(getSyncTask().getResource().getName()));
                     } else {
-                        actions.beforeDeprovision(this, delta, before);
+                        for (SyncActions action : actions) {
+                            action.beforeDeprovision(this, delta, before);
+                        }
                     }
 
                     controller.deprovision(id, Collections.<String>singleton(getSyncTask().getResource().getName()));
 
                     output = controller.read(id);
-                    actions.after(this, delta, AbstractAttributableTO.class.cast(output),
result);
+                    for (SyncActions action : actions) {
+                        action.after(this, delta, AbstractAttributableTO.class.cast(output),
result);
+                    }
                 } else {
                     output = before;
                 }
@@ -860,15 +886,21 @@ public class SyncopeSyncResultHandler ex
             try {
                 if (!dryRun) {
                     if (unlink) {
-                        actions.beforeUnlink(this, delta, before);
+                        for (SyncActions action : actions) {
+                            action.beforeUnlink(this, delta, before);
+                        }
                         controller.unlink(id, Collections.<String>singleton(getSyncTask().getResource().getName()));
                     } else {
-                        actions.beforeLink(this, delta, before);
+                        for (SyncActions action : actions) {
+                            action.beforeLink(this, delta, before);
+                        }
                         controller.link(id, Collections.<String>singleton(getSyncTask().getResource().getName()));
                     }
 
                     output = controller.read(id);
-                    actions.after(this, delta, AbstractAttributableTO.class.cast(output),
result);
+                    for (SyncActions action : actions) {
+                        action.after(this, delta, AbstractAttributableTO.class.cast(output),
result);
+                    }
                 } else {
                     output = before;
                 }
@@ -941,7 +973,9 @@ public class SyncopeSyncResultHandler ex
                         ? userDataBinder.getUserTO(id)
                         : roleDataBinder.getRoleTO(id);
 
-                delta = actions.beforeDelete(this, delta, before);
+                for (SyncActions action : actions) {
+                    delta = action.beforeDelete(this, delta, before);
+                }
 
                 final SyncResult result = new SyncResult();
                 result.setId(id);
@@ -986,7 +1020,9 @@ public class SyncopeSyncResultHandler ex
                     }
                 }
 
-                actions.after(this, delta, before, result);
+                for (SyncActions action : actions) {
+                    action.after(this, delta, before, result);
+                }
                 delResults.add(result);
 
             } catch (NotFoundException e) {

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Fri
Jun 13 13:58:59 2014
@@ -321,7 +321,7 @@ public class TaskTestITCase extends Abst
             assertNotNull(task);
 
             // add custom SyncJob actions
-            task.setActionsClassName(TestSyncActions.class.getName());
+            task.getActionsClassNames().add(TestSyncActions.class.getName());
 
             // add user template
             UserTO template = new UserTO();
@@ -341,7 +341,7 @@ public class TaskTestITCase extends Abst
             SyncTaskTO actual = taskService.read(task.getId());
             assertNotNull(actual);
             assertEquals(task.getId(), actual.getId());
-            assertEquals(TestSyncActions.class.getName(), actual.getActionsClassName());
+            assertEquals(TestSyncActions.class.getName(), actual.getActionsClassNames().get(0));
 
             execSyncTask(SYNC_TASK_ID, 50, false);
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/SyncTaskTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/SyncTaskTest.java?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/SyncTaskTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/SyncTaskTest.java Fri Jun
13 13:58:59 2014
@@ -72,7 +72,7 @@ public class SyncTaskTest extends Abstra
         assertNotNull(exception);
 
         task.setResource(resource);
-        task.setActionsClassName(getClass().getName());
+        task.getActionsClassNames().add(getClass().getName());
 
         // this save() fails because jobActionsClassName does not implement 
         // the right interface
@@ -84,7 +84,8 @@ public class SyncTaskTest extends Abstra
         }
         assertNotNull(exception);
 
-        task.setActionsClassName(TestSyncActions.class.getName());
+        task.getActionsClassNames().clear();
+        task.getActionsClassNames().add(TestSyncActions.class.getName());
         // this save() finally works
         task = taskDAO.save(task);
         assertNotNull(task);
@@ -103,7 +104,7 @@ public class SyncTaskTest extends Abstra
         task.setResource(resource);
         task.setName("issueSYNCOPE144");
         task.setDescription("issueSYNCOPE144 Description");
-        task.setActionsClassName(TestSyncActions.class.getName());
+        task.getActionsClassNames().add(TestSyncActions.class.getName());
 
         task = taskDAO.save(task);
         assertNotNull(task);

Modified: syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/content.xml?rev=1602430&r1=1602429&r2=1602430&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/content.xml (original)
+++ syncope/trunk/core/src/test/resources/content.xml Fri Jun 13 13:58:59 2014
@@ -532,10 +532,11 @@ under the License.
   <ExternalResource name="resource-ldap" connector_id="105"
                     randomPwdIfNotProvided="1" enforceMandatoryCondition="1" propagationMode="ONE_PHASE"
                     propagationPriority="0" propagationPrimary="1"
-                    propagationActionsClassName="org.apache.syncope.core.propagation.impl.LDAPMembershipPropagationActions"
                     createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL"
syncTraceLevel="ALL"
                     creator="admin" lastModifier="admin" 
                     creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
+  <ExternalResource_propagationActionsClassNames externalResource_name="resource-ldap"
+                                                 element="org.apache.syncope.core.propagation.impl.LDAPMembershipPropagationActions"/>
   <ExternalResource name="ws-target-resource-nopropagation" connector_id="103"
                     randomPwdIfNotProvided="0" enforceMandatoryCondition="1" propagationMode="TWO_PHASES"
                     propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL"
deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL" 
@@ -844,8 +845,8 @@ under the License.
         jobClassName="org.apache.syncope.core.sync.impl.SyncJob"/>
   <Task DTYPE="SyncTask" id="11" name="LDAP Sync Task" resource_name="resource-ldap"
         fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
-        actionsClassName="org.apache.syncope.core.sync.impl.LDAPMembershipSyncActions"  
         jobClassName="org.apache.syncope.core.sync.impl.SyncJob"/>
+  <SyncTask_actionsClassNames SyncTask_id="11" element="org.apache.syncope.core.sync.impl.LDAPMembershipSyncActions"/>
   <Task DTYPE="SyncTask" id="12" name="VirAttrCache test" resource_name="resource-csv"
         performCreate="0" performUpdate="1" performDelete="0" syncStatus="0" fullReconciliation="1"
         jobClassName="org.apache.syncope.core.sync.impl.SyncJob"/>



Mime
View raw message