You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2015/03/18 09:36:24 UTC

syncope git commit: [SYNCOPE-648]Add getAttributableUtil in User/Role PushResultHandler

Repository: syncope
Updated Branches:
  refs/heads/1_2_X 89d5ad43c -> 12570a042


[SYNCOPE-648]Add getAttributableUtil in User/Role PushResultHandler


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

Branch: refs/heads/1_2_X
Commit: 12570a042846044c41fea54c8c6d27daf280de0d
Parents: 89d5ad4
Author: Marco Di Sabatino Di Diodoro <md...@apache.org>
Authored: Wed Mar 18 09:36:03 2015 +0100
Committer: Marco Di Sabatino Di Diodoro <md...@apache.org>
Committed: Wed Mar 18 09:36:03 2015 +0100

----------------------------------------------------------------------
 .../core/sync/impl/AbstractSubjectPushResultHandler.java    | 9 +++++----
 .../syncope/core/sync/impl/RolePushResultHandler.java       | 7 +++++++
 .../syncope/core/sync/impl/UserPushResultHandler.java       | 7 +++++++
 3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/12570a04/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectPushResultHandler.java b/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectPushResultHandler.java
index e8954e9..9ea22fd 100644
--- a/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectPushResultHandler.java
+++ b/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectPushResultHandler.java
@@ -52,6 +52,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 public abstract class AbstractSubjectPushResultHandler extends AbstractSyncopeResultHandler<PushTask, PushActions> {
 
+    protected abstract AttributableUtil getAttributableUtil();
+
     protected abstract String getName(final AbstractSubject subject);
 
     protected abstract AbstractMapping getMapping();
@@ -114,7 +116,6 @@ public abstract class AbstractSubjectPushResultHandler extends AbstractSyncopeRe
         String operation = null;
 
         // Try to read remote object (user / group) BEFORE any actual operation
-
         final String accountId = MappingUtil.getAccountIdValue(
                 subject, profile.getSyncTask().getResource(), getMapping().getAccountIdItem());
 
@@ -180,7 +181,7 @@ public abstract class AbstractSubjectPushResultHandler extends AbstractSyncopeRe
                     }
 
                 } else {
-                    operation = MatchingRule.toEventName(profile.getSyncTask().getMatchingRule());           
+                    operation = MatchingRule.toEventName(profile.getSyncTask().getMatchingRule());
                     result.setOperation(getResourceOperation(profile.getSyncTask().getMatchingRule()));
 
                     switch (profile.getSyncTask().getMatchingRule()) {
@@ -269,7 +270,7 @@ public abstract class AbstractSubjectPushResultHandler extends AbstractSyncopeRe
             } finally {
                 notificationManager.createTasks(
                         AuditElements.EventCategoryType.PUSH,
-                        attrUtil.getType().name().toLowerCase(),
+                        getAttributableUtil().getType().name().toLowerCase(),
                         profile.getSyncTask().getResource().getName(),
                         operation,
                         resultStatus,
@@ -278,7 +279,7 @@ public abstract class AbstractSubjectPushResultHandler extends AbstractSyncopeRe
                         subject);
                 auditManager.audit(
                         AuditElements.EventCategoryType.PUSH,
-                        AttributableType.USER.name().toLowerCase(),
+                        getAttributableUtil().getType().name().toLowerCase(),
                         profile.getSyncTask().getResource().getName(),
                         operation,
                         resultStatus,

http://git-wip-us.apache.org/repos/asf/syncope/blob/12570a04/core/src/main/java/org/apache/syncope/core/sync/impl/RolePushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/sync/impl/RolePushResultHandler.java b/core/src/main/java/org/apache/syncope/core/sync/impl/RolePushResultHandler.java
index c29b49e..18f7008 100644
--- a/core/src/main/java/org/apache/syncope/core/sync/impl/RolePushResultHandler.java
+++ b/core/src/main/java/org/apache/syncope/core/sync/impl/RolePushResultHandler.java
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.to.AbstractSubjectTO;
 import org.apache.syncope.common.to.RoleTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.ResourceOperation;
 import org.apache.syncope.core.persistence.beans.AbstractMapping;
 import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
@@ -31,6 +32,7 @@ import org.apache.syncope.core.persistence.beans.AbstractSubject;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.propagation.PropagationByResource;
 import org.apache.syncope.core.propagation.TimeoutException;
+import org.apache.syncope.core.util.AttributableUtil;
 import org.identityconnectors.framework.common.objects.ConnectorObject;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 import org.identityconnectors.framework.common.objects.Uid;
@@ -38,6 +40,11 @@ import org.identityconnectors.framework.common.objects.Uid;
 public class RolePushResultHandler extends AbstractSubjectPushResultHandler {
 
     @Override
+    protected AttributableUtil getAttributableUtil() {
+        return AttributableUtil.getInstance(AttributableType.ROLE);
+    }
+
+    @Override
     protected AbstractSubject deprovision(final AbstractSubject sbj) {
         final RoleTO before = roleDataBinder.getRoleTO(SyncopeRole.class.cast(sbj));
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/12570a04/core/src/main/java/org/apache/syncope/core/sync/impl/UserPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/sync/impl/UserPushResultHandler.java b/core/src/main/java/org/apache/syncope/core/sync/impl/UserPushResultHandler.java
index 4637692..a608c6a 100644
--- a/core/src/main/java/org/apache/syncope/core/sync/impl/UserPushResultHandler.java
+++ b/core/src/main/java/org/apache/syncope/core/sync/impl/UserPushResultHandler.java
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.AbstractSubjectTO;
 import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.ResourceOperation;
 import org.apache.syncope.core.persistence.beans.AbstractMapping;
 import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
@@ -31,6 +32,7 @@ import org.apache.syncope.core.persistence.beans.AbstractSubject;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.propagation.PropagationByResource;
 import org.apache.syncope.core.propagation.TimeoutException;
+import org.apache.syncope.core.util.AttributableUtil;
 import org.identityconnectors.framework.common.objects.ConnectorObject;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 import org.identityconnectors.framework.common.objects.Uid;
@@ -38,6 +40,11 @@ import org.identityconnectors.framework.common.objects.Uid;
 public class UserPushResultHandler extends AbstractSubjectPushResultHandler {
 
     @Override
+    protected AttributableUtil getAttributableUtil() {
+        return AttributableUtil.getInstance(AttributableType.USER);
+    }
+
+    @Override
     protected AbstractSubject deprovision(final AbstractSubject sbj) {
         final UserTO before = userDataBinder.getUserTO(sbj.getId());