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 2014/06/16 12:40:40 UTC

svn commit: r1602837 - in /syncope/trunk/core/src/main/java/org/apache/syncope/core/rest: controller/UserController.java data/UserDataBinder.java

Author: ilgrosso
Date: Mon Jun 16 10:40:39 2014
New Revision: 1602837

URL: http://svn.apache.org/r1602837
Log:
[SYNCOPE-459] Some refinements

Modified:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1602837&r1=1602836&r2=1602837&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Mon Jun 16 10:40:39 2014
@@ -248,28 +248,27 @@ public class UserController extends Abst
         // AttributableMod transformation (if configured)
         UserMod actual = attrTransformer.transform(userMod);
         LOG.debug("Transformed: {}", actual);
-        /*
-         * Actual operations: workflow, propagation, notification
-         */
-        WorkflowResult<Map.Entry<UserMod, Boolean>> updated = uwfAdapter.update(actual);
 
-        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
-                getBean(PropagationReporter.class);
+        //Actual operations: workflow, propagation, notification
+        WorkflowResult<Map.Entry<UserMod, Boolean>> updated = uwfAdapter.update(actual);
 
         List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated);
         if (tasks.isEmpty()) {
             // SYNCOPE-459: take care of user virtual attributes ...
-            final PropagationByResource propByResVirAttr = binder.forceVirtualAttributes(
+            final PropagationByResource propByResVirAttr = binder.fillVirtual(
                     updated.getResult().getKey().getId(),
                     actual.getVirAttrsToRemove(),
                     actual.getVirAttrsToUpdate());
             // SYNCOPE-501: update only virtual attributes (if any of them changed), password propagation is 
             // not required
-            tasks.addAll(propByResVirAttr.isEmpty() ? Collections.<PropagationTask>emptyList()
-                    : propagationManager.
-                    getUserUpdateTaskIds(updated, false, null));
+            tasks.addAll(propByResVirAttr.isEmpty()
+                    ? Collections.<PropagationTask>emptyList()
+                    : propagationManager.getUserUpdateTaskIds(updated, false, null));
         }
 
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+                getBean(PropagationReporter.class);
+
         if (!tasks.isEmpty()) {
             try {
                 taskExecutor.execute(tasks, propagationReporter);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?rev=1602837&r1=1602836&r2=1602837&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java Mon Jun 16 10:40:39 2014
@@ -23,7 +23,6 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.annotation.Resource;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.mod.AttributeMod;
 import org.apache.syncope.common.mod.MembershipMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.MembershipTO;
@@ -37,6 +36,7 @@ import org.apache.syncope.common.types.C
 import org.apache.syncope.common.util.BeanUtils;
 import org.apache.syncope.common.SyncopeClientCompositeException;
 import org.apache.syncope.common.SyncopeClientException;
+import org.apache.syncope.common.mod.AttributeMod;
 import org.apache.syncope.core.connid.ConnObjectUtil;
 import org.apache.syncope.core.persistence.beans.AbstractAttr;
 import org.apache.syncope.core.persistence.beans.AbstractDerAttr;
@@ -438,22 +438,20 @@ public class UserDataBinder extends Abst
     }
 
     /**
-     * SYNCOPE-459: force virtual attribute changes.
-     * <br />
-     * To be used in case of no propagation task defined.
+     * SYNCOPE-459: build virtual attribute changes in case no other changes were made.
      *
-     * @param id attributable id
+     * @param id user id
      * @param vAttrsToBeRemoved virtual attributes to be removed.
      * @param vAttrsToBeUpdated virtual attributes to be updated.
+     * @return operations to be performed on external resources for virtual attributes changes
      */
-    public PropagationByResource forceVirtualAttributes(
+    public PropagationByResource fillVirtual(
             final Long id, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated) {
-        final SyncopeUser syncopeUser = getUserFromId(id);
 
         return fillVirtual(
-                syncopeUser,
+                getUserFromId(id),
                 vAttrsToBeRemoved,
                 vAttrsToBeUpdated,
-                AttributableUtil.getInstance(syncopeUser));
+                AttributableUtil.getInstance(AttributableType.USER));
     }
 }