You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by Jan Bernhardt <jb...@talend.com> on 2013/01/24 09:09:00 UTC

RE: svn commit: r1437557 - in /syncope/trunk: ./ client/src/main/java/org/apache/syncope/client/services/proxy/ common/src/main/java/org/apache/syncope/common/mod/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/org/apache/sy

Hi Francesco,

why did you removed StatusMod without asking for its purpose???

This was needed for future REST API! In REST all cares about resources and not processes. Therefore URLs should not look like this /enableUser or /disableUser , but rather focus on a resource like GET user/status and then return status as enabled or disabled. Or PUT operation with Status (enabled/disabled) for enabling/disabling operation.

For this purpose I introduced setStatus method in UserService, which you simply removed, as well as StatusMod...

I know that we haven't discusses final UserService Interface on the mailing list yet. But please don't remove methods without any mailinglist feedback.

Regards.
Jan

> -----Original Message-----
> From: ilgrosso@apache.org [mailto:ilgrosso@apache.org]
> Sent: Mittwoch, 23. Januar 2013 17:42
> To: commits@syncope.apache.org
> Subject: svn commit: r1437557 - in /syncope/trunk: ./
> client/src/main/java/org/apache/syncope/client/services/proxy/
> common/src/main/java/org/apache/syncope/common/mod/
> common/src/main/java/org/apache/syncope/common/services/
> common/src/main/java/org/apache/syn...
> 
> Author: ilgrosso
> Date: Wed Jan 23 16:42:04 2013
> New Revision: 1437557
> 
> URL: http://svn.apache.org/viewvc?rev=1437557&view=rev
> Log:
> Preparing modifications for SYNCOPE-122 and SYNCOPE-136 (also fixed void
> call to UserService.setStatus - now removed
> 
> Added:
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java   (with props)
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationStatusTO.java
>       - copied, changed from r1437397,
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationTO.java
> Removed:
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/mod
> /StatusMod.java
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationTO.java
> Modified:
>     syncope/trunk/   (props changed)
> 
> syncope/trunk/client/src/main/java/org/apache/syncope/client/services/pr
> oxy/UserServiceProxy.java
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/servi
> ces/UserService.java
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/A
> bstractAttributableTO.java
> 
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/
> MembershipTO.java
> 
> syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/
> ResultStatusModalPage.java
> 
> syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/U
> serRestClient.java
> 
> syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/i
> mpl/DefaultPropagationHandler.java
> 
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/ResourceController.java
> 
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/RoleController.java
> 
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/UserController.java
> 
> syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/us
> er/NoOpUserWorkflowAdapter.java
> 
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestI
> TCase.java
> 
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestI
> TCase.java
> 
> Propchange: syncope/trunk/
> ------------------------------------------------------------------------------
>   Merged /syncope/branches/1_0_X:r1437388-1437392
> 
> Modified:
> syncope/trunk/client/src/main/java/org/apache/syncope/client/services/pr
> oxy/UserServiceProxy.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apac
> he/syncope/client/services/proxy/UserServiceProxy.java?rev=1437557&r1=
> 1437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/client/src/main/java/org/apache/syncope/client/services/pr
> oxy/UserServiceProxy.java (original)
> +++
> syncope/trunk/client/src/main/java/org/apache/syncope/client/services/pr
> oxy/UserServiceProxy.java Wed Jan 23 16:42:04 2013
> @@ -20,10 +20,10 @@ package org.apache.syncope.client.servic
> 
>  import java.util.Arrays;
>  import java.util.List;
> -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.UserService;
> +import org.apache.syncope.common.to.PropagationRequestTO;
>  import org.apache.syncope.common.to.UserTO;
>  import org.apache.syncope.common.to.WorkflowFormTO;
>  import org.springframework.web.client.RestTemplate;
> @@ -113,8 +113,15 @@ public class UserServiceProxy extends Sp
> 
>      @Override
>      public UserTO activate(final long userId, final String token) {
> -        return getRestTemplate().getForObject(baseUrl +
> "user/activate/{userId}?token=" + token, UserTO.class,
> -                userId);
> +        return getRestTemplate().getForObject(baseUrl +
> "user/activate/{userId}?token=" + token, UserTO.class, userId);
> +    }
> +
> +    @Override
> +    public UserTO activate(final long userId, final String token,
> +            final PropagationRequestTO propagationRequestTO) {
> +
> +        return getRestTemplate().postForObject(baseUrl +
> "user/activate/{userId}?token=" + token, propagationRequestTO,
> +                UserTO.class, userId);
>      }
> 
>      @Override
> @@ -124,24 +131,45 @@ public class UserServiceProxy extends Sp
>      }
> 
>      @Override
> +    public UserTO activateByUsername(final String username, final String
> token,
> +            final PropagationRequestTO propagationRequestTO) {
> +
> +        return getRestTemplate().postForObject(baseUrl +
> "user/activateByUsername/{username}.json?token=" + token,
> +                propagationRequestTO, UserTO.class, username);
> +    }
> +
> +    @Override
>      public UserTO suspend(final long userId) {
>          return getRestTemplate().getForObject(baseUrl +
> "user/suspend/{userId}", UserTO.class, userId);
>      }
> 
>      @Override
> -    public UserTO reactivate(final long userId) {
> -        return getRestTemplate().getForObject(baseUrl +
> "user/reactivate/{userId}", UserTO.class, userId);
> +    public UserTO suspend(final long userId, final PropagationRequestTO
> propagationRequestTO) {
> +        return getRestTemplate().postForObject(baseUrl +
> "user/suspend/{userId}", propagationRequestTO,
> +                UserTO.class, userId);
>      }
> 
>      @Override
> -    public UserTO reactivate(long userId, String query) {
> -        return getRestTemplate().getForObject(baseUrl + "user/reactivate/" +
> userId + query, UserTO.class);
> +    public UserTO suspendByUsername(final String username) {
> +        return getRestTemplate().getForObject(baseUrl +
> "user/suspendByUsername/{username}.json",
> +                UserTO.class, username);
>      }
> 
>      @Override
> -    public UserTO suspendByUsername(final String username) {
> -        return getRestTemplate().getForObject(baseUrl +
> "user/suspendByUsername/{username}.json", UserTO.class,
> -                username);
> +    public UserTO suspendByUsername(final String username, final
> PropagationRequestTO propagationRequestTO) {
> +        return getRestTemplate().postForObject(baseUrl +
> "user/suspendByUsername/{username}.json", propagationRequestTO,
> +                UserTO.class, username);
> +    }
> +
> +    @Override
> +    public UserTO reactivate(final long userId) {
> +        return getRestTemplate().getForObject(baseUrl +
> "user/reactivate/{userId}", UserTO.class, userId);
> +    }
> +
> +    @Override
> +    public UserTO reactivate(final long userId, final PropagationRequestTO
> propagationRequestTO) {
> +        return getRestTemplate().postForObject(baseUrl +
> "user/reactivate/{userId}", propagationRequestTO,
> +                UserTO.class, userId);
>      }
> 
>      @Override
> @@ -151,8 +179,9 @@ public class UserServiceProxy extends Sp
>      }
> 
>      @Override
> -    public UserTO suspend(final long userId, final String query) {
> -        return getRestTemplate().getForObject(baseUrl + "user/suspend/" +
> userId + query, UserTO.class);
> +    public UserTO reactivateByUsername(final String username, final
> PropagationRequestTO propagationRequestTO) {
> +        return getRestTemplate().postForObject(baseUrl +
> "user/reactivateByUsername/{username}.json",
> +                propagationRequestTO, UserTO.class, username);
>      }
> 
>      @Override
> @@ -174,12 +203,6 @@ public class UserServiceProxy extends Sp
> 
>      @Override
>      public int searchCount(final NodeCond searchCondition) {
> -        return getRestTemplate()
> -                .postForObject(baseUrl + "user/search/count.json",
> searchCondition, Integer.class);
> -    }
> -
> -    @Override
> -    public UserTO setStatus(final Long userId, final StatusMod statusUpdate) {
> -        return null; // Not used in old REST API
> +        return getRestTemplate().postForObject(baseUrl +
> "user/search/count.json", searchCondition, Integer.class);
>      }
>  }
> 
> Modified:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/servi
> ces/UserService.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/a
> pache/syncope/common/services/UserService.java?rev=1437557&r1=14375
> 56&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/common/src/main/java/org/apache/syncope/common/servi
> ces/UserService.java (original)
> +++
> syncope/trunk/common/src/main/java/org/apache/syncope/common/servi
> ces/UserService.java Wed Jan 23 16:42:04 2013
> @@ -19,7 +19,6 @@
>  package org.apache.syncope.common.services;
> 
>  import java.util.List;
> -
>  import javax.ws.rs.DELETE;
>  import javax.ws.rs.DefaultValue;
>  import javax.ws.rs.GET;
> @@ -28,10 +27,9 @@ import javax.ws.rs.POST;
>  import javax.ws.rs.Path;
>  import javax.ws.rs.PathParam;
>  import javax.ws.rs.QueryParam;
> -
> -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.to.PropagationRequestTO;
>  import org.apache.syncope.common.to.UserTO;
>  import org.apache.syncope.common.to.WorkflowFormTO;
> 
> @@ -40,8 +38,12 @@ public interface UserService {
> 
>      UserTO activate(long userId, String token);
> 
> +    UserTO activate(long userId, String token, PropagationRequestTO
> propagationRequestTO);
> +
>      UserTO activateByUsername(String username, String token);
> 
> +    UserTO activateByUsername(String username, String token,
> PropagationRequestTO propagationRequestTO);
> +
>      @POST
>      @Path("workflow/task/{taskId}/claim")
>      WorkflowFormTO claimForm(@PathParam("taskId") String taskId);
> @@ -72,15 +74,16 @@ public interface UserService {
>      List<UserTO> list();
> 
>      @GET
> -    List<UserTO> list(@QueryParam("page") int page,
> -            @QueryParam("size") @DefaultValue("25") int size);
> +    List<UserTO> list(@QueryParam("page") int page, @QueryParam("size")
> @DefaultValue("25") int size);
> 
>      UserTO reactivate(long userId);
> 
> -    UserTO reactivate(long userId, String query);
> +    UserTO reactivate(long userId, PropagationRequestTO
> propagationRequestTO);
> 
>      UserTO reactivateByUsername(String username);
> 
> +    UserTO reactivateByUsername(String username, PropagationRequestTO
> propagationRequestTO);
> +
>      @GET
>      @Path("{userId}")
>      UserTO read(@PathParam("userId") Long userId);
> @@ -104,19 +107,17 @@ public interface UserService {
>      int searchCount(NodeCond searchCondition);
> 
>      @POST
> -    @Path("user/{userId}/status")
> -    public abstract UserTO setStatus(@PathParam("userId") Long userId,
> StatusMod statusUpdate);
> -
> -    @POST
>      @Path("workflow/form")
>      UserTO submitForm(WorkflowFormTO form);
> 
>      UserTO suspend(long userId);
> 
> -    UserTO suspend(long userId, String query);
> +    UserTO suspend(long userId, PropagationRequestTO
> propagationRequestTO);
> 
>      UserTO suspendByUsername(String username);
> 
> +    UserTO suspendByUsername(String username, PropagationRequestTO
> propagationRequestTO);
> +
>      @POST
>      @Path("{userId}")
>      UserTO update(@PathParam("userId") Long userId, UserMod userMod);
> 
> Modified:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/A
> bstractAttributableTO.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/a
> pache/syncope/common/to/AbstractAttributableTO.java?rev=1437557&r1=
> 1437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/A
> bstractAttributableTO.java (original)
> +++
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/A
> bstractAttributableTO.java Wed Jan 23 16:42:04 2013
> @@ -39,7 +39,7 @@ public abstract class AbstractAttributab
> 
>      private Set<String> resources;
> 
> -    private List<PropagationTO> propagationTOs;
> +    private List<PropagationStatusTO> propagationStatusTOs;
> 
>      protected AbstractAttributableTO() {
>          super();
> @@ -47,7 +47,7 @@ public abstract class AbstractAttributab
>          derivedAttributes = new ArrayList<AttributeTO>();
>          virtualAttributes = new ArrayList<AttributeTO>();
>          resources = new HashSet<String>();
> -        propagationTOs = new ArrayList<PropagationTO>();
> +        propagationStatusTOs = new ArrayList<PropagationStatusTO>();
>      }
> 
>      public long getId() {
> @@ -141,33 +141,33 @@ public abstract class AbstractAttributab
>          this.resources = resources;
>      }
> 
> -    public boolean addPropagationTO(final PropagationTO status) {
> -        return propagationTOs.add(status);
> +    public boolean addPropagationTO(final PropagationStatusTO status) {
> +        return propagationStatusTOs.add(status);
>      }
> 
>      public boolean removePropagationTO(final String resource) {
> -        if (resource != null && getPropagationTOs().isEmpty()) {
> -            final List<PropagationTO> toBeRemoved = new
> ArrayList<PropagationTO>();
> +        if (resource != null && getPropagationStatusTOs().isEmpty()) {
> +            final List<PropagationStatusTO> toBeRemoved = new
> ArrayList<PropagationStatusTO>();
> 
> -            for (PropagationTO propagationTO : getPropagationTOs()) {
> -                if (resource.equals(propagationTO.getResourceName())) {
> +            for (PropagationStatusTO propagationTO :
> getPropagationStatusTOs()) {
> +                if (resource.equals(propagationTO.getResource())) {
>                      toBeRemoved.add(propagationTO);
>                  }
>              }
> 
> -            return propagationTOs.removeAll(toBeRemoved);
> +            return propagationStatusTOs.removeAll(toBeRemoved);
>          }
>          return false;
>      }
> 
> -    public List<PropagationTO> getPropagationTOs() {
> -        return propagationTOs;
> +    public List<PropagationStatusTO> getPropagationStatusTOs() {
> +        return propagationStatusTOs;
>      }
> 
> -    public void setPropagationTOs(final List<PropagationTO> propagationTOs)
> {
> -        if (this.propagationTOs != propagationTOs) {
> -            this.propagationTOs.clear();
> -            this.propagationTOs.addAll(propagationTOs);
> +    public void setPropagationStatusTOs(final List<PropagationStatusTO>
> propagationStatusTOs) {
> +        if (this.propagationStatusTOs != propagationStatusTOs) {
> +            this.propagationStatusTOs.clear();
> +            this.propagationStatusTOs.addAll(propagationStatusTOs);
>          }
>      }
>  }
> 
> Modified:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/
> MembershipTO.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/a
> pache/syncope/common/to/MembershipTO.java?rev=1437557&r1=1437556
> &r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/
> MembershipTO.java (original)
> +++
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/
> MembershipTO.java Wed Jan 23 16:42:04 2013
> @@ -66,7 +66,7 @@ public class MembershipTO extends Abstra
>      }
> 
>      @Override
> -    public boolean addPropagationTO(PropagationTO status) {
> +    public boolean addPropagationTO(PropagationStatusTO status) {
>          return false;
>      }
> 
> @@ -76,11 +76,11 @@ public class MembershipTO extends Abstra
>      }
> 
>      @Override
> -    public List<PropagationTO> getPropagationTOs() {
> -        return Collections.<PropagationTO>emptyList();
> +    public List<PropagationStatusTO> getPropagationStatusTOs() {
> +        return Collections.<PropagationStatusTO>emptyList();
>      }
> 
>      @Override
> -    public void setPropagationTOs(List<PropagationTO> propagationTOs) {
> +    public void setPropagationStatusTOs(List<PropagationStatusTO>
> propagationTOs) {
>      }
>  }
> 
> Added:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/a
> pache/syncope/common/to/PropagationRequestTO.java?rev=1437557&vie
> w=auto
> ==========================================================
> ====================
> ---
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java (added)
> +++
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java Wed Jan 23 16:42:04 2013
> @@ -0,0 +1,76 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.syncope.common.to;
> +
> +import java.util.HashSet;
> +import java.util.Set;
> +import org.apache.syncope.common.AbstractBaseBean;
> +
> +/**
> + * Propagation request on internal storage or on 0+ external resources.
> + */
> +public class PropagationRequestTO extends AbstractBaseBean {
> +
> +    private static final long serialVersionUID = 7601716025754543004L;
> +
> +    /**
> +     * External resources propagation is requested to.
> +     */
> +    private final Set<String> resources;
> +
> +    /**
> +     * Whether update should be performed on internal storage.
> +     */
> +    private boolean onSyncope;
> +
> +    public PropagationRequestTO() {
> +        super();
> +
> +        this.resources = new HashSet<String>();
> +    }
> +
> +    public boolean isOnSyncope() {
> +        return onSyncope;
> +    }
> +
> +    public void setOnSyncope(final boolean onSyncope) {
> +        this.onSyncope = onSyncope;
> +    }
> +
> +    public Set<String> getResources() {
> +        return resources;
> +    }
> +
> +    public boolean addResource(final String resource) {
> +        return this.resources.add(resource);
> +    }
> +
> +    public boolean removeResource(final String resource) {
> +        return this.resources.remove(resource);
> +    }
> +
> +    public void setResources(final Set<String> resources) {
> +        if (this.resources != resources) {
> +            this.resources.clear();
> +            if (resources != null && !resources.isEmpty()) {
> +                this.resources.addAll(resources);
> +            }
> +        }
> +    }
> +}
> 
> Propchange:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Propchange:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java
> ------------------------------------------------------------------------------
>     svn:keywords = Date Author Id Revision HeadURL
> 
> Propchange:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationRequestTO.java
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
> 
> Copied:
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationStatusTO.java (from r1437397,
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationTO.java)
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/a
> pache/syncope/common/to/PropagationStatusTO.java?p2=syncope/trunk/c
> ommon/src/main/java/org/apache/syncope/common/to/PropagationStatus
> TO.java&p1=syncope/trunk/common/src/main/java/org/apache/syncope/c
> ommon/to/PropagationTO.java&r1=1437397&r2=1437557&rev=1437557&vie
> w=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationTO.java (original)
> +++
> syncope/trunk/common/src/main/java/org/apache/syncope/common/to/P
> ropagationStatusTO.java Wed Jan 23 16:42:04 2013
> @@ -24,7 +24,7 @@ import org.apache.syncope.common.types.P
>  /**
>   * Single propagation status.
>   */
> -public class PropagationTO extends AbstractBaseBean {
> +public class PropagationStatusTO extends AbstractBaseBean {
> 
>      /**
>       * Serial version ID.
> @@ -44,7 +44,7 @@ public class PropagationTO extends Abstr
>      /**
>       * Propagated resource name.
>       */
> -    private String resourceName;
> +    private String resource;
> 
>      /**
>       * Propagation task execution status.
> @@ -92,23 +92,23 @@ public class PropagationTO extends Abstr
>       *
>       * @return resource name.
>       */
> -    public String getResourceName() {
> -        return resourceName;
> +    public String getResource() {
> +        return resource;
>      }
> 
>      /**
>       * Resource name setter.
>       *
> -     * @param resourceName resource name.
> +     * @param resource resource name
>       */
> -    public void setResourceName(final String resourceName) {
> -        this.resourceName = resourceName;
> +    public void setResource(final String resource) {
> +        this.resource = resource;
>      }
> 
>      /**
>       * Propagation execution status getter.
>       *
> -     * @return status.
> +     * @return status
>       */
>      public PropagationTaskExecStatus getStatus() {
>          return status;
> @@ -117,7 +117,7 @@ public class PropagationTO extends Abstr
>      /**
>       * Propagation execution status setter.
>       *
> -     * @param status propagation execution status.
> +     * @param status propagation execution status
>       */
>      public void setStatus(final PropagationTaskExecStatus status) {
>          this.status = status;
> 
> Modified:
> syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/
> ResultStatusModalPage.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/ap
> ache/syncope/console/pages/ResultStatusModalPage.java?rev=1437557&r1
> =1437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/
> ResultStatusModalPage.java (original)
> +++
> syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/
> ResultStatusModalPage.java Wed Jan 23 16:42:04 2013
> @@ -24,11 +24,10 @@ import java.util.HashSet;
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
> -
>  import org.apache.syncope.common.to.AbstractAttributableTO;
>  import org.apache.syncope.common.to.AttributeTO;
>  import org.apache.syncope.common.to.ConnObjectTO;
> -import org.apache.syncope.common.to.PropagationTO;
> +import org.apache.syncope.common.to.PropagationStatusTO;
>  import org.apache.syncope.common.to.RoleTO;
>  import org.apache.syncope.common.to.UserTO;
>  import org.apache.syncope.common.types.PropagationTaskExecStatus;
> @@ -104,13 +103,13 @@ public class ResultStatusModalPage exten
> 
>          if (mode == UserModalPage.Mode.ADMIN) {
>              // add Syncope propagation status
> -            PropagationTO syncope = new PropagationTO();
> -            syncope.setResourceName("Syncope");
> +            PropagationStatusTO syncope = new PropagationStatusTO();
> +            syncope.setResource("Syncope");
>              syncope.setStatus(PropagationTaskExecStatus.SUCCESS);
> 
> -            List<PropagationTO> propagations = new ArrayList<PropagationTO>();
> +            List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>              propagations.add(syncope);
> -            propagations.addAll(attributable.getPropagationTOs());
> +            propagations.addAll(attributable.getPropagationStatusTOs());
> 
>              fragment.add(new Label("info",
>                      ((attributable instanceof UserTO) && ((UserTO)
> attributable).getUsername() != null)
> @@ -119,13 +118,13 @@ public class ResultStatusModalPage exten
>                      ? ((RoleTO) attributable).getName()
>                      : String.valueOf(attributable.getId())));
> 
> -            final ListView<PropagationTO> propRes = new
> ListView<PropagationTO>("resources", propagations) {
> +            final ListView<PropagationStatusTO> propRes = new
> ListView<PropagationStatusTO>("resources", propagations) {
> 
>                  private static final long serialVersionUID = -1020475259727720708L;
> 
>                  @Override
> -                protected void populateItem(final ListItem<PropagationTO> item) {
> -                    final PropagationTO propTO = (PropagationTO)
> item.getDefaultModelObject();
> +                protected void populateItem(final ListItem<PropagationStatusTO>
> item) {
> +                    final PropagationStatusTO propTO = (PropagationStatusTO)
> item.getDefaultModelObject();
> 
>                      final ListView attributes = getConnObjectView(propTO);
> 
> @@ -139,7 +138,7 @@ public class ResultStatusModalPage exten
>                      item.add(attrhead);
>                      item.add(attributes);
> 
> -                    attrhead.add(new Label("resource",
> propTO.getResourceName()));
> +                    attrhead.add(new Label("resource", propTO.getResource()));
> 
>                      attrhead.add(new Label("propagation", propTO.getStatus() == null
>                              ? "UNDEFINED" : propTO.getStatus().toString()));
> @@ -199,7 +198,7 @@ public class ResultStatusModalPage exten
>       * @param propTO propagation TO.
>       * @return list view.
>       */
> -    private ListView getConnObjectView(final PropagationTO propTO) {
> +    private ListView getConnObjectView(final PropagationStatusTO propTO) {
>          final ConnObjectTO before = propTO.getBeforeObj();
>          final ConnObjectTO after = propTO.getAfterObj();
> 
> 
> Modified:
> syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/U
> serRestClient.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/ap
> ache/syncope/console/rest/UserRestClient.java?rev=1437557&r1=1437556&
> r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/U
> serRestClient.java (original)
> +++
> syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/U
> serRestClient.java Wed Jan 23 16:42:04 2013
> @@ -19,14 +19,12 @@
>  package org.apache.syncope.console.rest;
> 
>  import java.util.List;
> -
> -import org.apache.syncope.common.mod.StatusMod;
> -import org.apache.syncope.common.mod.StatusMod.Status;
>  import org.apache.syncope.common.mod.UserMod;
>  import org.apache.syncope.common.search.NodeCond;
>  import org.apache.syncope.common.services.ResourceService;
>  import org.apache.syncope.common.services.UserService;
>  import org.apache.syncope.common.to.ConnObjectTO;
> +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.validation.SyncopeClientCompositeErrorExcep
> tion;
> @@ -110,39 +108,28 @@ public class UserRestClient extends Abst
>          return getService(ResourceService.class).getConnector(resourceName,
> AttributableType.USER, objectId);
>      }
> 
> -    public UserTO reactivate(final long userId, final List<StatusBean> statuses)
> {
> -        return enable(userId, statuses, true);
> -    }
> -
> -    public UserTO suspend(final long userId, final List<StatusBean> statuses) {
> -        return enable(userId, statuses, false);
> -    }
> -
> -    private UserTO enable(final long userId, final List<StatusBean> statuses,
> final boolean enable) {
> -
> -        StatusMod statusMod = new StatusMod();
> -        statusMod.setId(userId);
> -
> -        statusMod.setStatus(enable
> -                ? Status.REACTIVATE
> -                : Status.SUSPEND);
> -
> -        // perform on resource if and only if resources have been speciofied
> -        statusMod.setUpdateRemote(!statuses.isEmpty());
> -
> -        // perform on syncope if and only if it has been requested
> -        statusMod.setUpdateInternal(false);
> +    private PropagationRequestTO getPropagationRequestTO(final
> List<StatusBean> statuses, final boolean enable) {
> +        PropagationRequestTO propagationRequestTO = new
> PropagationRequestTO();
> 
>          for (StatusBean status : statuses) {
>              if ((enable && !status.getStatus().isActive()) || (!enable &&
> status.getStatus().isActive())) {
> +
>                  if ("Syncope".equals(status.getResourceName())) {
> -                    statusMod.setUpdateInternal(true);
> +                    propagationRequestTO.setOnSyncope(true);
>                  } else {
> -
> statusMod.getExcludeResources().add(status.getResourceName());
> +
> propagationRequestTO.addResource(status.getResourceName());
>                  }
>              }
>          }
> 
> -        return getService(UserService.class).setStatus(userId, statusMod);
> +        return propagationRequestTO;
> +    }
> +
> +    public UserTO suspend(final long userId, final List<StatusBean> statuses) {
> +        return getService(UserService.class).suspend(userId,
> getPropagationRequestTO(statuses, false));
> +    }
> +
> +    public UserTO reactivate(final long userId, final List<StatusBean>
> statuses) {
> +        return getService(UserService.class).reactivate(userId,
> getPropagationRequestTO(statuses, true));
>      }
>  }
> 
> Modified:
> syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/i
> mpl/DefaultPropagationHandler.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apach
> e/syncope/core/propagation/impl/DefaultPropagationHandler.java?rev=143
> 7557&r1=1437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/i
> mpl/DefaultPropagationHandler.java (original)
> +++
> syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/i
> mpl/DefaultPropagationHandler.java Wed Jan 23 16:42:04 2013
> @@ -19,8 +19,7 @@
>  package org.apache.syncope.core.propagation.impl;
> 
>  import java.util.List;
> -
> -import org.apache.syncope.common.to.PropagationTO;
> +import org.apache.syncope.common.to.PropagationStatusTO;
>  import org.apache.syncope.common.types.PropagationTaskExecStatus;
>  import org.apache.syncope.core.connid.ConnObjectUtil;
>  import org.apache.syncope.core.propagation.PropagationHandler;
> @@ -30,19 +29,21 @@ public class DefaultPropagationHandler i
> 
>      private final ConnObjectUtil connObjectUtil;
> 
> -    private final List<PropagationTO> propagations;
> +    private final List<PropagationStatusTO> propagations;
> +
> +    public DefaultPropagationHandler(final ConnObjectUtil connObjectUtil,
> +            final List<PropagationStatusTO> propagations) {
> 
> -    public DefaultPropagationHandler(final ConnObjectUtil connObjectUtil,
> final List<PropagationTO> propagations) {
>          this.connObjectUtil = connObjectUtil;
>          this.propagations = propagations;
>      }
> 
>      @Override
> -    public void handle(final String resourceName, final
> PropagationTaskExecStatus executionStatus,
> +    public void handle(final String resource, final PropagationTaskExecStatus
> executionStatus,
>              final ConnectorObject beforeObj, final ConnectorObject afterObj) {
> 
> -        final PropagationTO propagation = new PropagationTO();
> -        propagation.setResourceName(resourceName);
> +        final PropagationStatusTO propagation = new PropagationStatusTO();
> +        propagation.setResource(resource);
>          propagation.setStatus(executionStatus);
> 
>          if (beforeObj != null) {
> 
> Modified:
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/ResourceController.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apach
> e/syncope/core/rest/controller/ResourceController.java?rev=1437557&r1=1
> 437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/ResourceController.java (original)
> +++
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/ResourceController.java Wed Jan 23 16:42:04 2013
> @@ -20,9 +20,7 @@ package org.apache.syncope.core.rest.con
> 
>  import java.util.List;
>  import java.util.Set;
> -
>  import javax.servlet.http.HttpServletResponse;
> -
>  import org.apache.syncope.common.to.ConnObjectTO;
>  import org.apache.syncope.common.to.ResourceTO;
>  import org.apache.syncope.common.types.AttributableType;
> @@ -40,10 +38,8 @@ import org.apache.syncope.core.persisten
>  import org.apache.syncope.core.persistence.dao.ResourceDAO;
>  import org.apache.syncope.core.propagation.ConnectorFactory;
>  import org.apache.syncope.core.propagation.SyncopeConnector;
> -import org.apache.syncope.core.propagation.impl.ConnectorFacadeProxy;
>  import org.apache.syncope.core.rest.data.ResourceDataBinder;
>  import org.apache.syncope.core.util.AttributableUtil;
> -import org.apache.syncope.core.util.ConnBundleManager;
>  import org.apache.syncope.core.util.NotFoundException;
>  import org.identityconnectors.framework.common.objects.Attribute;
>  import org.identityconnectors.framework.common.objects.AttributeUtil;
> @@ -60,21 +56,6 @@ import org.springframework.web.bind.anno
>  import org.springframework.web.bind.annotation.RequestMapping;
>  import org.springframework.web.bind.annotation.RequestMethod;
>  import org.springframework.web.bind.annotation.RequestParam;
> -import org.identityconnectors.framework.common.objects.Attribute;
> -import org.identityconnectors.framework.common.objects.AttributeUtil;
> -import
> org.identityconnectors.framework.common.objects.ConnectorObject;
> -import org.identityconnectors.framework.common.objects.Name;
> -import org.identityconnectors.framework.common.objects.ObjectClass;
> -import org.identityconnectors.framework.common.objects.Uid;
> -import org.springframework.beans.factory.annotation.Autowired;
> -import org.springframework.security.access.prepost.PreAuthorize;
> -import org.springframework.stereotype.Controller;
> -import org.springframework.transaction.annotation.Transactional;
> -import org.springframework.web.bind.annotation.PathVariable;
> -import org.springframework.web.bind.annotation.RequestBody;
> -import org.springframework.web.bind.annotation.RequestMapping;
> -import org.springframework.web.bind.annotation.RequestMethod;
> -import org.springframework.web.bind.annotation.RequestParam;
>  import org.springframework.web.servlet.ModelAndView;
> 
>  @Controller
> @@ -105,9 +86,6 @@ public class ResourceController extends
>      @Autowired
>      private ConnectorFactory connLoader;
> 
> -    @Autowired
> -    private ConnBundleManager bundleManager;
> -
>      @PreAuthorize("hasRole('RESOURCE_CREATE')")
>      @RequestMapping(method = RequestMethod.POST, value = "/create")
>      public ResourceTO create(final HttpServletResponse response,
> @RequestBody final ResourceTO resourceTO)
> @@ -231,8 +209,8 @@ public class ResourceController extends
>          }
> 
>          if (AttributableType.MEMBERSHIP == type) {
> +            throw new IllegalArgumentException("getObject() not supported for
> MEMBERSHIP");
>          }
> -
>          AttributableUtil attrUtil = AttributableUtil.getInstance(type);
>          ObjectClass objectClass = AttributableType.USER == type ?
> ObjectClass.ACCOUNT : ObjectClass.GROUP;
> 
> @@ -240,7 +218,6 @@ public class ResourceController extends
> 
>          final ConnectorObject connectorObject =
> connector.getObject(objectClass, new Uid(objectId),
> 
> connector.getOperationOptions(attrUtil.getMappingItems(resource)));
> -
>          if (connectorObject == null) {
>              throw new NotFoundException("Object " + objectId + " not found on
> resource " + resourceName);
>          }
> 
> Modified:
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/RoleController.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apach
> e/syncope/core/rest/controller/RoleController.java?rev=1437557&r1=14375
> 56&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/RoleController.java (original)
> +++
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/RoleController.java Wed Jan 23 16:42:04 2013
> @@ -25,7 +25,7 @@ import java.util.Set;
>  import javax.servlet.http.HttpServletResponse;
>  import org.apache.syncope.common.mod.RoleMod;
>  import org.apache.syncope.common.search.NodeCond;
> -import org.apache.syncope.common.to.PropagationTO;
> +import org.apache.syncope.common.to.PropagationStatusTO;
>  import org.apache.syncope.common.to.RoleTO;
>  import org.apache.syncope.common.types.AttributableType;
>  import org.apache.syncope.common.types.AuditElements;
> @@ -285,11 +285,11 @@ public class RoleController extends Abst
> 
>          List<PropagationTask> tasks =
> propagationManager.getRoleCreateTaskIds(created,
> roleTO.getVirtualAttributes());
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> 
>          final RoleTO savedTO = dataBinder.getRoleTO(created.getResult());
> -        savedTO.setPropagationTOs(propagations);
> +        savedTO.setPropagationStatusTOs(propagations);
> 
>          LOG.debug("About to return created role\n{}", savedTO);
> 
> @@ -314,11 +314,11 @@ public class RoleController extends Abst
>          List<PropagationTask> tasks =
> propagationManager.getRoleUpdateTaskIds(updated,
>                  roleMod.getVirtualAttributesToBeRemoved(),
> roleMod.getVirtualAttributesToBeUpdated());
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> 
>          final RoleTO updatedTO = dataBinder.getRoleTO(updated.getResult());
> -        updatedTO.setPropagationTOs(propagations);
> +        updatedTO.setPropagationStatusTOs(propagations);
> 
>          auditManager.audit(Category.role, RoleSubCategory.update,
> Result.success,
>                  "Successfully updated role: " + role.getId());
> @@ -339,7 +339,7 @@ public class RoleController extends Abst
> 
>          List<PropagationTask> tasks =
> propagationManager.getRoleDeleteTaskIds(roleId);
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> 
>          rwfAdapter.delete(roleId);
> 
> Modified:
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/UserController.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apach
> e/syncope/core/rest/controller/UserController.java?rev=1437557&r1=14375
> 56&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/UserController.java (original)
> +++
> syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controlle
> r/UserController.java Wed Jan 23 16:42:04 2013
> @@ -25,13 +25,12 @@ import java.util.HashSet;
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
> -
>  import javax.servlet.http.HttpServletResponse;
> -
>  import org.apache.syncope.common.mod.UserMod;
>  import org.apache.syncope.common.search.NodeCond;
>  import org.apache.syncope.common.to.MembershipTO;
> -import org.apache.syncope.common.to.PropagationTO;
> +import org.apache.syncope.common.to.PropagationRequestTO;
> +import org.apache.syncope.common.to.PropagationStatusTO;
>  import org.apache.syncope.common.to.UserTO;
>  import org.apache.syncope.common.to.WorkflowFormTO;
>  import org.apache.syncope.common.types.AttributableType;
> @@ -84,37 +83,37 @@ public class UserController {
>      /**
>       * Logger.
>       */
> -    private static final Logger LOG =
> LoggerFactory.getLogger(UserController.class);
> +    protected static final Logger LOG =
> LoggerFactory.getLogger(UserController.class);
> 
>      @Autowired
> -    private AuditManager auditManager;
> +    protected AuditManager auditManager;
> 
>      @Autowired
> -    private UserDAO userDAO;
> +    protected UserDAO userDAO;
> 
>      @Autowired
> -    private AttributableSearchDAO searchDAO;
> +    protected AttributableSearchDAO searchDAO;
> 
>      @Autowired
> -    private UserDataBinder dataBinder;
> +    protected UserDataBinder dataBinder;
> 
>      @Autowired
> -    private UserWorkflowAdapter uwfAdapter;
> +    protected UserWorkflowAdapter uwfAdapter;
> 
>      @Autowired
> -    private PropagationManager propagationManager;
> +    protected PropagationManager propagationManager;
> 
>      @Autowired
> -    private PropagationTaskExecutor taskExecutor;
> +    protected PropagationTaskExecutor taskExecutor;
> 
>      @Autowired
> -    private NotificationManager notificationManager;
> +    protected NotificationManager notificationManager;
> 
>      /**
>       * ConnectorObject util.
>       */
>      @Autowired
> -    private ConnObjectUtil connObjectUtil;
> +    protected ConnObjectUtil connObjectUtil;
> 
>      @PreAuthorize("hasRole('USER_READ')")
>      @RequestMapping(method = RequestMethod.GET, value =
> "/verifyPassword/{username}")
> @@ -176,7 +175,6 @@ public class UserController {
>      @RequestMapping(method = RequestMethod.GET, value =
> "/list/{page}/{size}")
>      @Transactional(readOnly = true, rollbackFor = {Throwable.class})
>      public List<UserTO> list(@PathVariable("page") final int page,
> @PathVariable("size") final int size) {
> -
>          Set<Long> adminRoleIds =
> EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
> 
>          List<SyncopeUser> users = userDAO.findAll(adminRoleIds, page, size);
> @@ -292,13 +290,13 @@ public class UserController {
>          List<PropagationTask> tasks =
> propagationManager.getUserCreateTaskIds(
>                  created, userTO.getPassword(), userTO.getVirtualAttributes());
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> 
>          notificationManager.createTasks(created.getResult().getKey(),
> created.getPerformedTasks());
> 
>          final UserTO savedTO =
> dataBinder.getUserTO(created.getResult().getKey());
> -        savedTO.setPropagationTOs(propagations);
> +        savedTO.setPropagationStatusTOs(propagations);
> 
>          LOG.debug("About to return created user\n{}", savedTO);
> 
> @@ -321,13 +319,13 @@ public class UserController {
>          List<PropagationTask> tasks =
> propagationManager.getUserUpdateTaskIds(updated,
> userMod.getPassword(),
>                  userMod.getVirtualAttributesToBeRemoved(),
> userMod.getVirtualAttributesToBeUpdated());
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> 
>          notificationManager.createTasks(updated.getResult().getKey(),
> updated.getPerformedTasks());
> 
>          final UserTO updatedTO =
> dataBinder.getUserTO(updated.getResult().getKey());
> -        updatedTO.setPropagationTOs(propagations);
> +        updatedTO.setPropagationStatusTOs(propagations);
> 
>          auditManager.audit(Category.user, UserSubCategory.update,
> Result.success,
>                  "Successfully updated user: " + updatedTO.getUsername());
> @@ -342,10 +340,19 @@ public class UserController {
>      @Transactional(rollbackFor = {Throwable.class})
>      public UserTO activate(
>              @PathVariable("userId") final Long userId,
> +            @RequestParam(required = true) final String token)
> +            throws WorkflowException, NotFoundException,
> UnauthorizedRoleException, PropagationException {
> +
> +        return activate(userId, token, null);
> +    }
> +
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/activate/{userId}")
> +    @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO activate(
> +            @PathVariable("userId") final Long userId,
>              @RequestParam(required = true) final String token,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
>              throws WorkflowException, NotFoundException,
> UnauthorizedRoleException, PropagationException {
> 
>          LOG.debug("About to activate " + userId);
> @@ -355,7 +362,7 @@ public class UserController {
>              throw new NotFoundException("User " + userId);
>          }
> 
> -        return setStatus(user, token, resourceNames, performLocally,
> performRemotely, true, "activate");
> +        return setStatus(user, token, propagationRequestTO, true, "activate");
>      }
> 
>      @PreAuthorize("hasRole('USER_UPDATE')")
> @@ -363,10 +370,19 @@ public class UserController {
>      @Transactional(rollbackFor = {Throwable.class})
>      public UserTO activate(
>              @PathVariable("username") final String username,
> +            @RequestParam(required = true) final String token)
> +            throws WorkflowException, NotFoundException,
> UnauthorizedRoleException, PropagationException {
> +
> +        return activate(username, token, null);
> +    }
> +
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/activateByUsername/{username}")
> +    @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO activate(
> +            @PathVariable("username") final String username,
>              @RequestParam(required = true) final String token,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
>              throws WorkflowException, NotFoundException,
> UnauthorizedRoleException, PropagationException {
> 
>          LOG.debug("About to activate " + username);
> @@ -376,55 +392,76 @@ public class UserController {
>              throw new NotFoundException("User " + username);
>          }
> 
> -        return setStatus(user, token, resourceNames, performLocally,
> performRemotely, true, "activate");
> +        return setStatus(user, token, propagationRequestTO, true, "activate");
>      }
> 
>      @PreAuthorize("hasRole('USER_UPDATE')")
> -    @RequestMapping(method = RequestMethod.GET, value =
> "/suspendByUsername/{username}")
> +    @RequestMapping(method = RequestMethod.GET, value =
> "/suspend/{userId}")
>      @Transactional(rollbackFor = {Throwable.class})
> -    public UserTO suspend(@PathVariable("username") final String
> username,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +    public UserTO suspend(@PathVariable("userId") final Long userId)
>              throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
> -        LOG.debug("About to suspend " + username);
> +        return suspend(userId, null);
> +    }
> 
> -        SyncopeUser user = userDAO.find(username);
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/suspend/{userId}")
> +    @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO suspend(@PathVariable("userId") final Long userId,
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
> +            throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
> +        LOG.debug("About to suspend " + userId);
> +
> +        SyncopeUser user = userDAO.find(userId);
>          if (user == null) {
> -            throw new NotFoundException("User " + username);
> +            throw new NotFoundException("User " + userId);
>          }
> 
> -        return setStatus(user, null, resourceNames, performLocally,
> performRemotely, false, "suspend");
> +        return setStatus(user, null, propagationRequestTO, false, "suspend");
>      }
> 
>      @PreAuthorize("hasRole('USER_UPDATE')")
> -    @RequestMapping(method = RequestMethod.GET, value =
> "/suspend/{userId}")
> +    @RequestMapping(method = RequestMethod.GET, value =
> "/suspendByUsername/{username}")
>      @Transactional(rollbackFor = {Throwable.class})
> -    public UserTO suspend(@PathVariable("userId") final Long userId,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +    public UserTO suspend(@PathVariable("username") final String
> username)
>              throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
> -        LOG.debug("About to suspend " + userId);
> +        return suspend(username, null);
> +    }
> +
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/suspendByUsername/{username}")
> +    @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO suspend(@PathVariable("username") final String
> username,
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
> +            throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> +
> +        LOG.debug("About to suspend " + username);
> +
> +        SyncopeUser user = userDAO.find(username);
> 
> -        SyncopeUser user = userDAO.find(userId);
>          if (user == null) {
> -            throw new NotFoundException("User " + userId);
> +            throw new NotFoundException("User " + username);
>          }
> 
> -        return setStatus(user, null, resourceNames, performLocally,
> performRemotely, false, "suspend");
> +        return setStatus(user, null, propagationRequestTO, false, "suspend");
>      }
> 
>      @PreAuthorize("hasRole('USER_UPDATE')")
>      @RequestMapping(method = RequestMethod.GET, value =
> "/reactivate/{userId}")
>      @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO reactivate(final @PathVariable("userId") Long userId)
> +            throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> +
> +        return reactivate(userId, null);
> +    }
> +
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/reactivate/{userId}")
> +    @Transactional(rollbackFor = {Throwable.class})
>      public UserTO reactivate(final @PathVariable("userId") Long userId,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
>              throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
>          LOG.debug("About to reactivate " + userId);
> @@ -434,16 +471,22 @@ public class UserController {
>              throw new NotFoundException("User " + userId);
>          }
> 
> -        return setStatus(user, null, resourceNames, performLocally,
> performRemotely, true, "reactivate");
> +        return setStatus(user, null, propagationRequestTO, true, "reactivate");
>      }
> 
> -    @PreAuthorize("hasRole('USER_UPDATE')")
>      @RequestMapping(method = RequestMethod.GET, value =
> "/reactivateByUsername/{username}")
>      @Transactional(rollbackFor = {Throwable.class})
> +    public UserTO reactivate(final @PathVariable("username") String
> username)
> +            throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> +
> +        return reactivate(username, null);
> +    }
> +
> +    @PreAuthorize("hasRole('USER_UPDATE')")
> +    @RequestMapping(method = RequestMethod.POST, value =
> "/reactivateByUsername/{username}")
> +    @Transactional(rollbackFor = {Throwable.class})
>      public UserTO reactivate(final @PathVariable("username") String
> username,
> -            @RequestParam(required = false) final Set<String> resourceNames,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performLocally,
> -            @RequestParam(required = false, defaultValue = "true") final Boolean
> performRemotely)
> +            @RequestBody final PropagationRequestTO propagationRequestTO)
>              throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
>          LOG.debug("About to reactivate " + username);
> @@ -453,13 +496,14 @@ public class UserController {
>              throw new NotFoundException("User " + username);
>          }
> 
> -        return setStatus(user, null, resourceNames, performLocally,
> performRemotely, true, "reactivate");
> +        return setStatus(user, null, propagationRequestTO, true, "reactivate");
>      }
> 
>      @PreAuthorize("hasRole('USER_DELETE')")
>      @RequestMapping(method = RequestMethod.GET, value =
> "/delete/{userId}")
>      public UserTO delete(@PathVariable("userId") final Long userId)
>              throws NotFoundException, WorkflowException,
> PropagationException, UnauthorizedRoleException {
> +
>          LOG.debug("User delete called with {}", userId);
> 
>          return doDelete(userId);
> @@ -469,6 +513,7 @@ public class UserController {
>      @RequestMapping(method = RequestMethod.GET, value =
> "/deleteByUsername/{username}")
>      public UserTO delete(@PathVariable final String username)
>              throws NotFoundException, WorkflowException,
> PropagationException, UnauthorizedRoleException {
> +
>          LOG.debug("User delete called with {}", username);
> 
>          UserTO result = dataBinder.getUserTO(username);
> @@ -578,14 +623,14 @@ public class UserController {
>          return savedTO;
>      }
> 
> -    private UserTO setStatus(final SyncopeUser user, final String token, final
> Set<String> resourceNames,
> -            final boolean performLocally, final boolean performRemotely, final
> boolean status, final String task)
> +    protected UserTO setStatus(final SyncopeUser user, final String token,
> +            final PropagationRequestTO propagationRequestTO, final boolean
> status, final String task)
>              throws NotFoundException, WorkflowException,
> UnauthorizedRoleException, PropagationException {
> 
>          LOG.debug("About to set status of {}" + user);
> 
>          WorkflowResult<Long> updated;
> -        if (performLocally) {
> +        if (propagationRequestTO == null ||
> propagationRequestTO.isOnSyncope()) {
>              if ("suspend".equals(task)) {
>                  updated = uwfAdapter.suspend(user.getId());
>              } else if ("reactivate".equals(task)) {
> @@ -598,19 +643,14 @@ public class UserController {
>          }
> 
>          // Resources to exclude from propagation.
> -        Set<String> resources = new HashSet<String>();
> -        if (performRemotely) {
> -            if (resourceNames != null) {
> -                resources.addAll(user.getResourceNames());
> -                resources.removeAll(resourceNames);
> -            }
> -        } else {
> -            resources.addAll(user.getResourceNames());
> +        Set<String> resourcesToBeExcluded = new
> HashSet<String>(user.getResourceNames());
> +        if (propagationRequestTO != null) {
> +
> resourcesToBeExcluded.removeAll(propagationRequestTO.getResources());
>          }
> 
> -        List<PropagationTask> tasks =
> propagationManager.getUserUpdateTaskIds(user, status, resources);
> -
> +        List<PropagationTask> tasks =
> propagationManager.getUserUpdateTaskIds(user, status,
> resourcesToBeExcluded);
>          taskExecutor.execute(tasks);
> +
>          notificationManager.createTasks(updated.getResult(),
> updated.getPerformedTasks());
> 
>          final UserTO savedTO = dataBinder.getUserTO(updated.getResult());
> @@ -625,6 +665,7 @@ public class UserController {
> 
>      protected UserTO doDelete(final Long userId)
>              throws NotFoundException, WorkflowException,
> PropagationException, UnauthorizedRoleException {
> +
>          // Note here that we can only notify about "delete", not any other
>          // task defined in workflow process definition: this because this
>          // information could only be available after uwfAdapter.delete(), which
> @@ -637,9 +678,9 @@ public class UserController {
>          final UserTO userTO = new UserTO();
>          userTO.setId(userId);
> 
> -        final List<PropagationTO> propagations = new
> ArrayList<PropagationTO>();
> +        final List<PropagationStatusTO> propagations = new
> ArrayList<PropagationStatusTO>();
>          taskExecutor.execute(tasks, new
> DefaultPropagationHandler(connObjectUtil, propagations));
> -        userTO.setPropagationTOs(propagations);
> +        userTO.setPropagationStatusTOs(propagations);
> 
>          uwfAdapter.delete(userId);
> 
> 
> Modified:
> syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/us
> er/NoOpUserWorkflowAdapter.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apach
> e/syncope/core/workflow/user/NoOpUserWorkflowAdapter.java?rev=1437
> 557&r1=1437556&r2=1437557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/us
> er/NoOpUserWorkflowAdapter.java (original)
> +++
> syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/us
> er/NoOpUserWorkflowAdapter.java Wed Jan 23 16:42:04 2013
> @@ -18,12 +18,12 @@
>   */
>  package org.apache.syncope.core.workflow.user;
> 
> -import java.util.AbstractMap.SimpleEntry;
>  import java.util.Arrays;
>  import java.util.Collections;
>  import java.util.List;
> +import java.util.AbstractMap;
> +import java.util.AbstractMap.SimpleEntry;
>  import java.util.Map;
> -
>  import org.apache.syncope.common.mod.UserMod;
>  import org.apache.syncope.common.to.UserTO;
>  import org.apache.syncope.common.to.WorkflowDefinitionTO;
> @@ -113,9 +113,8 @@ public class NoOpUserWorkflowAdapter ext
> 
>          SyncopeUser updated = userDAO.save(user);
> 
> -        return new WorkflowResult<Map.Entry<Long, Boolean>>(new
> SimpleEntry<Long, Boolean>(updated.getId(), true),
> -                propByRes,
> -                "update");
> +        return new WorkflowResult<Map.Entry<Long, Boolean>>(
> +                new AbstractMap.SimpleEntry<Long, Boolean>(updated.getId(),
> true), propByRes, "update");
>      }
> 
>      @Override
> 
> Modified:
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestI
> TCase.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apach
> e/syncope/core/rest/TaskTestITCase.java?rev=1437557&r1=1437556&r2=143
> 7557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestI
> TCase.java (original)
> +++
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestI
> TCase.java Wed Jan 23 16:42:04 2013
> @@ -715,8 +715,8 @@ public class TaskTestITCase extends Abst
>              userTO = userService.create(userTO);
> 
>              assertNotNull(userTO);
> -            assertEquals(1, userTO.getPropagationTOs().size());
> -
> assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
> +            assertEquals(1, userTO.getPropagationStatusTOs().size());
> +
> assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessfu
> l());
> 
>              // Update sync task
>              SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION,
> SYNC_TASK_ID);
> 
> Modified:
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestI
> TCase.java
> URL:
> http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apach
> e/syncope/core/rest/UserTestITCase.java?rev=1437557&r1=1437556&r2=14
> 37557&view=diff
> ==========================================================
> ====================
> ---
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestI
> TCase.java (original)
> +++
> syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestI
> TCase.java Wed Jan 23 16:42:04 2013
> @@ -31,9 +31,7 @@ import java.util.Collections;
>  import java.util.Date;
>  import java.util.List;
>  import java.util.Map;
> -
>  import javax.ws.rs.core.Response;
> -
>  import org.apache.syncope.common.mod.AttributeMod;
>  import org.apache.syncope.common.mod.MembershipMod;
>  import org.apache.syncope.common.mod.UserMod;
> @@ -43,7 +41,8 @@ import org.apache.syncope.common.to.Conn
>  import org.apache.syncope.common.to.MembershipTO;
>  import org.apache.syncope.common.to.PasswordPolicyTO;
>  import org.apache.syncope.common.to.PolicyTO;
> -import org.apache.syncope.common.to.PropagationTO;
> +import org.apache.syncope.common.to.PropagationRequestTO;
> +import org.apache.syncope.common.to.PropagationStatusTO;
>  import org.apache.syncope.common.to.PropagationTaskTO;
>  import org.apache.syncope.common.to.ResourceTO;
>  import org.apache.syncope.common.to.UserTO;
> @@ -342,8 +341,8 @@ public class UserTestITCase extends Abst
>          userTO.addResource("resource-testdb");
>          userTO = userService.create(userTO);
>          assertNotNull(userTO);
> -        assertEquals(1, userTO.getPropagationTOs().size());
> -
> assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
> +        assertEquals(1, userTO.getPropagationStatusTOs().size());
> +
> assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessfu
> l());
>      }
> 
>      @Test(expected = SyncopeClientCompositeErrorException.class)
> @@ -633,7 +632,7 @@ public class UserTestITCase extends Abst
>          assertEquals("createApproval", userTO.getStatus());
>          assertEquals(Collections.singleton("resource-testdb"),
> userTO.getResources());
> 
> -        assertTrue(userTO.getPropagationTOs().isEmpty());
> +        assertTrue(userTO.getPropagationStatusTOs().isEmpty());
> 
>          Exception exception = null;
>          try {
> @@ -711,8 +710,8 @@ public class UserTestITCase extends Abst
>          assertTrue(userTO.getAttributes().isEmpty());
> 
>          // check for propagation result
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -
> assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +
> assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessfu
> l());
> 
>          try {
>              userService.delete(userTO.getId());
> @@ -739,8 +738,8 @@ public class UserTestITCase extends Abst
>          assertTrue(userTO.getAttributes().isEmpty());
> 
>          // check for propagation result
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -
> assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +
> assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessfu
> l());
> 
>          try {
>              userService.read(userTO.getId());
> @@ -1177,10 +1176,11 @@ public class UserTestITCase extends Abst
>                  ? "active"
>                  : "created", userTO.getStatus());
> 
> -        String query = "?resourceNames=" + dbTable.getName() +
> "&resourceNames=" + ldap.getName()
> -                + "&performLocally=true"; // check also performLocally
> -
> -        userTO = userService.suspend(userTO.getId(), query);
> +        PropagationRequestTO propagationRequestTO = new
> PropagationRequestTO();
> +        propagationRequestTO.setOnSyncope(true);
> +        propagationRequestTO.addResource(dbTable.getName());
> +        propagationRequestTO.addResource(ldap.getName());
> +        userTO = userService.suspend(userTO.getId(), propagationRequestTO);
> 
>          assertNotNull(userTO);
>          assertEquals("suspended", userTO.getStatus());
> @@ -1198,9 +1198,12 @@ public class UserTestITCase extends Abst
>          connObjectTO = readUserConnObj(ldap.getName(), ldapUID);
>          assertNotNull(connObjectTO);
> 
> -        query = "?resourceNames=" + ldap.getName() +
> "&performLocally=false"; // check also performLocally
> +        propagationRequestTO = new PropagationRequestTO();
> +        propagationRequestTO.setOnSyncope(false);
> +        propagationRequestTO.addResource(ldap.getName());
> +        userTO = userService.suspend(userTO.getId(), propagationRequestTO);
> 
> -        userTO = userService.reactivate(userTO.getId(), query);
> +        userTO = userService.reactivate(userTO.getId(),
> propagationRequestTO);
>          assertNotNull(userTO);
>          assertEquals("suspended", userTO.getStatus());
> 
> @@ -1208,9 +1211,11 @@ public class UserTestITCase extends Abst
> 
> assertFalse(Boolean.parseBoolean(connObjectTO.getAttributeMap().get(Op
> erationalAttributes.ENABLE_NAME)
>                  .getValues().get(0)));
> 
> -        query = "?resourceNames=" + dbTable.getName() +
> "&performLocally=true"; // check also performLocally
> +        propagationRequestTO = new PropagationRequestTO();
> +        propagationRequestTO.setOnSyncope(true);
> +        propagationRequestTO.addResource(dbTable.getName());
> 
> -        userTO = userService.reactivate(userTO.getId(), query);
> +        userTO = userService.reactivate(userTO.getId(),
> propagationRequestTO);
>          assertNotNull(userTO);
>          assertEquals("active", userTO.getStatus());
> 
> @@ -1347,13 +1352,13 @@ public class UserTestITCase extends Abst
>          userTO = userService.update(userMod.getId(), userMod);
>          assertNotNull(userTO);
> 
> -        final List<PropagationTO> propagations = userTO.getPropagationTOs();
> +        final List<PropagationStatusTO> propagations =
> userTO.getPropagationStatusTOs();
> 
>          assertNotNull(propagations);
>          assertEquals(1, propagations.size());
> 
>          final PropagationTaskExecStatus status =
> propagations.get(0).getStatus();
> -        final String resource = propagations.get(0).getResourceName();
> +        final String resource = propagations.get(0).getResource();
> 
>          assertNotNull(status);
>          assertEquals("resource-testdb", resource);
> @@ -1371,13 +1376,13 @@ public class UserTestITCase extends Abst
>          userTO = userService.create(userTO);
>          assertNotNull(userTO);
> 
> -        final List<PropagationTO> propagations = userTO.getPropagationTOs();
> +        final List<PropagationStatusTO> propagations =
> userTO.getPropagationStatusTOs();
> 
>          assertNotNull(propagations);
>          assertEquals(1, propagations.size());
> 
>          final PropagationTaskExecStatus status =
> propagations.get(0).getStatus();
> -        final String resource = propagations.get(0).getResourceName();
> +        final String resource = propagations.get(0).getResource();
> 
>          assertNotNull(status);
>          assertEquals("resource-csv", resource);
> @@ -1652,9 +1657,9 @@ public class UserTestITCase extends Abst
> 
>          userTO = userService.create(userTO);
>          assertNotNull(userTO);
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("resource-ldap",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUCCESS,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("resource-ldap",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUCCESS,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          // 2. delete this user
>          userService.delete(userTO.getId());
> @@ -1710,9 +1715,9 @@ public class UserTestITCase extends Abst
> 
>          userTO = userService.create(userTO);
>          assertNotNull(userTO);
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("ws-target-resource-2",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("ws-target-resource-2",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          ConnObjectTO connObjectTO = readUserConnObj("ws-target-resource-
> 2", userTO.getUsername());
>          assertNotNull(connObjectTO);
> @@ -1734,9 +1739,9 @@ public class UserTestITCase extends Abst
> 
>          userTO = userService.update(userMod.getId(), userMod);
>          assertNotNull(userTO);
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("ws-target-resource-2",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("ws-target-resource-2",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          connObjectTO = readUserConnObj("ws-target-resource-2",
> userTO.getUsername());
>          assertNotNull(connObjectTO);
> @@ -1778,9 +1783,9 @@ public class UserTestITCase extends Abst
> 
>          userTO = userService.update(userMod.getId(), userMod);
>          assertNotNull(userTO);
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("ws-target-resource-2",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("ws-target-resource-2",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          connObjectTO = readUserConnObj("ws-target-resource-2",
> userTO.getUsername());
>          assertNotNull(connObjectTO);
> @@ -1801,9 +1806,9 @@ public class UserTestITCase extends Abst
>          userTO = userService.update(userMod.getId(), userMod);
>          assertNotNull(userTO);
>          assertTrue(userTO.getVirtualAttributes().isEmpty());
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("ws-target-resource-2",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("ws-target-resource-2",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          connObjectTO = readUserConnObj("ws-target-resource-2",
> userTO.getUsername());
>          assertNotNull(connObjectTO);
> @@ -1825,9 +1830,9 @@ public class UserTestITCase extends Abst
> 
>          userTO = userService.create(userTO);
>          assertNotNull(userTO);
> -        assertFalse(userTO.getPropagationTOs().isEmpty());
> -        assertEquals("resource-db-virattr",
> userTO.getPropagationTOs().get(0).getResourceName());
> -        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationTOs().get(0).getStatus());
> +        assertFalse(userTO.getPropagationStatusTOs().isEmpty());
> +        assertEquals("resource-db-virattr",
> userTO.getPropagationStatusTOs().get(0).getResource());
> +        assertEquals(PropagationTaskExecStatus.SUBMITTED,
> userTO.getPropagationStatusTOs().get(0).getStatus());
> 
>          ConnObjectTO connObjectTO = readUserConnObj("resource-db-
> virattr", String.valueOf(userTO.getId()));
>          assertNotNull(connObjectTO);
> 


Changing user status via REST [WAS Re: svn commit: r1437557 - in /syncope/trunk: ./ client/src/main/java/org/apache/syncope/client/services/proxy/ common/src/main/java/org/apache/syncope/common/mod/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/org/apache/sy]

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 24/01/2013 09:09, Jan Bernhardt wrote:
> Hi Francesco,
>
> why did you removed StatusMod without asking for its purpose???
>
> This was needed for future REST API! In REST all cares about resources and not processes. Therefore URLs should not look like this /enableUser or /disableUser , but rather focus on a resource like GET user/status and then return status as enabled or disabled. Or PUT operation with Status (enabled/disabled) for enabling/disabling operation.
>
> For this purpose I introduced setStatus method in UserService, which you simply removed, as well as StatusMod...
>
> I know that we haven't discusses final UserService Interface on the mailing list yet. But please don't remove methods without any mailinglist feedback.

HI Jan,
sorry for not saying anything about this is advance, but I could revert 
the same question to you: why did you add such strange thing called 
StatusMod and UserService.setStatus() without any mailing list feedback? :-)

Yesterday I was surprised by the fact that enable / disable from admin 
console wasn't working any more and I finally got to an empty 
implementation of this setStatus() in UserServiceProxy that broke that 
feature.
I am quite worried of how many of this "side effects" are currently 
disseminating the 1.1.0-SNAPSHOT source code.

If you had asked this in mailing list in advance, we could have 
discussed the fact that, given the application domain we are running in 
(Identity Management), the whole concept of "unbundled" user status 
setting is barely not applicable IMO.
For example, invoking activate() on an user is not necessarily 
equivalent to setting user status to active - depending on the workflow.

Hence, to mark this fact and get everyone's attention to not break the 
main features of Syncope for pure non-functional technology pursuit, 
I've just removed StatusMod and UserService.setStatus().

Let's discuss now the best way to match RESTful best practice with 
actual domain requirements, provided that a general-purpose setStatus() 
IMO is not adequate: we should keep the current activate / suspend / 
reactivate, possibly with separate URLs.

Regards.

-- 
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/