syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1537047 [4/5] - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/rest/ common/src/main/java/org/apache/syncope/common/ common/src/main/java/org/apache/syncope/common/mod/ common/src/main/java/org/apache/syncope/common/serv...
Date Wed, 30 Oct 2013 11:26:22 GMT
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=1537047&r1=1537046&r2=1537047&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 Wed Oct 30 11:26:19 2013
@@ -25,6 +25,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
@@ -32,7 +33,6 @@ import org.apache.syncope.common.to.Bulk
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.BulkActionRes.Status;
 import org.apache.syncope.common.to.MembershipTO;
-import org.apache.syncope.common.to.PropagationRequestTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.AuditElements.Category;
@@ -40,7 +40,6 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.AuditElements.UserSubCategory;
 import org.apache.syncope.common.types.ResourceOperation;
 import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.notification.NotificationManager;
@@ -76,7 +75,7 @@ import org.springframework.transaction.a
  * @see AbstractController
  */
 @Component
-public class UserController {
+public class UserController extends AbstractResourceAssociator<UserTO> {
 
     /**
      * Logger.
@@ -113,14 +112,24 @@ public class UserController {
     @Autowired
     protected NotificationManager notificationManager;
 
+    @PreAuthorize("hasRole('USER_READ')")
+    public String getUsername(final Long userId) {
+        return binder.getUserTO(userId).getUsername();
+    }
+
+    @PreAuthorize("hasRole('USER_READ')")
+    public Long getUserId(final String username) {
+        return binder.getUserTO(username).getId();
+    }
+
     @PreAuthorize("hasRole('USER_LIST')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public int count() {
         return userDAO.count(EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames()));
     }
 
     @PreAuthorize("hasRole('USER_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public int searchCount(final NodeCond searchCondition) throws InvalidSearchConditionException {
         if (!searchCondition.isValid()) {
             LOG.error("Invalid search condition: {}", searchCondition);
@@ -132,10 +141,10 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_LIST')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<UserTO> list() {
-        List<SyncopeUser> users =
-                userDAO.findAll(EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames()));
+        List<SyncopeUser> users = userDAO.findAll(
+                EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames()));
 
         List<UserTO> userTOs = new ArrayList<UserTO>(users.size());
         for (SyncopeUser user : users) {
@@ -149,7 +158,7 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_LIST')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<UserTO> list(final int page, final int size) {
         Set<Long> adminRoleIds = EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
 
@@ -166,7 +175,7 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public UserTO read(final Long userId) {
         UserTO result = binder.getUserTO(userId);
 
@@ -176,21 +185,10 @@ public class UserController {
         return result;
     }
 
-    @PreAuthorize("#username == authentication.name or hasRole('USER_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
-    public UserTO read(final String username) {
-        UserTO result = binder.getUserTO(username);
-
-        auditManager.audit(Category.user, UserSubCategory.read, Result.success,
-                "Successfully read user: " + username);
-
-        return result;
-    }
-
     @PreAuthorize("isAuthenticated() "
             + "and not(hasRole(T(org.apache.syncope.common.SyncopeConstants).ANONYMOUS_ENTITLEMENT))")
     @Transactional(readOnly = true)
-    public UserTO read() {
+    public UserTO readSelf() {
         UserTO userTO = binder.getAuthenticatedUserTO();
 
         auditManager.audit(Category.user, UserSubCategory.read, Result.success,
@@ -200,7 +198,7 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<UserTO> search(final NodeCond searchCondition)
             throws InvalidSearchConditionException {
 
@@ -208,7 +206,7 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<UserTO> search(final NodeCond searchCondition, final int page, final int size)
             throws InvalidSearchConditionException {
 
@@ -255,13 +253,12 @@ public class UserController {
         /*
          * Actual operations: workflow, propagation, notification
          */
-
         WorkflowResult<Map.Entry<Long, Boolean>> created = uwfAdapter.create(actual);
 
         List<PropagationTask> tasks = propagationManager.getUserCreateTaskIds(
                 created, actual.getPassword(), actual.getVirAttrs());
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+                getBean(PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -310,7 +307,7 @@ public class UserController {
             final PropagationByResource origPropByRes = new PropagationByResource();
             origPropByRes.merge(updated.getPropByRes());
 
-            Set<String> pwdResourceNames = actual.getPwdPropRequest().getResources();
+            List<String> pwdResourceNames = actual.getPwdPropRequest().getResourceNames();
             SyncopeUser user = binder.getUserFromId(updated.getResult().getKey());
             pwdResourceNames.retainAll(user.getResourceNames());
             final PropagationByResource pwdPropByRes = new PropagationByResource();
@@ -347,8 +344,8 @@ public class UserController {
             updated.setPropByRes(origPropByRes);
         }
 
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+                getBean(PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -371,137 +368,48 @@ public class UserController {
         return updatedTO;
     }
 
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO activate(final Long userId, final String token) {
-        return activate(userId, token, null);
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO activate(final Long userId, final String token, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to activate " + userId);
-
-        SyncopeUser user = binder.getUserFromId(userId);
-
-        return setStatus(user, token, propagationRequestTO, true, "activate");
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO activate(final String username, final String token) {
-        return activate(username, token, null);
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO activate(final String username, final String token, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to activate " + username);
-
-        SyncopeUser user = binder.getUserFromUsername(username);
-
-        return setStatus(user, token, propagationRequestTO, true, "activate");
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO suspend(final Long userId) {
-        return suspend(userId, null);
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO suspend(final Long userId, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to suspend " + userId);
-
-        SyncopeUser user = binder.getUserFromId(userId);
-
-        return setStatus(user, null, propagationRequestTO, false, "suspend");
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO suspend(final String username) {
-        return suspend(username, null);
-    }
-
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO suspend(final String username, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to suspend " + username);
-
-        SyncopeUser user = binder.getUserFromUsername(username);
-
-        return setStatus(user, null, propagationRequestTO, false, "suspend");
-    }
+    protected WorkflowResult<Long> setStatusOnWfAdapter(final SyncopeUser user, final StatusMod statusMod) {
+        WorkflowResult<Long> updated;
 
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO reactivate(final Long userId) {
-        return reactivate(userId, null);
-    }
+        switch (statusMod.getType()) {
+            case SUSPEND:
+                updated = uwfAdapter.suspend(user.getId());
+                break;
 
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO reactivate(final Long userId, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to reactivate " + userId);
+            case REACTIVATE:
+                updated = uwfAdapter.reactivate(user.getId());
+                break;
 
-        SyncopeUser user = binder.getUserFromId(userId);
+            case ACTIVATE:
+            default:
+                updated = uwfAdapter.activate(user.getId(), statusMod.getToken());
+                break;
 
-        return setStatus(user, null, propagationRequestTO, true, "reactivate");
-    }
+        }
 
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO reactivate(final String username) {
-        return reactivate(username, null);
+        return updated;
     }
 
     @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
-    public UserTO reactivate(final String username, final PropagationRequestTO propagationRequestTO) {
-        LOG.debug("About to reactivate " + username);
-
-        SyncopeUser user = binder.getUserFromUsername(username);
+    @Transactional(rollbackFor = { Throwable.class })
+    public UserTO status(final StatusMod statusMod) {
+        LOG.debug("About to mod status {}", statusMod);
 
-        return setStatus(user, null, propagationRequestTO, true, "reactivate");
-    }
-
-    @PreAuthorize("hasRole('USER_DELETE')")
-    public UserTO delete(final Long userId) {
-        LOG.debug("User delete called with {}", userId);
-
-        return doDelete(userId);
-    }
-
-    @PreAuthorize("hasRole('USER_DELETE')")
-    public UserTO delete(final String username) {
-        LOG.debug("User delete called with {}", username);
-
-        UserTO result = binder.getUserTO(username);
-        long userId = result.getId();
-
-        return doDelete(userId);
-    }
-
-    protected UserTO setStatus(final SyncopeUser user, final String token,
-            final PropagationRequestTO propagationRequestTO, final boolean status, final String task) {
-
-        LOG.debug("About to set 'enabled:{}' status to {}", user, status);
+        SyncopeUser user = binder.getUserFromId(statusMod.getId());
 
         WorkflowResult<Long> updated;
-        if (propagationRequestTO == null || propagationRequestTO.isOnSyncope()) {
-            updated = setStatusOnWfAdapter(user, token, task);
+        if (statusMod.isOnSyncope()) {
+            updated = setStatusOnWfAdapter(user, statusMod);
         } else {
-            updated = new WorkflowResult<Long>(user.getId(), null, task);
+            updated = new WorkflowResult<Long>(user.getId(), null, statusMod.getType().name().toLowerCase());
         }
 
         // Resources to exclude from propagation
         Set<String> resourcesToBeExcluded = new HashSet<String>(user.getResourceNames());
-        if (propagationRequestTO != null) {
-            resourcesToBeExcluded.removeAll(propagationRequestTO.getResources());
-        }
+        resourcesToBeExcluded.removeAll(statusMod.getResourceNames());
 
-        List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(user, status, resourcesToBeExcluded);
+        List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+                user, statusMod.getType() != StatusMod.ModType.SUSPEND, resourcesToBeExcluded);
         taskExecutor.execute(tasks);
 
         notificationManager.createTasks(updated.getResult(), updated.getPerformedTasks());
@@ -516,19 +424,8 @@ public class UserController {
         return savedTO;
     }
 
-    protected WorkflowResult<Long> setStatusOnWfAdapter(final SyncopeUser user, final String token, final String task) {
-        WorkflowResult<Long> updated;
-        if ("suspend".equals(task)) {
-            updated = uwfAdapter.suspend(user.getId());
-        } else if ("reactivate".equals(task)) {
-            updated = uwfAdapter.reactivate(user.getId());
-        } else {
-            updated = uwfAdapter.activate(user.getId(), token);
-        }
-        return updated;
-    }
-
-    protected UserTO doDelete(final Long userId) {
+    @PreAuthorize("hasRole('USER_DELETE')")
+    public UserTO delete(final Long userId) {
         LOG.debug("User delete called for {}", userId);
 
         List<SyncopeRole> ownedRoles = roleDAO.findOwned(binder.getUserFromId(userId));
@@ -558,8 +455,8 @@ public class UserController {
         final UserTO userTO = new UserTO();
         userTO.setId(userId);
 
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+                getBean(PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -583,8 +480,8 @@ public class UserController {
             + "(hasRole('USER_UPDATE') and "
             + "(#bulkAction.operation == #bulkAction.operation.REACTIVATE or "
             + "#bulkAction.operation == #bulkAction.operation.SUSPEND))")
-    public BulkActionRes bulkAction(final BulkAction bulkAction) {
-        LOG.debug("Bulk action '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
+    public BulkActionRes bulk(final BulkAction bulkAction) {
+        LOG.debug("Bulk '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
 
         BulkActionRes res = new BulkActionRes();
 
@@ -592,33 +489,42 @@ public class UserController {
             case DELETE:
                 for (String userId : bulkAction.getTargets()) {
                     try {
-                        res.add(doDelete(Long.valueOf(userId)).getId(), Status.SUCCESS);
+                        res.add(delete(Long.valueOf(userId)).getId(), Status.SUCCESS);
                     } catch (Exception e) {
                         LOG.error("Error performing delete for user {}", userId, e);
                         res.add(userId, Status.FAILURE);
                     }
                 }
                 break;
+
             case SUSPEND:
                 for (String userId : bulkAction.getTargets()) {
+                    StatusMod statusMod = new StatusMod();
+                    statusMod.setId(Long.valueOf(userId));
+                    statusMod.setType(StatusMod.ModType.SUSPEND);
                     try {
-                        res.add(suspend(Long.valueOf(userId)).getId(), Status.SUCCESS);
+                        res.add(status(statusMod).getId(), Status.SUCCESS);
                     } catch (Exception e) {
                         LOG.error("Error performing suspend for user {}", userId, e);
                         res.add(userId, Status.FAILURE);
                     }
                 }
                 break;
+
             case REACTIVATE:
                 for (String userId : bulkAction.getTargets()) {
+                    StatusMod statusMod = new StatusMod();
+                    statusMod.setId(Long.valueOf(userId));
+                    statusMod.setType(StatusMod.ModType.REACTIVATE);
                     try {
-                        res.add(reactivate(Long.valueOf(userId)).getId(), Status.SUCCESS);
+                        res.add(status(statusMod).getId(), Status.SUCCESS);
                     } catch (Exception e) {
                         LOG.error("Error performing reactivate for user {}", userId, e);
                         res.add(userId, Status.FAILURE);
                     }
                 }
                 break;
+
             default:
         }
 
@@ -626,7 +532,8 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
+    @Override
     public UserTO unlink(final Long userId, final Collection<String> resources) {
         LOG.debug("About to unlink user({}) and resources {}", userId, resources);
 
@@ -648,7 +555,8 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
+    @Override
     public UserTO unassign(final Long userId, final Collection<String> resources) {
         LOG.debug("About to unassign user({}) and resources {}", userId, resources);
 
@@ -660,7 +568,8 @@ public class UserController {
     }
 
     @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
+    @Override
     public UserTO deprovision(final Long userId, final Collection<String> resources) {
         LOG.debug("About to deprovision user({}) from resources {}", userId, resources);
 
@@ -670,8 +579,8 @@ public class UserController {
         noPropResourceName.removeAll(resources);
 
         final List<PropagationTask> tasks = propagationManager.getUserDeleteTaskIds(userId, noPropResourceName);
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
+                getBean(PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java Wed Oct 30 11:26:19 2013
@@ -21,6 +21,7 @@ package org.apache.syncope.core.rest.con
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import javax.annotation.Resource;
 import javax.persistence.RollbackException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.mod.UserMod;

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=1537047&r1=1537046&r2=1537047&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 Wed Oct 30 11:26:19 2013
@@ -61,11 +61,12 @@ import org.springframework.stereotype.Co
 import org.springframework.transaction.annotation.Transactional;
 
 @Component
-@Transactional(rollbackFor = {Throwable.class})
+@Transactional(rollbackFor = { Throwable.class })
 public class UserDataBinder extends AbstractAttributableDataBinder {
 
     private static final String[] IGNORE_USER_PROPERTIES = {
-        "memberships", "attrs", "derAttrs", "virAttrs", "resources"};
+        "memberships", "attrs", "derAttrs", "virAttrs", "resources"
+    };
 
     @Autowired
     private ConnObjectUtil connObjectUtil;
@@ -179,8 +180,8 @@ public class UserDataBinder extends Abst
         try {
             user.setPassword(password, getPredefinedCipherAlgoritm(), passwordHistorySize);
         } catch (NotFoundException e) {
-            final SyncopeClientException invalidCiperAlgorithm =
-                    SyncopeClientException.build(ClientExceptionType.NotFound);
+            final SyncopeClientException invalidCiperAlgorithm = SyncopeClientException.build(
+                    ClientExceptionType.NotFound);
             invalidCiperAlgorithm.getElements().add(e.getMessage());
             scce.addException(invalidCiperAlgorithm);
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java Wed Oct 30 11:26:19 2013
@@ -30,10 +30,10 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
 import org.apache.syncope.common.types.EntityViolationType;
 import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.persistence.dao.MissingConfKeyException;
@@ -121,8 +121,7 @@ public class RestServiceExceptionMapper 
 
     private Response getSyncopeClientExceptionResponse(final SyncopeClientException ex) {
         ResponseBuilder responseBuilder = Response.status(ex.getType().getResponseStatus());
-        responseBuilder.header(
-                SyncopeConstants.REST_EXCEPTION_TYPE_HEADER, ex.getType().getHeaderValue());
+        responseBuilder.header(RESTHeaders.EXCEPTION_TYPE.toString(), ex.getType().getHeaderValue());
 
         for (Object element : ex.getElements()) {
             responseBuilder.header(ex.getType().getElementHeaderName(), element);
@@ -138,8 +137,7 @@ public class RestServiceExceptionMapper 
 
         ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
         for (SyncopeClientException sce : ex.getExceptions()) {
-            responseBuilder.header(
-                    SyncopeConstants.REST_EXCEPTION_TYPE_HEADER, sce.getType().getHeaderValue());
+            responseBuilder.header(RESTHeaders.EXCEPTION_TYPE.toString(), sce.getType().getHeaderValue());
 
             for (Object element : sce.getElements()) {
                 responseBuilder.header(sce.getType().getElementHeaderName(), element);
@@ -178,7 +176,7 @@ public class RestServiceExceptionMapper 
 
             ClientExceptionType exType = ClientExceptionType.valueOf("Invalid" + iee.getEntityClassSimpleName());
 
-            builder.header(SyncopeConstants.REST_EXCEPTION_TYPE_HEADER, exType.getHeaderValue());
+            builder.header(RESTHeaders.EXCEPTION_TYPE.toString(), exType.getHeaderValue());
 
             for (Map.Entry<Class<?>, Set<EntityViolationType>> violation : iee.getViolations().entrySet()) {
                 for (EntityViolationType violationType : violation.getValue()) {
@@ -225,8 +223,7 @@ public class RestServiceExceptionMapper 
     private Response buildResponse(final ResponseBuilder responseBuilder, final ClientExceptionType hType,
             final String msg) {
 
-        return responseBuilder.header(
-                SyncopeConstants.REST_EXCEPTION_TYPE_HEADER, hType.getHeaderValue()).
+        return responseBuilder.header(RESTHeaders.EXCEPTION_TYPE.toString(), hType.getHeaderValue()).
                 header(hType.getElementHeaderName(), msg).
                 build();
     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/AbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/AbstractServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/AbstractServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/AbstractServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -19,9 +19,16 @@
 package org.apache.syncope.core.services;
 
 import javax.ws.rs.core.UriInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 abstract class AbstractServiceImpl implements ContextAware {
 
+    /**
+     * Logger.
+     */
+    protected static final Logger LOG = LoggerFactory.getLogger(AbstractServiceImpl.class);
+
     protected UriInfo uriInfo;
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -22,17 +22,16 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URI;
 import java.util.List;
-import java.util.Set;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.StreamingOutput;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ConfigurationService;
 import org.apache.syncope.common.to.ConfigurationTO;
 import org.apache.syncope.common.to.MailTemplateTO;
 import org.apache.syncope.common.to.ValidatorTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.core.persistence.dao.impl.ContentLoader;
 import org.apache.syncope.core.rest.controller.ConfigurationController;
@@ -50,7 +49,7 @@ public class ConfigurationServiceImpl ex
         ConfigurationTO created = controller.create(configurationTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
         return Response.created(location).
-                header(SyncopeConstants.REST_RESOURCE_ID_HEADER, created.getKey()).
+                header(RESTHeaders.RESOURCE_ID.toString(), created.getKey()).
                 build();
     }
 
@@ -63,11 +62,10 @@ public class ConfigurationServiceImpl ex
                 controller.export(os);
             }
         };
-        return Response.ok(sout)
-                .type(MediaType.TEXT_XML)
-                .header(SyncopeConstants.CONTENT_DISPOSITION_HEADER,
-                "attachment; filename=" + ContentLoader.CONTENT_XML)
-                .build();
+        return Response.ok(sout).
+                type(MediaType.TEXT_XML).
+                header(RESTHeaders.CONTENT_DISPOSITION.toString(), "attachment; filename=" + ContentLoader.CONTENT_XML).
+                build();
     }
 
     @Override
@@ -77,14 +75,14 @@ public class ConfigurationServiceImpl ex
 
     @Override
     @SuppressWarnings("unchecked")
-    public Set<MailTemplateTO> getMailTemplates() {
-        return CollectionWrapper.wrapMailTemplates(controller.getMailTemplates());
+    public List<MailTemplateTO> getMailTemplates() {
+        return CollectionWrapper.wrap(controller.getMailTemplates(), MailTemplateTO.class);
     }
 
     @Override
     @SuppressWarnings("unchecked")
-    public Set<ValidatorTO> getValidators() {
-        return CollectionWrapper.wrapValidators(controller.getValidators());
+    public List<ValidatorTO> getValidators() {
+        return CollectionWrapper.wrap(controller.getValidators(), ValidatorTO.class);
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -22,7 +22,6 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ConnectorService;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
@@ -31,6 +30,7 @@ import org.apache.syncope.common.to.Conn
 import org.apache.syncope.common.to.ConnInstanceTO;
 import org.apache.syncope.common.to.SchemaTO;
 import org.apache.syncope.common.types.ConnConfProperty;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.core.rest.controller.ConnectorController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -45,7 +45,9 @@ public class ConnectorServiceImpl extend
     public Response create(final ConnInstanceTO connInstanceTO) {
         ConnInstanceTO connInstance = controller.create(connInstanceTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(connInstance.getId())).build();
-        return Response.created(location).header(SyncopeConstants.REST_RESOURCE_ID_HEADER, connInstance.getId()).build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), connInstance.getId()).
+                build();
     }
 
     @Override
@@ -120,7 +122,7 @@ public class ConnectorServiceImpl extend
     }
 
     @Override
-    public BulkActionRes bulkAction(final BulkAction bulkAction) {
-        return controller.bulkAction(bulkAction);
+    public BulkActionRes bulk(final BulkAction bulkAction) {
+        return controller.bulk(bulkAction);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -18,8 +18,7 @@
  */
 package org.apache.syncope.core.services;
 
-import java.util.HashSet;
-import java.util.Set;
+import java.util.List;
 
 import org.apache.syncope.common.services.EntitlementService;
 import org.apache.syncope.common.to.EntitlementTO;
@@ -35,14 +34,12 @@ public class EntitlementServiceImpl exte
     private EntitlementController controller;
 
     @Override
-    public Set<EntitlementTO> getAllEntitlements() {
-        Set<String> entitlements = new HashSet<String>(controller.listEntitlements());
-        return CollectionWrapper.wrap(entitlements);
+    public List<EntitlementTO> getAllEntitlements() {
+        return CollectionWrapper.wrap(controller.getAll(), EntitlementTO.class);
     }
 
     @Override
-    public Set<EntitlementTO> getMyEntitlements() {
-        Set<String> entitlements = controller.getEntitlements();
-        return CollectionWrapper.wrap(entitlements);
+    public List<EntitlementTO> getOwnEntitlements() {
+        return CollectionWrapper.wrap(controller.getOwn(), EntitlementTO.class);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -23,9 +23,9 @@ import java.util.List;
 
 import javax.ws.rs.core.Response;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.NotificationService;
 import org.apache.syncope.common.to.NotificationTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.core.rest.controller.NotificationController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -40,9 +40,9 @@ public class NotificationServiceImpl ext
     public Response create(final NotificationTO notificationTO) {
         NotificationTO createdNotificationTO = controller.create(notificationTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdNotificationTO.getId())).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, createdNotificationTO.getId())
-                .build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), createdNotificationTO.getId()).
+                build();
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -20,16 +20,15 @@ package org.apache.syncope.core.services
 
 import java.net.URI;
 import java.util.List;
-import java.util.Set;
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.PolicyService;
 import org.apache.syncope.common.to.AccountPolicyTO;
 import org.apache.syncope.common.to.CorrelationRuleClassTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
 import org.apache.syncope.common.to.AbstractPolicyTO;
 import org.apache.syncope.common.to.SyncPolicyTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.core.rest.controller.PolicyController;
@@ -46,7 +45,9 @@ public class PolicyServiceImpl extends A
     public <T extends AbstractPolicyTO> Response create(final T policyTO) {
         AbstractPolicyTO policy = policyController.create(policyTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(policy.getId())).build();
-        return Response.created(location).header(SyncopeConstants.REST_RESOURCE_ID_HEADER, policy.getId()).build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), policy.getId()).
+                build();
     }
 
     @Override
@@ -116,7 +117,7 @@ public class PolicyServiceImpl extends A
     }
 
     @Override
-    public Set<CorrelationRuleClassTO> getSyncCorrelationRuleClasses() {
-        return CollectionWrapper.wrapSyncCorrelationRuleClasses(policyController.getSyncCorrelationRuleClasses());
+    public List<CorrelationRuleClassTO> getSyncCorrelationRuleClasses() {
+        return CollectionWrapper.wrap(policyController.getSyncCorrelationRuleClasses(), CorrelationRuleClassTO.class);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -24,11 +24,11 @@ import java.net.URI;
 import java.util.List;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.StreamingOutput;
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ReportService;
 import org.apache.syncope.common.types.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.ReportExecExportFormat;
 import org.apache.syncope.core.persistence.beans.ReportExec;
 import org.apache.syncope.core.persistence.dao.ReportDAO;
@@ -49,9 +49,9 @@ public class ReportServiceImpl extends A
     public Response create(final ReportTO reportTO) {
         ReportTO createdReportTO = controller.create(reportTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdReportTO.getId())).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, createdReportTO.getId())
-                .build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), createdReportTO.getId()).
+                build();
     }
 
     @Override
@@ -102,9 +102,9 @@ public class ReportServiceImpl extends A
         };
         String disposition = "attachment; filename=" + reportExec.getReport().getName() + "." + format.name().
                 toLowerCase();
-        return Response.ok(sout)
-                .header(SyncopeConstants.CONTENT_DISPOSITION_HEADER, disposition)
-                .build();
+        return Response.ok(sout).
+                header(RESTHeaders.CONTENT_DISPOSITION.toString(), disposition).
+                build();
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -19,13 +19,15 @@
 package org.apache.syncope.core.services;
 
 import java.net.URI;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
+import javax.ws.rs.BadRequestException;
 
 import javax.ws.rs.core.Response;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ResourceService;
+import org.apache.syncope.common.to.AbstractAttributableTO;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.BulkAssociationAction;
@@ -33,8 +35,12 @@ import org.apache.syncope.common.to.Conn
 import org.apache.syncope.common.to.PropagationActionClassTO;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.core.rest.controller.AbstractResourceAssociator;
 import org.apache.syncope.core.rest.controller.ResourceController;
+import org.apache.syncope.core.rest.controller.RoleController;
+import org.apache.syncope.core.rest.controller.UserController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -44,13 +50,19 @@ public class ResourceServiceImpl extends
     @Autowired
     private ResourceController controller;
 
+    @Autowired
+    private UserController userController;
+
+    @Autowired
+    private RoleController roleController;
+
     @Override
     public Response create(final ResourceTO resourceTO) {
-        ResourceTO resource = controller.create(resourceTO);
-        URI location = uriInfo.getAbsolutePathBuilder().path(resource.getName()).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, resource.getName())
-                .build();
+        ResourceTO created = controller.create(resourceTO);
+        URI location = uriInfo.getAbsolutePathBuilder().path(created.getName()).build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), created.getName()).
+                build();
     }
 
     @Override
@@ -69,8 +81,8 @@ public class ResourceServiceImpl extends
     }
 
     @Override
-    public Set<PropagationActionClassTO> getPropagationActionsClasses() {
-        return CollectionWrapper.wrapPropagationActionClasses(controller.getPropagationActionsClasses());
+    public List<PropagationActionClassTO> getPropagationActionsClasses() {
+        return CollectionWrapper.wrap(controller.getPropagationActionsClasses(), PropagationActionClassTO.class);
     }
 
     @Override
@@ -94,17 +106,51 @@ public class ResourceServiceImpl extends
     }
 
     @Override
-    public BulkActionRes bulkAction(final BulkAction bulkAction) {
-        return controller.bulkAction(bulkAction);
+    public BulkActionRes bulk(final BulkAction bulkAction) {
+        return controller.bulk(bulkAction);
     }
 
     @Override
-    public BulkActionRes usersBulkAssociationAction(final String resourceName, final BulkAssociationAction bulkAction) {
-        return controller.usersBulkAssociationAction(resourceName, bulkAction);
-    }
+    public BulkActionRes bulkAssociation(final String resourceName,
+            final BulkAssociationAction bulkAssociationAction, final AttributableType type) {
 
-    @Override
-    public BulkActionRes rolesBulkAssociationAction(final String resourceName, final BulkAssociationAction bulkAction) {
-        return controller.rolesBulkAssociationAction(resourceName, bulkAction);
+        if (bulkAssociationAction.getOperation() == null || type == AttributableType.MEMBERSHIP) {
+            throw new BadRequestException();
+        }
+
+        AbstractResourceAssociator<? extends AbstractAttributableTO> associator = type == AttributableType.USER
+                ? userController
+                : roleController;
+
+        final BulkActionRes res = new BulkActionRes();
+
+        for (Long id : bulkAssociationAction.getTargets()) {
+            final Set<String> resources = Collections.singleton(resourceName);
+            try {
+                switch (bulkAssociationAction.getOperation()) {
+                    case DEPROVISION:
+                        associator.deprovision(id, resources);
+                        break;
+
+                    case UNASSIGN:
+                        associator.unassign(id, resources);
+                        break;
+
+                    case UNLINK:
+                        associator.unlink(id, resources);
+                        break;
+
+                    default:
+                }
+
+                res.add(id, BulkActionRes.Status.SUCCESS);
+            } catch (Exception e) {
+                LOG.warn("While executing {} on {} {}", bulkAssociationAction.getOperation(), type, id, e);
+                res.add(id, BulkActionRes.Status.FAILURE);
+            }
+        }
+
+        return res;
     }
+
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -24,13 +24,15 @@ import java.util.List;
 import javax.ws.rs.ServiceUnavailableException;
 import javax.ws.rs.core.Response;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
 import org.apache.syncope.common.services.RoleService;
-import org.apache.syncope.common.to.PropagationTargetsTO;
+import org.apache.syncope.common.to.ResourceNameTO;
 import org.apache.syncope.common.to.RoleTO;
+import org.apache.syncope.common.types.RESTHeaders;
+import org.apache.syncope.common.types.ResourceAssociationActionType;
+import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.core.rest.controller.RoleController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -55,15 +57,17 @@ public class RoleServiceImpl extends Abs
     public Response create(final RoleTO roleTO) {
         RoleTO created = controller.create(roleTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(created.getId())).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, created.getId())
-                .entity(created)
-                .build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), created.getId()).
+                entity(created).
+                build();
     }
 
     @Override
-    public RoleTO delete(final Long roleId) {
-        return controller.delete(roleId);
+    public Response delete(final Long roleId) {
+        RoleTO deleted = controller.delete(roleId);
+        return Response.ok(deleted).
+                build();
     }
 
     @Override
@@ -104,28 +108,41 @@ public class RoleServiceImpl extends Abs
     }
 
     @Override
-    public RoleTO selfRead(final Long roleId) {
-        return controller.selfRead(roleId);
+    public RoleTO readSelf(final Long roleId) {
+        return controller.readSelf(roleId);
     }
 
     @Override
-    public RoleTO update(final Long roleId, final RoleMod roleMod) {
-        roleMod.setId(roleId);
-        return controller.update(roleMod);
+    public Response update(final Long roleId, final RoleMod roleMod) {
+        RoleTO updated = controller.update(roleMod);
+        return Response.ok(updated).
+                build();
     }
 
     @Override
-    public RoleTO unlink(final Long roleId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.unlink(roleId, propagationTargetsTO.getResources());
-    }
+    public Response associate(final Long roleId, final ResourceAssociationActionType type,
+            final List<ResourceNameTO> resourceNames) {
 
-    @Override
-    public RoleTO unassign(final Long roleId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.unassign(roleId, propagationTargetsTO.getResources());
-    }
+        RoleTO updated = null;
 
-    @Override
-    public RoleTO deprovision(final Long roleId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.deprovision(roleId, propagationTargetsTO.getResources());
+        switch (type) {
+            case UNLINK:
+                updated = controller.unlink(roleId, CollectionWrapper.unwrap(resourceNames));
+                break;
+
+            case UNASSIGN:
+                updated = controller.unassign(roleId, CollectionWrapper.unwrap(resourceNames));
+                break;
+
+            case DEPROVISION:
+                updated = controller.deprovision(roleId, CollectionWrapper.unwrap(resourceNames));
+                break;
+
+            default:
+                updated = controller.read(roleId);
+        }
+
+        return Response.ok(updated).
+                build();
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -23,10 +23,10 @@ import java.util.List;
 
 import javax.ws.rs.core.Response;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.SchemaService;
 import org.apache.syncope.common.to.AbstractSchemaTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.core.rest.controller.SchemaController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,9 +45,9 @@ public class SchemaServiceImpl extends A
         T response = controller.create(attrType, schemaType, schemaTO);
 
         URI location = uriInfo.getAbsolutePathBuilder().path(response.getName()).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, response.getName())
-                .build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), response.getName()).
+                build();
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -20,10 +20,8 @@ package org.apache.syncope.core.services
 
 import java.net.URI;
 import java.util.List;
-import java.util.Set;
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.TaskService;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
@@ -34,6 +32,7 @@ import org.apache.syncope.common.to.Sync
 import org.apache.syncope.common.to.SyncTaskTO;
 import org.apache.syncope.common.to.TaskExecTO;
 import org.apache.syncope.common.to.AbstractTaskTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.util.CollectionWrapper;
@@ -62,7 +61,9 @@ public class TaskServiceImpl extends Abs
         }
 
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdTask.getId())).build();
-        return Response.created(location).header(SyncopeConstants.REST_RESOURCE_ID_HEADER, createdTask.getId()).build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), createdTask.getId()).
+                build();
     }
 
     @Override
@@ -81,13 +82,13 @@ public class TaskServiceImpl extends Abs
     }
 
     @Override
-    public Set<JobClassTO> getJobClasses() {
-        return CollectionWrapper.wrapJobClasses(controller.getJobClasses());
+    public List<JobClassTO> getJobClasses() {
+        return CollectionWrapper.wrap(controller.getJobClasses(), JobClassTO.class);
     }
 
     @Override
-    public Set<SyncActionClassTO> getSyncActionsClasses() {
-        return CollectionWrapper.wrapSyncActionClasses(controller.getSyncActionsClasses());
+    public List<SyncActionClassTO> getSyncActionsClasses() {
+        return CollectionWrapper.wrap(controller.getSyncActionsClasses(), SyncActionClassTO.class);
     }
 
     @Override
@@ -128,7 +129,7 @@ public class TaskServiceImpl extends Abs
     }
 
     @Override
-    public BulkActionRes bulkAction(final BulkAction bulkAction) {
-        return controller.bulkAction(bulkAction);
+    public BulkActionRes bulk(final BulkAction bulkAction) {
+        return controller.bulk(bulkAction);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserRequestServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserRequestServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserRequestServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserRequestServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -23,11 +23,11 @@ import java.util.List;
 
 import javax.ws.rs.core.Response;
 
-import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.services.UserRequestService;
 import org.apache.syncope.common.to.UserRequestTO;
 import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.core.rest.controller.UserRequestController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -40,17 +40,12 @@ public class UserRequestServiceImpl exte
 
     @Override
     public Response getOptions() {
-        return Response.ok().header("Allow", "GET,POST,OPTIONS,HEAD")
-                .header(SYNCOPE_CREATE_ALLOWED, controller.isCreateAllowed()).
+        return Response.ok().header("Allow", "GET,POST,OPTIONS,HEAD").
+                header(RESTHeaders.USERREQUEST_CREATE_ALLOWED.toString(), controller.isCreateAllowed()).
                 build();
     }
 
     @Override
-    public boolean isCreateAllowed() {
-        return controller.isCreateAllowed();
-    }
-
-    @Override
     public Response create(final UserRequestTO userRequestTO) {
         UserRequestTO outUserRequestTO;
         switch (userRequestTO.getType()) {
@@ -69,9 +64,9 @@ public class UserRequestServiceImpl exte
         }
 
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(outUserRequestTO.getId())).build();
-        return Response.created(location)
-                .header(SyncopeConstants.REST_RESOURCE_ID_HEADER, outUserRequestTO.getId())
-                .build();
+        return Response.created(location).
+                header(RESTHeaders.RESOURCE_ID.toString(), outUserRequestTO.getId()).
+                build();
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -21,16 +21,18 @@ package org.apache.syncope.core.services
 import java.net.URI;
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.SyncopeConstants;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
 import org.apache.syncope.common.services.UserService;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
-import org.apache.syncope.common.to.PropagationRequestTO;
-import org.apache.syncope.common.to.PropagationTargetsTO;
+import org.apache.syncope.common.to.ResourceNameTO;
 import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.types.RESTHeaders;
+import org.apache.syncope.common.types.ResourceAssociationActionType;
+import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.core.rest.controller.UserController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -42,24 +44,17 @@ public class UserServiceImpl extends Abs
     private UserController controller;
 
     @Override
-    public UserTO activate(final Long userId, final String token) {
-        return controller.activate(userId, token);
+    public Response getUsername(final Long userId) {
+        return Response.ok().header("Allow", "GET,POST,OPTIONS,HEAD").
+                header(RESTHeaders.USERNAME.toString(), controller.getUsername(userId)).
+                build();
     }
 
     @Override
-    public UserTO activate(final Long userId, final String token, final PropagationRequestTO propagationRequestTO) {
-        return controller.activate(userId, token, propagationRequestTO);
-    }
-
-    @Override
-    public UserTO activateByUsername(final String username, final String token) {
-        return controller.activate(username, token);
-    }
-
-    @Override
-    public UserTO activateByUsername(final String username, final String token,
-            final PropagationRequestTO propagationRequestTO) {
-        return controller.activate(username, token, propagationRequestTO);
+    public Response getUserId(final String username) {
+        return Response.ok().header("Allow", "GET,POST,OPTIONS,HEAD").
+                header(RESTHeaders.USER_ID.toString(), controller.getUserId(username)).
+                build();
     }
 
     @Override
@@ -72,14 +67,16 @@ public class UserServiceImpl extends Abs
         UserTO created = controller.create(userTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(created.getId())).build();
         return Response.created(location).
-                header(SyncopeConstants.REST_RESOURCE_ID_HEADER, created.getId()).
-                entity(created)
-                .build();
+                header(RESTHeaders.RESOURCE_ID.toString(), created.getId()).
+                entity(created).
+                build();
     }
 
     @Override
-    public UserTO delete(final Long userId) {
-        return controller.delete(userId);
+    public Response delete(final Long userId) {
+        UserTO deleted = controller.delete(userId);
+        return Response.ok(deleted).
+                build();
     }
 
     @Override
@@ -93,38 +90,13 @@ public class UserServiceImpl extends Abs
     }
 
     @Override
-    public UserTO reactivate(final Long userId) {
-        return controller.reactivate(userId);
-    }
-
-    @Override
-    public UserTO reactivate(final Long userId, final PropagationRequestTO propagationRequestTO) {
-        return controller.reactivate(userId, propagationRequestTO);
-    }
-
-    @Override
-    public UserTO reactivateByUsername(final String username) {
-        return controller.reactivate(username);
-    }
-
-    @Override
-    public UserTO reactivateByUsername(final String username, final PropagationRequestTO propagationRequestTO) {
-        return controller.reactivate(username, propagationRequestTO);
-    }
-
-    @Override
     public UserTO read(final Long userId) {
         return controller.read(userId);
     }
 
     @Override
-    public UserTO read(final String username) {
-        return controller.read(username);
-    }
-
-    @Override
     public UserTO readSelf() {
-        return controller.read();
+        return controller.readSelf();
     }
 
     @Override
@@ -135,6 +107,7 @@ public class UserServiceImpl extends Abs
     @Override
     public List<UserTO> search(final NodeCond searchCondition, final int page, final int size)
             throws InvalidSearchConditionException {
+
         return controller.search(searchCondition, page, size);
     }
 
@@ -144,48 +117,50 @@ public class UserServiceImpl extends Abs
     }
 
     @Override
-    public UserTO suspend(final Long userId) {
-        return controller.suspend(userId);
+    public Response update(final Long userId, final UserMod userMod) {
+        userMod.setId(userId);
+        UserTO updated = controller.update(userMod);
+        return Response.ok(updated).
+                build();
     }
 
     @Override
-    public UserTO suspend(final Long userId, final PropagationRequestTO propagationRequestTO) {
-        return controller.suspend(userId, propagationRequestTO);
+    public Response status(final Long userId, final StatusMod statusMod) {
+        statusMod.setId(userId);
+        UserTO updated = controller.status(statusMod);
+        return Response.ok(updated).
+                build();
     }
 
     @Override
-    public UserTO suspendByUsername(final String username) {
-        return controller.suspend(username);
+    public BulkActionRes bulk(final BulkAction bulkAction) {
+        return controller.bulk(bulkAction);
     }
 
     @Override
-    public UserTO suspendByUsername(final String username, final PropagationRequestTO propagationRequestTO) {
-        return controller.suspend(username, propagationRequestTO);
-    }
+    public Response associate(final Long userId, final ResourceAssociationActionType type,
+            final List<ResourceNameTO> resourceNames) {
 
-    @Override
-    public UserTO update(final Long userId, final UserMod userMod) {
-        userMod.setId(userId);
-        return controller.update(userMod);
-    }
+        UserTO updated = null;
 
-    @Override
-    public BulkActionRes bulkAction(final BulkAction bulkAction) {
-        return controller.bulkAction(bulkAction);
-    }
+        switch (type) {
+            case UNLINK:
+                updated = controller.unlink(userId, CollectionWrapper.unwrap(resourceNames));
+                break;
 
-    @Override
-    public UserTO unlink(final Long userId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.unlink(userId, propagationTargetsTO.getResources());
-    }
+            case UNASSIGN:
+                updated = controller.unassign(userId, CollectionWrapper.unwrap(resourceNames));
+                break;
 
-    @Override
-    public UserTO unassign(final Long userId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.unassign(userId, propagationTargetsTO.getResources());
-    }
+            case DEPROVISION:
+                updated = controller.deprovision(userId, CollectionWrapper.unwrap(resourceNames));
+                break;
 
-    @Override
-    public UserTO deprovision(final Long userId, final PropagationTargetsTO propagationTargetsTO) {
-        return controller.deprovision(userId, propagationTargetsTO.getResources());
+            default:
+                updated = controller.read(userId);
+        }
+
+        return Response.ok(updated).
+                build();
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserWorkflowServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserWorkflowServiceImpl.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserWorkflowServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserWorkflowServiceImpl.java Wed Oct 30 11:26:19 2013
@@ -39,7 +39,7 @@ public class UserWorkflowServiceImpl imp
     }
 
     @Override
-    public UserTO executeWorkflow(final String taskId, final UserTO userTO) {
+    public UserTO executeTask(final String taskId, final UserTO userTO) {
         return controller.executeWorkflow(userTO, taskId);
     }
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java Wed Oct 30 11:26:19 2013
@@ -33,6 +33,8 @@ import org.apache.http.HttpStatus;
 import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.client.SyncopeClientFactoryBean;
 import org.apache.syncope.common.mod.AttributeMod;
+import org.apache.syncope.common.mod.RoleMod;
+import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.services.ConfigurationService;
 import org.apache.syncope.common.services.ConnectorService;
 import org.apache.syncope.common.services.EntitlementService;
@@ -55,6 +57,7 @@ import org.apache.syncope.common.to.Reso
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.core.util.PasswordEncoder;
 import org.junit.BeforeClass;
@@ -66,7 +69,7 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:testJDBCContext.xml"})
+@ContextConfiguration(locations = { "classpath:testJDBCContext.xml" })
 public abstract class AbstractTest {
 
     /**
@@ -199,6 +202,19 @@ public abstract class AbstractTest {
         return response.readEntity(UserTO.class);
     }
 
+    protected UserTO readUser(final String username) {
+        return userService.read(Long.valueOf(
+                userService.getUserId(username).getHeaderString(RESTHeaders.USER_ID.toString())));
+    }
+
+    protected UserTO updateUser(final UserMod userMod) {
+        return userService.update(userMod.getId(), userMod).readEntity(UserTO.class);
+    }
+
+    protected UserTO deleteUser(final Long id) {
+        return userService.delete(id).readEntity(UserTO.class);
+    }
+
     @SuppressWarnings("unchecked")
     protected <T extends AbstractSchemaTO> T createSchema(final AttributableType kind,
             final SchemaType type, final T schemaTO) {
@@ -214,7 +230,7 @@ public abstract class AbstractTest {
         return (T) adminClient.getObject(response.getLocation(), SchemaService.class, schemaTO.getClass());
     }
 
-    protected RoleTO createRole(final RoleService roleService, final RoleTO newRoleTO) {
+    protected RoleTO createRole(final RoleTO newRoleTO) {
         Response response = roleService.create(newRoleTO);
         if (response.getStatus() != org.apache.http.HttpStatus.SC_CREATED) {
             Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
@@ -225,6 +241,14 @@ public abstract class AbstractTest {
         return adminClient.getObject(response.getLocation(), RoleService.class, RoleTO.class);
     }
 
+    protected RoleTO updateRole(final RoleMod roleMod) {
+        return roleService.update(roleMod.getId(), roleMod).readEntity(RoleTO.class);
+    }
+
+    protected RoleTO deleteRole(final Long id) {
+        return roleService.delete(id).readEntity(RoleTO.class);
+    }
+
     @SuppressWarnings("unchecked")
     protected <T extends AbstractPolicyTO> T createPolicy(final T policy) {
         Response response = policyService.create(policy);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java Wed Oct 30 11:26:19 2013
@@ -31,6 +31,7 @@ import java.util.Set;
 
 import javax.ws.rs.core.Response;
 import org.apache.http.HttpStatus;
+import org.apache.syncope.common.mod.StatusMod;
 
 import org.apache.syncope.common.search.AttributeCond;
 import org.apache.syncope.common.search.NodeCond;
@@ -47,6 +48,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.AttributeSchemaType;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -58,14 +60,15 @@ public class AuthenticationTestITCase ex
     @Test
     public void testAdminEntitlements() {
         // 1. as anonymous, read all available entitlements
-        Set<EntitlementTO> allEntitlements = entitlementService.getAllEntitlements();
+        List<EntitlementTO> allEntitlements = entitlementService.getAllEntitlements();
         assertNotNull(allEntitlements);
         assertFalse(allEntitlements.isEmpty());
 
         // 2. as admin, read own entitlements
-        Set<EntitlementTO> adminEntitlements = entitlementService.getMyEntitlements();
+        List<EntitlementTO> adminEntitlements = entitlementService.getOwnEntitlements();
 
-        assertEquals(allEntitlements, adminEntitlements);
+        assertEquals(new HashSet<String>(CollectionWrapper.unwrap(allEntitlements)),
+                new HashSet<String>(CollectionWrapper.unwrap(adminEntitlements)));
     }
 
     @Test
@@ -76,7 +79,7 @@ public class AuthenticationTestITCase ex
         authRoleTO.setParent(8L);
         authRoleTO.getEntitlements().add("SCHEMA_READ");
 
-        authRoleTO = createRole(roleService, authRoleTO);
+        authRoleTO = createRole(authRoleTO);
         assertNotNull(authRoleTO);
 
         String schemaName = "authTestSchema" + getUUIDString();
@@ -262,7 +265,8 @@ public class AuthenticationTestITCase ex
         assertEquals(0, getFailedLogins(userService2, userId));
 
         // authentications failed ...
-        UserService userService3 = clientFactory.create(userTO.getUsername(), "wrongpwd1").getService(UserService.class);
+        UserService userService3 = clientFactory.create(userTO.getUsername(), "wrongpwd1").
+                getService(UserService.class);
         assertReadFails(userService3, userId);
         assertReadFails(userService3, userId);
         assertReadFails(userService3, userId);
@@ -284,7 +288,9 @@ public class AuthenticationTestITCase ex
         userService2 = clientFactory.create(userTO.getUsername(), "password123").getService(UserService.class);
         assertReadFails(userService2, userId);
 
-        userTO = userService.reactivate(userTO.getId());
+        StatusMod reactivate = new StatusMod();
+        reactivate.setType(StatusMod.ModType.REACTIVATE);
+        userTO = userService.status(userTO.getId(), reactivate).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
 
@@ -301,7 +307,7 @@ public class AuthenticationTestITCase ex
         parentRole.getEntitlements().add("ROLE_1");
         parentRole.setParent(1L);
 
-        parentRole = createRole(roleService, parentRole);
+        parentRole = createRole(parentRole);
         assertNotNull(parentRole);
 
         // Child role, with no entitlements
@@ -309,7 +315,7 @@ public class AuthenticationTestITCase ex
         childRole.setName("childAdminRole");
         childRole.setParent(parentRole.getId());
 
-        childRole = createRole(roleService, childRole);
+        childRole = createRole(childRole);
         assertNotNull(childRole);
 
         // User with child role, created by admin

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java Wed Oct 30 11:26:19 2013
@@ -39,6 +39,7 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.to.ConfigurationTO;
 import org.apache.syncope.common.types.EntityViolationType;
 import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -124,7 +125,7 @@ public class ConfigurationTestITCase ext
         assertEquals(HttpStatus.SC_OK, response.getStatus());
         String contentType = response.getHeaderString(HttpHeaders.CONTENT_TYPE);
         assertTrue(contentType.contains("xml"));
-        String contentDisposition = response.getHeaderString(SyncopeConstants.CONTENT_DISPOSITION_HEADER);
+        String contentDisposition = response.getHeaderString(RESTHeaders.CONTENT_DISPOSITION.toString());
         assertNotNull(contentDisposition);
 
         Object entity = response.getEntity();

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java Wed Oct 30 11:26:19 2013
@@ -690,7 +690,7 @@ public class ConnInstanceTestITCase exte
         assertNotNull(connectorService.read(Long.valueOf(iter.next())));
         assertNotNull(connectorService.read(Long.valueOf(iter.next())));
 
-        connectorService.bulkAction(bulkAction);
+        connectorService.bulk(bulkAction);
 
         iter = bulkAction.getTargets().iterator();
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java Wed Oct 30 11:26:19 2013
@@ -36,6 +36,7 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.types.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
+import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.ReportExecExportFormat;
 import org.apache.syncope.common.types.ReportExecStatus;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -150,8 +151,8 @@ public class ReportTestITCase extends Ab
         final Response response = reportService.exportExecutionResult(execId, fmt);
         assertNotNull(response);
         assertEquals(HttpStatus.SC_OK, response.getStatus());
-        assertNotNull(response.getHeaderString(SyncopeConstants.CONTENT_DISPOSITION_HEADER));
-        assertTrue(response.getHeaderString(SyncopeConstants.CONTENT_DISPOSITION_HEADER).
+        assertNotNull(response.getHeaderString(RESTHeaders.CONTENT_DISPOSITION.toString()));
+        assertTrue(response.getHeaderString(RESTHeaders.CONTENT_DISPOSITION.toString()).
                 endsWith("." + fmt.name().toLowerCase()));
 
         Object entity = response.getEntity();

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java Wed Oct 30 11:26:19 2013
@@ -91,7 +91,7 @@ public class ResourceTestITCase extends 
 
     @Test
     public void getPropagationActionsClasses() {
-        Set<PropagationActionClassTO> actions = resourceService.getPropagationActionsClasses();
+        List<PropagationActionClassTO> actions = resourceService.getPropagationActionsClasses();
         assertNotNull(actions);
         assertFalse(actions.isEmpty());
     }
@@ -456,7 +456,7 @@ public class ResourceTestITCase extends 
         bulkAction.getTargets().add(String.valueOf("forBulk1"));
         bulkAction.getTargets().add(String.valueOf("forBulk2"));
 
-        resourceService.bulkAction(bulkAction);
+        resourceService.bulk(bulkAction);
 
         try {
             resourceService.read("forBulk1");



Mime
View raw message