You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/15 09:50:26 UTC

svn commit: r1433313 [1/2] - in /syncope/trunk: client/src/main/java/org/apache/syncope/services/ client/src/main/java/org/apache/syncope/services/proxy/ client/src/main/java/org/apache/syncope/types/ core/src/test/java/org/apache/syncope/core/rest/

Author: jbernhardt
Date: Tue Jan 15 08:50:25 2013
New Revision: 1433313

URL: http://svn.apache.org/viewvc?rev=1433313&view=rev
Log:
[SYNCOPE-259]
Replacing Class<T> method parameters with matching Enum types.

Added:
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringRestTemplate.java
    syncope/trunk/client/src/main/java/org/apache/syncope/types/TaskType.java
Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/services/PolicyService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/ResourceService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/RoleService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/SchemaService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/TaskService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConnectorServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/EntitlementServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/LoggerServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/NotificationServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/PolicyServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ResourceServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/RoleServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SchemaServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/TaskServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/WorkflowServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/types/AttributableType.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AuthenticationTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/DerivedSchemaTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/VirtualSchemaTestITCase.java

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/PolicyService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/PolicyService.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/PolicyService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/PolicyService.java Tue Jan 15 08:50:25 2013
@@ -28,32 +28,29 @@ import javax.ws.rs.PathParam;
 import org.apache.syncope.client.to.PolicyTO;
 import org.apache.syncope.types.PolicyType;
 
-@Path("policies")
+@Path("policies/{kind}")
 public interface PolicyService {
 
     @POST
-    <T extends PolicyTO> T create(T policyTO);
+    <T extends PolicyTO> T create(@PathParam("kind") PolicyType type, T policyTO);
 
     // TODO: policyClass is required only for Spring RestTemplate mock. Must be removed for CXF
     @DELETE
     @Path("{policyId}")
-    <T extends PolicyTO> T delete(@PathParam("policyId") Long policyId, Class<T> policyClass);
+    <T extends PolicyTO> T delete(@PathParam("kind") PolicyType type, @PathParam("policyId") Long policyId);
 
     @GET
-    @Path("{kind}")
     <T extends PolicyTO> List<T> listByType(@PathParam("kind") PolicyType type);
 
-    // TODO: policyClass is required only for Spring RestTemplate mock. Must be removed for CXF
     @GET
     @Path("{policyId}")
-    <T extends PolicyTO> T read(@PathParam("policyId") Long policyId, Class<T> policyClass);
+    <T extends PolicyTO> T read(@PathParam("kind") PolicyType type, @PathParam("policyId") Long policyId);
 
-    // TODO: policyClass is required only for Spring RestTemplate mock. Must be removed for CXF
     @GET
-    @Path("global/{kind}")
-    <T extends PolicyTO> T readGlobal(@PathParam("kind") PolicyType type, Class<T> policyClass);
+    @Path("global")
+    <T extends PolicyTO> T readGlobal(@PathParam("kind") PolicyType type);
 
     @PUT
     @Path("{policyId}")
-    <T extends PolicyTO> T update(@PathParam("policyId") Long policyId, T policyTO);
+    <T extends PolicyTO> T update(@PathParam("kind") PolicyType type,@PathParam("policyId") Long policyId, T policyTO);
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/ResourceService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/ResourceService.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/ResourceService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/ResourceService.java Tue Jan 15 08:50:25 2013
@@ -55,6 +55,9 @@ public interface ResourceService {
     Set<String> getPropagationActionsClasses();
 
     @GET
+    List<ResourceTO> list();
+
+    @GET
     List<ResourceTO> list(@MatrixParam("connInstanceId") Long connInstanceId);
 
     @GET

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/RoleService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/RoleService.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/RoleService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/RoleService.java Tue Jan 15 08:50:25 2013
@@ -37,6 +37,10 @@ public interface RoleService {
     @Path("{roleId}/children")
     List<RoleTO> children(@PathParam("roleId") Long roleId);
 
+    @GET
+    @Path("count")
+    Integer count();
+
     @POST
     RoleTO create(RoleTO roleTO);
 
@@ -48,6 +52,9 @@ public interface RoleService {
     List<RoleTO> list();
 
     @GET
+    List<RoleTO> list(@QueryParam("page") int page, @QueryParam("size") @DefaultValue("25") int size);
+
+    @GET
     @Path("{roleId}/parent")
     RoleTO parent(@PathParam("roleId") Long roleId);
 
@@ -61,8 +68,7 @@ public interface RoleService {
 
     @POST
     @Path("search")
-    List<RoleTO> search(NodeCond searchCondition,
-            @QueryParam("page") int page,
+    List<RoleTO> search(NodeCond searchCondition, @QueryParam("page") int page,
             @QueryParam("size") @DefaultValue("25") int size);
 
     @POST

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/SchemaService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/SchemaService.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/SchemaService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/SchemaService.java Tue Jan 15 08:50:25 2013
@@ -19,26 +19,29 @@
 package org.apache.syncope.services;
 
 import java.util.List;
+
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
+
 import org.apache.syncope.client.to.AbstractSchemaTO;
+import org.apache.syncope.types.AttributableType;
 
 @Path("schemas/{kind}/{type}")
 public interface SchemaService {
 
-    enum SchemaKind {
+    enum SchemaType {
 
         NORMAL("schema"),
         DERIVED("derivedSchema"),
         VIRTUAL("virtualSchema");
 
-        private String name;
+        private final String name;
 
-        private SchemaKind(String name) {
+        private SchemaType(String name) {
             this.name = name;
         }
 
@@ -49,30 +52,30 @@ public interface SchemaService {
     }
 
     @POST
-    <T extends AbstractSchemaTO> T create(@PathParam("kind") String kind,
-            @PathParam("type") SchemaKind type,
+    <T extends AbstractSchemaTO> T create(@PathParam("kind") AttributableType kind,
+            @PathParam("type") SchemaType type,
             T schemaTO);
 
     @DELETE
     @Path("{name}")
-    <T extends AbstractSchemaTO> T delete(@PathParam("kind") String kind,
-            @PathParam("type") SchemaKind type,
+    <T extends AbstractSchemaTO> T delete(@PathParam("kind") AttributableType kind,
+            @PathParam("type") SchemaType type,
             @PathParam("name") String schemaName);
 
     @GET
-    <T extends AbstractSchemaTO> List<T> list(@PathParam("kind") String kind,
-            @PathParam("type") SchemaKind type);
+    <T extends AbstractSchemaTO> List<T> list(@PathParam("kind") AttributableType kind,
+            @PathParam("type") SchemaType type);
 
     @GET
     @Path("{name}")
-    <T extends AbstractSchemaTO> T read(@PathParam("kind") String kind,
-            @PathParam("type") SchemaKind type,
+    <T extends AbstractSchemaTO> T read(@PathParam("kind") AttributableType kind,
+            @PathParam("type") SchemaType type,
             @PathParam("name") String schemaName);
 
     @PUT
     @Path("{name}")
-    <T extends AbstractSchemaTO> T update(@PathParam("kind") String kind,
-            @PathParam("type") SchemaKind type,
+    <T extends AbstractSchemaTO> T update(@PathParam("kind") AttributableType kind,
+            @PathParam("type") SchemaType type,
             @PathParam("name") String schemaName,
             T schemaTO);
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/TaskService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/TaskService.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/TaskService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/TaskService.java Tue Jan 15 08:50:25 2013
@@ -32,20 +32,21 @@ import javax.ws.rs.QueryParam;
 import org.apache.syncope.client.to.TaskExecTO;
 import org.apache.syncope.client.to.TaskTO;
 import org.apache.syncope.types.PropagationTaskExecStatus;
+import org.apache.syncope.types.TaskType;
 
 @Path("tasks")
 public interface TaskService {
 
     @GET
-    @Path("{kind}/count")
-    int count(@PathParam("kind") String kind);
+    @Path("{type}/count")
+    int count(@PathParam("type") TaskType taskType);
 
     @POST
     <T extends TaskTO> T create(T taskTO);
 
     @DELETE
-    @Path("{taskId}")
-    <T extends TaskTO> T delete(@PathParam("taskId") Long taskId, Class<T> type);
+    @Path("{type}/{taskId}")
+    <T extends TaskTO> T delete(@PathParam("type") TaskType taskType, @PathParam("taskId") Long taskId);
 
     @DELETE
     @Path("executions/{executionId}")
@@ -65,21 +66,21 @@ public interface TaskService {
     Set<String> getSyncActionsClasses();
 
     @GET
-    @Path("{kind}")
-    <T extends TaskTO> List<T> list(@PathParam("kind") String kind, Class<T[]> type);
+    @Path("{type}")
+    <T extends TaskTO> List<T> list(@PathParam("type") TaskType taskType);
 
     @GET
-    @Path("{kind}")
-    <T extends TaskTO> List<T> list(@PathParam("kind") String kind, @QueryParam("page") int page,
-            @QueryParam("size") @DefaultValue("25") int size, Class<T[]> type);
+    @Path("{type}")
+    <T extends TaskTO> List<T> list(@PathParam("type") TaskType taskType, @QueryParam("page") int page,
+            @QueryParam("size") @DefaultValue("25") int size);
 
     @GET
-    @Path("{kind}/executions")
-    List<TaskExecTO> listExecutions(@PathParam("kind") String kind);
+    @Path("{type}/executions")
+    List<TaskExecTO> listExecutions(@PathParam("type") TaskType taskType);
 
     @GET
-    @Path("{taskId}")
-    <T extends TaskTO> T read(@PathParam("taskId") Long taskId, Class<T> type);
+    @Path("{type}/{taskId}")
+    <T extends TaskTO> T read(@PathParam("type") TaskType taskType, @PathParam("taskId") Long taskId);
 
     @GET
     @Path("executions/{executionId}")

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -26,62 +26,57 @@ import javax.ws.rs.core.Response;
 
 import org.apache.syncope.client.to.ConfigurationTO;
 import org.apache.syncope.services.ConfigurationService;
-import org.springframework.web.client.RestTemplate;
 
-public class ConfigurationServiceProxy extends SpringServiceProxy implements
-		ConfigurationService {
+public class ConfigurationServiceProxy extends SpringServiceProxy implements ConfigurationService {
 
-	public ConfigurationServiceProxy(String baseUrl, RestTemplate restTemplate) {
-		super(baseUrl, restTemplate);
-	}
-
-	@Override
-	public ConfigurationTO create(ConfigurationTO configurationTO) {
-		return restTemplate.postForObject(baseUrl + "configuration/create",
-				configurationTO, ConfigurationTO.class);
-	}
-
-	@Override
-	public ConfigurationTO delete(String key) {
-		return restTemplate
-				.getForObject(baseUrl + "configuration/delete/{key}.json",
-						ConfigurationTO.class, key);
-	}
-
-	@Override
-	public List<ConfigurationTO> list() {
-		return Arrays.asList(restTemplate.getForObject(baseUrl
-				+ "configuration/list.json", ConfigurationTO[].class));
-	}
-
-	@Override
-	public ConfigurationTO read(String key) {
-		return restTemplate.getForObject(baseUrl
-				+ "configuration/read/{key}.json", ConfigurationTO.class, key);
-	}
-
-	@Override
-	public ConfigurationTO update(String key, ConfigurationTO configurationTO) {
-		return restTemplate.postForObject(baseUrl + "configuration/update",
-				configurationTO, ConfigurationTO.class);
-	}
-
-	@Override
-	public Set<String> getValidators() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Set<String> getMailTemplates() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Response dbExport() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public ConfigurationServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
+    }
+
+    @Override
+    public ConfigurationTO create(ConfigurationTO configurationTO) {
+        return getRestTemplate()
+                .postForObject(baseUrl + "configuration/create", configurationTO, ConfigurationTO.class);
+    }
+
+    @Override
+    public ConfigurationTO delete(String key) {
+        return getRestTemplate().getForObject(baseUrl + "configuration/delete/{key}.json", ConfigurationTO.class, key);
+    }
+
+    @Override
+    public List<ConfigurationTO> list() {
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "configuration/list.json",
+                ConfigurationTO[].class));
+    }
+
+    @Override
+    public ConfigurationTO read(String key) {
+        return getRestTemplate().getForObject(baseUrl + "configuration/read/{key}.json", ConfigurationTO.class, key);
+    }
+
+    @Override
+    public ConfigurationTO update(String key, ConfigurationTO configurationTO) {
+        return getRestTemplate()
+                .postForObject(baseUrl + "configuration/update", configurationTO, ConfigurationTO.class);
+    }
+
+    @Override
+    public Set<String> getValidators() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<String> getMailTemplates() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Response dbExport() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConnectorServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConnectorServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConnectorServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConnectorServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -25,29 +25,28 @@ import org.apache.syncope.client.to.Conn
 import org.apache.syncope.client.to.ConnInstanceTO;
 import org.apache.syncope.services.ConnectorService;
 import org.apache.syncope.types.ConnConfProperty;
-import org.springframework.web.client.RestTemplate;
 
 public class ConnectorServiceProxy extends SpringServiceProxy implements ConnectorService {
 
-    public ConnectorServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public ConnectorServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public ConnInstanceTO create(ConnInstanceTO connectorTO) {
-        return restTemplate.postForObject(baseUrl + "connector/create.json", connectorTO,
+        return getRestTemplate().postForObject(baseUrl + "connector/create.json", connectorTO,
                 ConnInstanceTO.class);
     }
 
     @Override
     public ConnInstanceTO update(Long connectorId, ConnInstanceTO connectorTO) {
-        return restTemplate.postForObject(baseUrl + "connector/update.json", connectorTO,
+        return getRestTemplate().postForObject(baseUrl + "connector/update.json", connectorTO,
                 ConnInstanceTO.class);
     }
 
     @Override
     public ConnInstanceTO delete(Long connectorId) {
-        return restTemplate.getForObject(baseUrl + "connector/delete/{connectorId}.json",
+        return getRestTemplate().getForObject(baseUrl + "connector/delete/{connectorId}.json",
                 ConnInstanceTO.class, connectorId);
     }
 
@@ -57,13 +56,13 @@ public class ConnectorServiceProxy exten
                 ? "?lang=" + lang
                 : "";
 
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "connector/list.json" + param,
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "connector/list.json" + param,
                 ConnInstanceTO[].class));
     }
 
     @Override
     public ConnInstanceTO read(Long connectorId) {
-        return restTemplate.getForObject(baseUrl + "connector/read/{connectorId}", ConnInstanceTO.class,
+        return getRestTemplate().getForObject(baseUrl + "connector/read/{connectorId}", ConnInstanceTO.class,
                 connectorId);
     }
 
@@ -73,7 +72,7 @@ public class ConnectorServiceProxy exten
                 ? "?lang=" + lang
                 : "";
 
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "connector/bundle/list.json" + param,
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "connector/bundle/list.json" + param,
                 ConnBundleTO[].class));
     }
 
@@ -83,25 +82,25 @@ public class ConnectorServiceProxy exten
                 ? "?showall=true"
                 : "?showall=false";
 
-        return Arrays.asList(restTemplate.postForObject(baseUrl + "connector/schema/list" + param, connectorTO,
+        return Arrays.asList(getRestTemplate().postForObject(baseUrl + "connector/schema/list" + param, connectorTO,
                 String[].class));
     }
 
     @Override
     public List<ConnConfProperty> getConfigurationProperties(Long connectorId) {
-        return Arrays.asList(restTemplate
+        return Arrays.asList(getRestTemplate()
                 .getForObject(baseUrl + "connector/{connectorId}/configurationProperty/list",
                         ConnConfProperty[].class, connectorId));
     }
 
     @Override
     public boolean validate(ConnInstanceTO connectorTO) {
-        return restTemplate.postForObject(baseUrl + "connector/check.json", connectorTO, Boolean.class);
+        return getRestTemplate().postForObject(baseUrl + "connector/check.json", connectorTO, Boolean.class);
     }
 
     @Override
     public ConnInstanceTO readConnectorBean(String resourceName) {
-        return restTemplate.getForObject(baseUrl + "connector/{resourceName}/connectorBean",
+        return getRestTemplate().getForObject(baseUrl + "connector/{resourceName}/connectorBean",
                 ConnInstanceTO.class, resourceName);
     }
 

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/EntitlementServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/EntitlementServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/EntitlementServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/EntitlementServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -26,21 +26,21 @@ import org.apache.syncope.services.Entit
 import org.springframework.web.client.RestTemplate;
 
 public class EntitlementServiceProxy extends SpringServiceProxy implements EntitlementService {
-	
-	public EntitlementServiceProxy(String baseUrl, RestTemplate restTemplate) {
-		super(baseUrl, restTemplate);
-	}
 
-	@Override
-	public Set<String> getAllEntitlements() {
-		return new HashSet<String>(Arrays.asList(new RestTemplate().getForObject(
-                baseUrl + "auth/allentitlements.json", String[].class)));
-	}
+    public EntitlementServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
+    }
 
-	@Override
-	public Set<String> getMyEntitlements() {
-		return new HashSet<String>(Arrays.asList(restTemplate.getForObject(baseUrl
-                + "auth/entitlements.json", String[].class)));
-	}
+    @Override
+    public Set<String> getAllEntitlements() {
+        return new HashSet<String>(Arrays.asList(new RestTemplate().getForObject(baseUrl + "auth/allentitlements.json",
+                String[].class)));
+    }
+
+    @Override
+    public Set<String> getMyEntitlements() {
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(baseUrl + "auth/entitlements.json",
+                String[].class)));
+    }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/LoggerServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/LoggerServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/LoggerServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/LoggerServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -24,46 +24,45 @@ import java.util.List;
 import org.apache.syncope.client.to.LoggerTO;
 import org.apache.syncope.services.LoggerService;
 import org.apache.syncope.types.AuditLoggerName;
-import org.springframework.web.client.RestTemplate;
 
 import ch.qos.logback.classic.Level;
 
 public class LoggerServiceProxy extends SpringServiceProxy implements LoggerService {
 
-    public LoggerServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public LoggerServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public List<LoggerTO> listLogs() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "logger/log/list", LoggerTO[].class));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "logger/log/list", LoggerTO[].class));
     }
 
     @Override
     public List<AuditLoggerName> listAudits() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "logger/audit/list",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "logger/audit/list",
                 AuditLoggerName[].class));
     }
 
     @Override
     public LoggerTO update(String name, Level level) {
-        return restTemplate.postForObject(baseUrl + "logger/log/{name}/{level}", null, LoggerTO.class, name,
+        return getRestTemplate().postForObject(baseUrl + "logger/log/{name}/{level}", null, LoggerTO.class, name,
                 level);
     }
 
     @Override
     public LoggerTO delete(String name) {
-        return restTemplate.getForObject(baseUrl + "logger/log/delete/{name}", LoggerTO.class, name);
+        return getRestTemplate().getForObject(baseUrl + "logger/log/delete/{name}", LoggerTO.class, name);
     }
 
     @Override
     public void enableAudit(AuditLoggerName auditLoggerName) {
-        restTemplate.put(baseUrl + "logger/audit/enable", auditLoggerName);
+        getRestTemplate().put(baseUrl + "logger/audit/enable", auditLoggerName);
     }
 
     @Override
     public void disableAudit(AuditLoggerName auditLoggerName) {
-        restTemplate.put(baseUrl + "logger/audit/disable", auditLoggerName);
+        getRestTemplate().put(baseUrl + "logger/audit/disable", auditLoggerName);
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/NotificationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/NotificationServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/NotificationServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/NotificationServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -23,41 +23,40 @@ import java.util.List;
 
 import org.apache.syncope.client.to.NotificationTO;
 import org.apache.syncope.services.NotificationService;
-import org.springframework.web.client.RestTemplate;
 
 public class NotificationServiceProxy extends SpringServiceProxy implements NotificationService {
 
-    public NotificationServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public NotificationServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public NotificationTO read(Long notificationId) {
-        return restTemplate.getForObject(baseUrl + "notification/read/{notificationId}.json",
+        return getRestTemplate().getForObject(baseUrl + "notification/read/{notificationId}.json",
                 NotificationTO.class, notificationId);
     }
 
     @Override
     public List<NotificationTO> list() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "notification/list.json",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "notification/list.json",
                 NotificationTO[].class));
     }
 
     @Override
     public NotificationTO create(NotificationTO notificationTO) {
-        return restTemplate.postForObject(baseUrl + "notification/create.json", notificationTO,
+        return getRestTemplate().postForObject(baseUrl + "notification/create.json", notificationTO,
                 NotificationTO.class);
     }
 
     @Override
     public NotificationTO update(Long notificationId, NotificationTO notificationTO) {
-        return restTemplate.postForObject(baseUrl + "notification/update.json", notificationTO,
+        return getRestTemplate().postForObject(baseUrl + "notification/update.json", notificationTO,
                 NotificationTO.class);
     }
 
     @Override
     public NotificationTO delete(Long notificationId) {
-        return restTemplate.getForObject(baseUrl + "notification/delete/{notificationId}.json",
+        return getRestTemplate().getForObject(baseUrl + "notification/delete/{notificationId}.json",
                 NotificationTO.class, notificationId);
     }
 

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/PolicyServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/PolicyServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/PolicyServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/PolicyServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -20,69 +20,87 @@ package org.apache.syncope.services.prox
 
 import java.util.List;
 
+import org.apache.syncope.client.to.AccountPolicyTO;
+import org.apache.syncope.client.to.PasswordPolicyTO;
 import org.apache.syncope.client.to.PolicyTO;
+import org.apache.syncope.client.to.SyncPolicyTO;
 import org.apache.syncope.services.PolicyService;
 import org.apache.syncope.types.PolicyType;
-import org.springframework.web.client.RestTemplate;
 
 public class PolicyServiceProxy extends SpringServiceProxy implements PolicyService {
 
-	public PolicyServiceProxy(String baseUrl, RestTemplate restTemplate) {
-		super(baseUrl, restTemplate);
-	}
-
-	@Override
-	public <T extends PolicyTO> T create(final T policyTO) {
-		@SuppressWarnings("unchecked")
-		T result = (T) restTemplate.postForObject(baseUrl
-				+ "policy/{kind}/create", policyTO, policyTO.getClass(),
-				typeToUrl(policyTO.getType()));
-		return result;
-	}
-
-	@Override
-	public <T extends PolicyTO> T update(Long policyId, T policyTO) {
-		@SuppressWarnings("unchecked")
-		T result = (T) restTemplate.postForObject(baseUrl
-				+ "policy/{kind}/update", policyTO, policyTO.getClass(),
-				typeToUrl(policyTO.getType()));
-		return result;
-	}
-
-	@Override
-	public <T extends PolicyTO> List<T> listByType(PolicyType type) {
-		@SuppressWarnings("unchecked")
-		List<T> result = restTemplate.getForObject(baseUrl + "policy/{kind}/list",
-				List.class, typeToUrl(type));
-		return result;
-	}
-
-	@Override
-	public <T extends PolicyTO> T readGlobal(PolicyType type, Class<T> policyClass) {
-		T result = restTemplate.getForObject(baseUrl + "policy/{kind}/global/read",
-                policyClass, typeToUrl(type));
-		return result;
-	}
-
-	@Override
-	public <T extends PolicyTO> T read(Long policyId, Class<T> policyClass) {
-		T result = restTemplate.getForObject(baseUrl + "policy/read/{id}", policyClass, policyId);
-		return result;
-	}
-
-	@Override
-	public <T extends PolicyTO> T delete(Long policyId, Class<T> policyClass) {
-		T result = restTemplate.getForObject(baseUrl + "policy/delete/{id}", policyClass, policyId);
-		return result;
-	}
+    public PolicyServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
+    }
+
+    @Override
+    public <T extends PolicyTO> T create(PolicyType type, final T policyTO) {
+        @SuppressWarnings("unchecked")
+        T result = (T) getRestTemplate().postForObject(baseUrl + "policy/{kind}/create", policyTO, policyTO.getClass(),
+                typeToUrl(policyTO.getType()));
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends PolicyTO> T delete(PolicyType type, Long policyId) {
+        T result = (T) getRestTemplate().getForObject(baseUrl + "policy/delete/{id}", getTOClass(type), policyId);
+        return result;
+    }
+
+    private Class<? extends PolicyTO> getTOClass(PolicyType type) {
+        switch (type) {
+        case ACCOUNT:
+        case GLOBAL_ACCOUNT:
+            return AccountPolicyTO.class;
+        case PASSWORD:
+        case GLOBAL_PASSWORD:
+            return PasswordPolicyTO.class;
+        case SYNC:
+        case GLOBAL_SYNC:
+            return SyncPolicyTO.class;
+        default:
+            throw new IllegalArgumentException("Policy Type not supported");
+        }
+    }
+
+    @Override
+    public <T extends PolicyTO> List<T> listByType(PolicyType type) {
+        @SuppressWarnings("unchecked")
+        List<T> result = getRestTemplate().getForObject(baseUrl + "policy/{kind}/list", List.class, typeToUrl(type));
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends PolicyTO> T read(PolicyType type, Long policyId) {
+        T result = (T) getRestTemplate().getForObject(baseUrl + "policy/read/{id}", getTOClass(type), policyId);
+        return result;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T extends PolicyTO> T readGlobal(PolicyType type) {
+        T result = (T) getRestTemplate().getForObject(baseUrl + "policy/{kind}/global/read", getTOClass(type),
+                typeToUrl(type));
+        return result;
+    }
 
     private String typeToUrl(PolicyType type) {
-    	String url = type.name().toLowerCase();
-    	int index = url.indexOf("_");
-    	if (index != -1) {
-    		return url.substring(index + 1);
-    	} else {
-    		return url;
-    	}
+        String url = type.name().toLowerCase();
+        int index = url.indexOf("_");
+        if (index != -1) {
+            return url.substring(index + 1);
+        } else {
+            return url;
+        }
+    }
+
+    @Override
+    public <T extends PolicyTO> T update(PolicyType type, Long policyId, T policyTO) {
+        @SuppressWarnings("unchecked")
+        T result = (T) getRestTemplate().postForObject(baseUrl + "policy/{kind}/update", policyTO, policyTO.getClass(),
+                typeToUrl(policyTO.getType()));
+        return result;
     }
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -25,32 +25,31 @@ import org.apache.syncope.client.to.Repo
 import org.apache.syncope.client.to.ReportTO;
 import org.apache.syncope.services.ReportService;
 import org.apache.syncope.types.ReportExecExportFormat;
-import org.springframework.web.client.RestTemplate;
 
 public class ReportServiceProxy extends SpringServiceProxy implements ReportService {
 
-    public ReportServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public ReportServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public ReportTO create(ReportTO reportTO) {
-        return restTemplate.postForObject(baseUrl + "report/create", reportTO, ReportTO.class);
+        return getRestTemplate().postForObject(baseUrl + "report/create", reportTO, ReportTO.class);
     }
 
     @Override
     public ReportTO update(Long reportId, ReportTO reportTO) {
-        return restTemplate.postForObject(baseUrl + "report/update", reportTO, ReportTO.class);
+        return getRestTemplate().postForObject(baseUrl + "report/update", reportTO, ReportTO.class);
     }
 
     @Override
     public int count() {
-        return restTemplate.getForObject(baseUrl + "report/count.json", Integer.class);
+        return getRestTemplate().getForObject(baseUrl + "report/count.json", Integer.class);
     }
 
     @Override
     public List<ReportTO> list() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "report/list", ReportTO[].class));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/list", ReportTO[].class));
     }
 
     @Override
@@ -61,24 +60,24 @@ public class ReportServiceProxy extends 
 
     @Override
     public List<ReportExecTO> listExecutions() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "report/execution/list",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/execution/list",
                 ReportExecTO[].class));
     }
 
     @Override
     public List<String> getReportletConfClasses() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "report/reportletConfClasses.json",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/reportletConfClasses.json",
                 String[].class));
     }
 
     @Override
     public ReportTO read(Long reportId) {
-        return restTemplate.getForObject(baseUrl + "report/read/{reportId}", ReportTO.class, reportId);
+        return getRestTemplate().getForObject(baseUrl + "report/read/{reportId}", ReportTO.class, reportId);
     }
 
     @Override
     public ReportExecTO readExecution(Long executionId) {
-        return restTemplate.getForObject(baseUrl + "report/execution/read/{reportId}",
+        return getRestTemplate().getForObject(baseUrl + "report/execution/read/{reportId}",
                 ReportExecTO.class, executionId);
     }
 
@@ -90,13 +89,13 @@ public class ReportServiceProxy extends 
 
     @Override
     public ReportExecTO execute(Long reportId) {
-        return restTemplate.postForObject(baseUrl + "report/execute/{reportId}", null,
+        return getRestTemplate().postForObject(baseUrl + "report/execute/{reportId}", null,
                 ReportExecTO.class, reportId);
     }
 
     @Override
     public ReportTO delete(Long reportId) {
-        return restTemplate.getForObject(baseUrl + "report/delete/{reportId}",
+        return getRestTemplate().getForObject(baseUrl + "report/delete/{reportId}",
                 ReportTO.class, reportId);
     }
 

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ResourceServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ResourceServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ResourceServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ResourceServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -28,62 +28,63 @@ import org.apache.syncope.client.to.Conn
 import org.apache.syncope.client.to.ResourceTO;
 import org.apache.syncope.services.ResourceService;
 import org.apache.syncope.types.AttributableType;
-import org.springframework.web.client.RestTemplate;
 
 public class ResourceServiceProxy extends SpringServiceProxy implements ResourceService {
 
-    public ResourceServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public ResourceServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public ResourceTO create(ResourceTO resourceTO) {
-        return restTemplate.postForObject(baseUrl + "resource/create.json", resourceTO, ResourceTO.class);
+        return getRestTemplate().postForObject(baseUrl + "resource/create.json", resourceTO, ResourceTO.class);
     }
 
     @Override
     public ResourceTO update(String resourceName, ResourceTO resourceTO) {
-        return restTemplate.postForObject(baseUrl + "resource/update.json", resourceTO, ResourceTO.class);
+        return getRestTemplate().postForObject(baseUrl + "resource/update.json", resourceTO, ResourceTO.class);
     }
 
     @Override
     public ResourceTO delete(String resourceName) {
-        return restTemplate.getForObject(baseUrl + "resource/delete/{resourceName}.json", ResourceTO.class,
+        return getRestTemplate().getForObject(baseUrl + "resource/delete/{resourceName}.json", ResourceTO.class,
                 resourceName);
     }
 
     @Override
     public ResourceTO read(String resourceName) {
-        return restTemplate.getForObject(baseUrl + "resource/read/{resourceName}.json", ResourceTO.class,
-                resourceName);
+        return getRestTemplate().getForObject(baseUrl + "resource/read/{resourceName}.json", ResourceTO.class, resourceName);
     }
 
     @Override
     public Set<String> getPropagationActionsClasses() {
-        return new HashSet<String>(Arrays.asList(restTemplate.getForObject(baseUrl
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(baseUrl
                 + "resource/propagationActionsClasses.json", String[].class)));
     }
 
     @Override
+    public List<ResourceTO> list() {
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "resource/list.json", ResourceTO[].class));
+    }
+
+    @Override
     public List<ResourceTO> list(Long connInstanceId) {
-        String query = (connInstanceId != null)
-                ? query = "?connInstanceId=" + connInstanceId.toString()
-                : "";
+        if (connInstanceId == null)
+            return list();
 
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "resource/list.json" + query,
-                ResourceTO[].class, connInstanceId));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "resource/list.json?connInstanceId={connId}", ResourceTO[].class,
+                connInstanceId));
     }
 
     @Override
     public ConnObjectTO getConnector(String resourceName, AttributableType type, String objectId) {
-        return restTemplate.getForObject(baseUrl + "resource/{resourceName}/read/{type}/{objectId}.json",
-                ConnObjectTO.class, resourceName, type, objectId);
+        return getRestTemplate().getForObject(baseUrl + "resource/{resourceName}/read/{type}/{objectId}.json",
+                ConnObjectTO.class, resourceName, type.toString().toUpperCase(), objectId);
     }
 
     @Override
     public boolean check(ResourceTO resourceTO) {
-        return restTemplate.postForObject(baseUrl + "resource/check.json", resourceTO, Boolean.class)
-                .booleanValue();
+        return getRestTemplate().postForObject(baseUrl + "resource/check.json", resourceTO, Boolean.class).booleanValue();
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/RoleServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/RoleServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/RoleServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/RoleServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -25,78 +25,80 @@ import org.apache.syncope.client.mod.Rol
 import org.apache.syncope.client.search.NodeCond;
 import org.apache.syncope.client.to.RoleTO;
 import org.apache.syncope.services.RoleService;
-import org.springframework.web.client.RestTemplate;
 
 public class RoleServiceProxy extends SpringServiceProxy implements RoleService {
 
-	public RoleServiceProxy(String baseUrl, RestTemplate restTemplate) {
-		super(baseUrl, restTemplate);
-	}
-
-	@Override
-	public List<RoleTO> children(Long roleId) {
-		return Arrays.asList(restTemplate.getForObject(baseUrl
-				+ "role/children/{roleId}.json", RoleTO[].class, roleId));
-	}
-
-	@Override
-	public RoleTO create(RoleTO roleTO) {
-		return restTemplate.postForObject(baseUrl + "role/create", roleTO,
-				RoleTO.class);
-	}
-
-	@Override
-	public RoleTO delete(Long roleId) {
-		return restTemplate.getForObject(baseUrl + "role/delete/{roleId}",
-				RoleTO.class, roleId);
-	}
-
-	@Override
-	public List<RoleTO> list() {
-		return Arrays.asList(restTemplate.getForObject(baseUrl
-				+ "role/list.json", RoleTO[].class));
-	}
-
-	@Override
-	public RoleTO parent(Long roleId) {
-		return restTemplate.getForObject(baseUrl + "role/parent/{roleId}.json",
-				RoleTO.class, roleId);
-	}
-
-	@Override
-	public RoleTO read(Long roleId) {
-		return restTemplate.getForObject(baseUrl + "role/read/{roleId}.json",
-				RoleTO.class, roleId);
-	}
-
-	@Override
-	public List<RoleTO> search(NodeCond searchCondition) {
-		return Arrays.asList(restTemplate.postForObject(
-				baseUrl + "role/search", searchCondition, RoleTO[].class));
-	}
-
-	@Override
-	public List<RoleTO> search(NodeCond searchCondition, int page, int size) {
-		return Arrays.asList(restTemplate.postForObject(
-				baseUrl + "role/search/{page}/{size}", searchCondition, RoleTO[].class, page, size));
-	}
-
-	@Override
-	public int searchCount(NodeCond searchCondition) {
-		return restTemplate.postForObject(baseUrl + "role/search/count.json",
-				searchCondition, Integer.class);
-	}
-
-	@Override
-	public RoleTO selfRead(Long roleId) {
-		return restTemplate.getForObject(baseUrl + "role/selfRead/{roleId}",
-				RoleTO.class, roleId);
-	}
-
-	@Override
-	public RoleTO update(Long roleId, RoleMod roleMod) {
-		return restTemplate.postForObject(baseUrl + "role/update", roleMod,
-				RoleTO.class);
-	}
+    public RoleServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
+    }
+
+    @Override
+    public List<RoleTO> children(Long roleId) {
+        return Arrays
+                .asList(getRestTemplate().getForObject(baseUrl + "role/children/{roleId}.json", RoleTO[].class, roleId));
+    }
+
+    @Override
+    public Integer count() {
+        //return getRestTemplate().getForObject(baseUrl + "role/count.json", Integer.class);
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public RoleTO create(RoleTO roleTO) {
+        return getRestTemplate().postForObject(baseUrl + "role/create", roleTO, RoleTO.class);
+    }
+
+    @Override
+    public RoleTO delete(Long roleId) {
+        return getRestTemplate().getForObject(baseUrl + "role/delete/{roleId}", RoleTO.class, roleId);
+    }
+
+    @Override
+    public List<RoleTO> list() {
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "role/list.json", RoleTO[].class));
+    }
+
+    @Override
+    public List<RoleTO> list(int page, int size) {
+        //        return Arrays.asList(getRestTemplate().getForObject(baseURL + "role/list.json", RoleTO[].class, page, size));
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public RoleTO parent(Long roleId) {
+        return getRestTemplate().getForObject(baseUrl + "role/parent/{roleId}.json", RoleTO.class, roleId);
+    }
+
+    @Override
+    public RoleTO read(Long roleId) {
+        return getRestTemplate().getForObject(baseUrl + "role/read/{roleId}.json", RoleTO.class, roleId);
+    }
+
+    @Override
+    public List<RoleTO> search(NodeCond searchCondition) {
+        return Arrays.asList(getRestTemplate().postForObject(baseUrl + "role/search", searchCondition, RoleTO[].class));
+    }
+
+    @Override
+    public List<RoleTO> search(NodeCond searchCondition, int page, int size) {
+        return Arrays.asList(getRestTemplate().postForObject(baseUrl + "role/search/{page}/{size}", searchCondition,
+                RoleTO[].class, page, size));
+    }
+
+    @Override
+    public int searchCount(NodeCond searchCondition) {
+        return getRestTemplate().postForObject(baseUrl + "role/search/count.json", searchCondition, Integer.class);
+    }
+
+    @Override
+    public RoleTO selfRead(Long roleId) {
+        return getRestTemplate().getForObject(baseUrl + "role/selfRead/{roleId}", RoleTO.class, roleId);
+    }
+
+    @Override
+    public RoleTO update(Long roleId, RoleMod roleMod) {
+        return getRestTemplate().postForObject(baseUrl + "role/update", roleMod, RoleTO.class);
+    }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SchemaServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SchemaServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SchemaServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SchemaServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -26,44 +26,44 @@ import org.apache.syncope.client.to.Deri
 import org.apache.syncope.client.to.SchemaTO;
 import org.apache.syncope.client.to.VirtualSchemaTO;
 import org.apache.syncope.services.SchemaService;
-import org.springframework.web.client.RestTemplate;
+import org.apache.syncope.types.AttributableType;
 
 @SuppressWarnings("unchecked")
 public class SchemaServiceProxy extends SpringServiceProxy implements SchemaService {
 
-    public SchemaServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public SchemaServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
-    public <T extends AbstractSchemaTO> T create(String kind, SchemaKind type, T schemaTO) {
-        return (T) restTemplate.postForObject(baseUrl + type + "/{kind}/create", schemaTO, getTOClass(type), kind);
+    public <T extends AbstractSchemaTO> T create(AttributableType kind, SchemaType type, T schemaTO) {
+        return (T) getRestTemplate().postForObject(baseUrl + type + "/{kind}/create", schemaTO, getTOClass(type), kind);
     }
 
     @Override
-    public <T extends AbstractSchemaTO> T delete(String kind, SchemaKind type, String schemaName) {
-        return (T) restTemplate.getForObject(baseUrl + type + "/{kind}/delete/{name}.json", getTOClass(type), kind,
+    public <T extends AbstractSchemaTO> T delete(AttributableType kind, SchemaType type, String schemaName) {
+        return (T) getRestTemplate().getForObject(baseUrl + type + "/{kind}/delete/{name}.json", getTOClass(type), kind,
                 schemaName);
     }
 
     @Override
-    public <T extends AbstractSchemaTO> List<T> list(String kind, SchemaKind type) {
+    public <T extends AbstractSchemaTO> List<T> list(AttributableType kind, SchemaType type) {
         switch (type) {
         case NORMAL:
-            return (List<T>) Arrays.asList(restTemplate.getForObject(baseUrl + type + "/{kind}/list.json",
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
                     SchemaTO[].class, kind));
         case DERIVED:
-            return (List<T>) Arrays.asList(restTemplate.getForObject(baseUrl + type + "/{kind}/list.json",
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
                     DerivedSchemaTO[].class, kind));
         case VIRTUAL:
-            return (List<T>) Arrays.asList(restTemplate.getForObject(baseUrl + type + "/{kind}/list.json",
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + type + "/{kind}/list.json",
                     VirtualSchemaTO[].class, kind));
         default:
             throw new IllegalArgumentException("SchemaType is not supported.");
         }
     }
 
-    private Class<? extends AbstractSchemaTO> getTOClass(SchemaKind type) {
+    private Class<? extends AbstractSchemaTO> getTOClass(SchemaType type) {
         switch (type) {
         case NORMAL:
             return SchemaTO.class;
@@ -77,13 +77,13 @@ public class SchemaServiceProxy extends 
     }
 
     @Override
-    public <T extends AbstractSchemaTO> T read(String kind, SchemaKind type, String schemaName) {
-        return (T) restTemplate.getForObject(baseUrl + type + "/{kind}/read/{name}.json", getTOClass(type), kind,
+    public <T extends AbstractSchemaTO> T read(AttributableType kind, SchemaType type, String schemaName) {
+        return (T) getRestTemplate().getForObject(baseUrl + type + "/{kind}/read/{name}.json", getTOClass(type), kind,
                 schemaName);
     }
 
     @Override
-    public <T extends AbstractSchemaTO> T update(String kind, SchemaKind type, String schemaName, T schemaTO) {
-        return (T) restTemplate.postForObject(baseUrl + type + "/{kind}/update", schemaTO, getTOClass(type), kind);
+    public <T extends AbstractSchemaTO> T update(AttributableType kind, SchemaType type, String schemaName, T schemaTO) {
+        return (T) getRestTemplate().postForObject(baseUrl + type + "/{kind}/update", schemaTO, getTOClass(type), kind);
     }
 }

Added: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringRestTemplate.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringRestTemplate.java?rev=1433313&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringRestTemplate.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringRestTemplate.java Tue Jan 15 08:50:25 2013
@@ -0,0 +1,26 @@
+/*
+ * 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.services.proxy;
+
+import org.springframework.web.client.RestTemplate;
+
+public interface SpringRestTemplate {
+
+    RestTemplate getRestTemplate();
+}

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/SpringServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -22,12 +22,16 @@ import org.springframework.web.client.Re
 
 public abstract class SpringServiceProxy {
 
-	protected RestTemplate restTemplate;
-
 	protected String baseUrl;
 
-	public SpringServiceProxy(String baseUrl, RestTemplate restTemplate) {
-		this.restTemplate = restTemplate;
+	private final SpringRestTemplate callback;
+
+	public SpringServiceProxy(String baseUrl, SpringRestTemplate callback) {
 		this.baseUrl = baseUrl;
+		this.callback = callback;
 	}
+
+    public RestTemplate getRestTemplate() {
+        return callback.getRestTemplate();
+    }
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/TaskServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/TaskServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/TaskServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/TaskServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -23,26 +23,28 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.syncope.client.to.NotificationTaskTO;
+import org.apache.syncope.client.to.PropagationTaskTO;
 import org.apache.syncope.client.to.SchedTaskTO;
 import org.apache.syncope.client.to.SyncTaskTO;
 import org.apache.syncope.client.to.TaskExecTO;
 import org.apache.syncope.client.to.TaskTO;
 import org.apache.syncope.services.TaskService;
 import org.apache.syncope.types.PropagationTaskExecStatus;
-import org.springframework.web.client.RestTemplate;
+import org.apache.syncope.types.TaskType;
 
+@SuppressWarnings("unchecked")
 public class TaskServiceProxy extends SpringServiceProxy implements TaskService {
 
-    public TaskServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public TaskServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
-    public int count(String kind) {
-        return restTemplate.getForObject(baseUrl + "task/{kind}/count.json", Integer.class, kind);
+    public int count(TaskType type) {
+        return getRestTemplate().getForObject(baseUrl + "task/{type}/count.json", Integer.class, type);
     }
 
-    @SuppressWarnings("unchecked")
     @Override
     public <T extends TaskTO> T create(T taskTO) {
         String subTypeString = (taskTO instanceof SyncTaskTO)
@@ -51,19 +53,18 @@ public class TaskServiceProxy extends Sp
                         ? "sched"
                         : "";
 
-        return (T) restTemplate.postForObject(baseUrl + "task/create/{type}", taskTO, taskTO.getClass(),
-                subTypeString);
+        return (T) getRestTemplate().postForObject(baseUrl + "task/create/{type}", taskTO, taskTO.getClass(), subTypeString);
     }
 
     @Override
-    public <T extends TaskTO> T delete(Long taskId, Class<T> type) {
-        return restTemplate.getForObject(baseUrl + "task/delete/{taskId}", type, taskId);
+    public <T extends TaskTO> T delete(TaskType type, Long taskId) {
+        return (T) getRestTemplate().getForObject(baseUrl + "task/delete/{taskId}", getTOClass(type), taskId);
     }
 
     @Override
     public TaskExecTO deleteExecution(Long executionId) {
-        // TODO Auto-generated method stub
-        return null;
+        return getRestTemplate()
+                .getForObject(baseUrl + "task/execution/delete/{executionId}", TaskExecTO.class, executionId);
     }
 
     @Override
@@ -71,58 +72,98 @@ public class TaskServiceProxy extends Sp
         String param = (dryRun)
                 ? "?dryRun=true"
                 : "";
-        return restTemplate.postForObject(baseUrl + "task/execute/{taskId}" + param, null, TaskExecTO.class,
-                taskId);
+        return getRestTemplate().postForObject(baseUrl + "task/execute/{taskId}" + param, null, TaskExecTO.class, taskId);
     }
 
     @Override
     public Set<String> getJobClasses() {
-        return new HashSet<String>(Arrays.asList(restTemplate.getForObject(baseUrl + "task/jobClasses.json",
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/jobClasses.json",
                 String[].class)));
     }
 
     @Override
     public Set<String> getSyncActionsClasses() {
-        return new HashSet<String>(Arrays.asList(restTemplate.getForObject(baseUrl
-                + "task/syncActionsClasses.json", String[].class)));
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/syncActionsClasses.json",
+                String[].class)));
     }
 
     @Override
-    public <T extends TaskTO> List<T> list(String kind, Class<T[]> type) {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "task/{kind}/list", type, kind));
+    public <T extends TaskTO> List<T> list(TaskType type) {
+        switch (type) {
+        case PROPAGATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+                    PropagationTaskTO[].class, type));
+        case NOTIFICATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list",
+                    NotificationTaskTO[].class, type));
+        case SCHEDULED:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list", SchedTaskTO[].class,
+                    type));
+        case SYNCHRONIZATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list", SyncTaskTO[].class,
+                    type));
+        default:
+            throw new IllegalArgumentException("TaskType is not supported.");
+        }
+    }
+
+    private Class<? extends TaskTO> getTOClass(TaskType type) {
+        switch (type) {
+        case PROPAGATION:
+            return PropagationTaskTO.class;
+        case NOTIFICATION:
+            return NotificationTaskTO.class;
+        case SCHEDULED:
+            return SchedTaskTO.class;
+        case SYNCHRONIZATION:
+            return SyncTaskTO.class;
+        default:
+            throw new IllegalArgumentException("SchemaType is not supported.");
+        }
     }
 
     @Override
-    public <T extends TaskTO> List<T> list(String kind, int page, int size, Class<T[]> type) {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "task/{kind}/list/{page}/{size}.json",
-                type, kind, page, size));
+    public <T extends TaskTO> List<T> list(TaskType type, int page, int size) {
+        switch (type) {
+        case PROPAGATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list/{page}/{size}.json",
+                    PropagationTaskTO[].class, type, page, size));
+        case NOTIFICATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list/{page}/{size}.json",
+                    NotificationTaskTO[].class, type, page, size));
+        case SCHEDULED:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list/{page}/{size}.json",
+                    SchedTaskTO[].class, type, page, size));
+        case SYNCHRONIZATION:
+            return (List<T>) Arrays.asList(getRestTemplate().getForObject(baseUrl + "task/{type}/list/{page}/{size}.json",
+                    SyncTaskTO[].class, type, page, size));
+        default:
+            throw new IllegalArgumentException("TaskType is not supported.");
+        }
     }
 
     @Override
-    public List<TaskExecTO> listExecutions(String kind) {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "task/{kind}/execution/list",
-                TaskExecTO[].class, kind));
+    public List<TaskExecTO> listExecutions(TaskType type) {
+        return Arrays.asList(getRestTemplate()
+                .getForObject(baseUrl + "task/{type}/execution/list", TaskExecTO[].class, type));
     }
 
     @Override
-    public <T extends TaskTO> T read(Long taskId, Class<T> type) {
-        return restTemplate.getForObject(baseUrl + "task/read/{taskId}", type, taskId);
+    public <T extends TaskTO> T read(TaskType type, Long taskId) {
+        return (T) getRestTemplate().getForObject(baseUrl + "task/read/{taskId}", getTOClass(type), taskId);
     }
 
     @Override
     public TaskExecTO readExecution(Long executionId) {
-        return restTemplate.getForObject(baseUrl + "task/execution/read/{taskId}", TaskExecTO.class,
-                executionId);
+        return getRestTemplate().getForObject(baseUrl + "task/execution/read/{taskId}", TaskExecTO.class, executionId);
     }
 
     @Override
     public TaskExecTO report(Long executionId, PropagationTaskExecStatus status, String message) {
-        return restTemplate.getForObject(baseUrl + "task/execution/report/{executionId}"
-                + "?executionStatus={status}&message={message}", TaskExecTO.class, executionId, status,
-                message);
+        return getRestTemplate().getForObject(baseUrl + "task/execution/report/{executionId}"
+                + "?executionStatus={status}&message={message}", TaskExecTO.class, executionId, status, message);
     }
 
-    @SuppressWarnings("unchecked")
     @Override
     public <T extends TaskTO> T update(Long taskId, T taskTO) {
         String path = (taskTO instanceof SyncTaskTO)
@@ -133,7 +174,7 @@ public class TaskServiceProxy extends Sp
         if (path == null)
             throw new IllegalArgumentException("Task can only be instance of SchedTaskTO or SyncTaskTO");
 
-        return (T) restTemplate.postForObject(baseUrl + "task/update/" + path, taskTO, taskTO.getClass());
+        return (T) getRestTemplate().postForObject(baseUrl + "task/update/" + path, taskTO, taskTO.getClass());
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -24,12 +24,11 @@ import org.apache.syncope.client.mod.Use
 import org.apache.syncope.client.to.UserRequestTO;
 import org.apache.syncope.client.to.UserTO;
 import org.apache.syncope.services.UserRequestService;
-import org.springframework.web.client.RestTemplate;
 
 public class UserRequestServiceProxy extends SpringServiceProxy implements UserRequestService {
 
-    public UserRequestServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public UserRequestServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
@@ -40,17 +39,17 @@ public class UserRequestServiceProxy ext
 
     @Override
     public UserRequestTO create(UserTO userTO) {
-        return restTemplate.postForObject(baseUrl + "user/request/create", userTO, UserRequestTO.class);
+        return getRestTemplate().postForObject(baseUrl + "user/request/create", userTO, UserRequestTO.class);
     }
 
     @Override
     public UserRequestTO update(UserMod userMod) {
-        return restTemplate.postForObject(baseUrl + "user/request/update", userMod, UserRequestTO.class);
+        return getRestTemplate().postForObject(baseUrl + "user/request/update", userMod, UserRequestTO.class);
     }
 
     @Override
     public UserRequestTO delete(Long userId) {
-        return restTemplate.getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class,
+        return getRestTemplate().getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class,
                 userId);
     }
 

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -27,61 +27,60 @@ import org.apache.syncope.client.search.
 import org.apache.syncope.client.to.UserTO;
 import org.apache.syncope.client.to.WorkflowFormTO;
 import org.apache.syncope.services.UserService;
-import org.springframework.web.client.RestTemplate;
 
 public class UserServiceProxy extends SpringServiceProxy implements UserService {
 
-    public UserServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public UserServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public Boolean verifyPassword(String username, String password) {
-        return restTemplate.getForObject(
+        return getRestTemplate().getForObject(
                 baseUrl + "user/verifyPassword/{username}.json?password={password}", Boolean.class,
                 username, password);
     }
 
     @Override
     public int count() {
-        return restTemplate.getForObject(baseUrl + "user/count.json", Integer.class);
+        return getRestTemplate().getForObject(baseUrl + "user/count.json", Integer.class);
     }
 
     @Override
     public List<UserTO> list() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "user/list.json", UserTO[].class));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/list.json", UserTO[].class));
     }
 
     @Override
     public List<UserTO> list(int page, int size) {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "user/list/{page}/{size}.json",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/list/{page}/{size}.json",
                 UserTO[].class, page, size));
     }
 
     @Override
     public UserTO read(Long userId) {
-        return restTemplate.getForObject(baseUrl + "user/read/{userId}.json", UserTO.class, userId);
+        return getRestTemplate().getForObject(baseUrl + "user/read/{userId}.json", UserTO.class, userId);
     }
 
     @Override
     public UserTO read(String username) {
-        return restTemplate.getForObject(baseUrl + "user/readByUsername/{username}.json", UserTO.class,
+        return getRestTemplate().getForObject(baseUrl + "user/readByUsername/{username}.json", UserTO.class,
                 username);
     }
 
     @Override
     public UserTO create(UserTO userTO) {
-        return restTemplate.postForObject(baseUrl + "user/create", userTO, UserTO.class);
+        return getRestTemplate().postForObject(baseUrl + "user/create", userTO, UserTO.class);
     }
 
     @Override
     public UserTO update(Long userId, UserMod userMod) {
-        return restTemplate.postForObject(baseUrl + "user/update", userMod, UserTO.class);
+        return getRestTemplate().postForObject(baseUrl + "user/update", userMod, UserTO.class);
     }
 
     @Override
     public UserTO delete(Long userId) {
-        return restTemplate.getForObject(baseUrl + "user/delete/{userId}", UserTO.class, userId);
+        return getRestTemplate().getForObject(baseUrl + "user/delete/{userId}", UserTO.class, userId);
     }
 
     @Override
@@ -91,91 +90,91 @@ public class UserServiceProxy extends Sp
 
     @Override
     public List<WorkflowFormTO> getForms() {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "user/workflow/form/list",
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/workflow/form/list",
                 WorkflowFormTO[].class));
     }
 
     @Override
     public WorkflowFormTO getFormForUser(Long userId) {
-        return restTemplate.getForObject(baseUrl + "user/workflow/form/{userId}", WorkflowFormTO.class,
+        return getRestTemplate().getForObject(baseUrl + "user/workflow/form/{userId}", WorkflowFormTO.class,
                 userId);
     }
 
     @Override
     public WorkflowFormTO claimForm(String taskId) {
-        return restTemplate.getForObject(baseUrl + "user/workflow/form/claim/{taskId}",
+        return getRestTemplate().getForObject(baseUrl + "user/workflow/form/claim/{taskId}",
                 WorkflowFormTO.class, taskId);
     }
 
     @Override
     public UserTO submitForm(WorkflowFormTO form) {
-        return restTemplate.postForObject(baseUrl + "user/workflow/form/submit", form, UserTO.class);
+        return getRestTemplate().postForObject(baseUrl + "user/workflow/form/submit", form, UserTO.class);
     }
 
     @Override
     public UserTO activate(long userId, String token) {
-        return restTemplate.getForObject(baseUrl + "user/activate/{userId}?token=" + token, UserTO.class,
+        return getRestTemplate().getForObject(baseUrl + "user/activate/{userId}?token=" + token, UserTO.class,
                 userId);
     }
 
     @Override
     public UserTO activateByUsername(String username, String token) {
-        return restTemplate.getForObject(baseUrl + "user/activateByUsername/{username}.json?token=" + token,
+        return getRestTemplate().getForObject(baseUrl + "user/activateByUsername/{username}.json?token=" + token,
                 UserTO.class, username);
     }
 
     @Override
     public UserTO suspend(long userId) {
-        return restTemplate.getForObject(baseUrl + "user/suspend/{userId}", UserTO.class, userId);
+        return getRestTemplate().getForObject(baseUrl + "user/suspend/{userId}", UserTO.class, userId);
     }
 
     @Override
     public UserTO reactivate(long userId) {
-        return restTemplate.getForObject(baseUrl + "user/reactivate/{userId}", UserTO.class, userId);
+        return getRestTemplate().getForObject(baseUrl + "user/reactivate/{userId}", UserTO.class, userId);
     }
 
     @Override
     public UserTO reactivate(long userId, String query) {
-        return restTemplate.getForObject(baseUrl + "user/reactivate/" + userId + query, UserTO.class);
+        return getRestTemplate().getForObject(baseUrl + "user/reactivate/" + userId + query, UserTO.class);
     }
 
     @Override
     public UserTO suspendByUsername(String username) {
-        return restTemplate.getForObject(baseUrl + "user/suspendByUsername/{username}.json", UserTO.class,
+        return getRestTemplate().getForObject(baseUrl + "user/suspendByUsername/{username}.json", UserTO.class,
                 username);
     }
 
     @Override
     public UserTO reactivateByUsername(String username) {
-        return restTemplate.getForObject(baseUrl + "user/reactivateByUsername/{username}.json",
+        return getRestTemplate().getForObject(baseUrl + "user/reactivateByUsername/{username}.json",
                 UserTO.class, username);
     }
 
     @Override
     public UserTO suspend(long userId, String query) {
-        return restTemplate.getForObject(baseUrl + "user/suspend/" + userId + query, UserTO.class);
+        return getRestTemplate().getForObject(baseUrl + "user/suspend/" + userId + query, UserTO.class);
     }
 
     @Override
     public UserTO readSelf() {
-        return restTemplate.getForObject(baseUrl + "user/read/self", UserTO.class);
+        return getRestTemplate().getForObject(baseUrl + "user/read/self", UserTO.class);
     }
 
     @Override
     public List<UserTO> search(NodeCond searchCondition) {
-        return Arrays.asList(restTemplate.postForObject(baseUrl + "user/search", searchCondition,
+        return Arrays.asList(getRestTemplate().postForObject(baseUrl + "user/search", searchCondition,
                 UserTO[].class));
     }
 
     @Override
     public List<UserTO> search(NodeCond searchCondition, int page, int size) {
-        return Arrays.asList(restTemplate.postForObject(baseUrl + "user/search/{page}/{size}",
+        return Arrays.asList(getRestTemplate().postForObject(baseUrl + "user/search/{page}/{size}",
                 searchCondition, UserTO[].class, page, size));
     }
 
     @Override
     public int searchCount(NodeCond searchCondition) {
-        return restTemplate
+        return getRestTemplate()
                 .postForObject(baseUrl + "user/search/count.json", searchCondition, Integer.class);
     }
 

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/WorkflowServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/WorkflowServiceProxy.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/WorkflowServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/WorkflowServiceProxy.java Tue Jan 15 08:50:25 2013
@@ -23,28 +23,27 @@ import java.util.List;
 
 import org.apache.syncope.client.to.WorkflowDefinitionTO;
 import org.apache.syncope.services.WorkflowService;
-import org.springframework.web.client.RestTemplate;
 
 public class WorkflowServiceProxy extends SpringServiceProxy implements WorkflowService {
 
-    public WorkflowServiceProxy(String baseUrl, RestTemplate restTemplate) {
-        super(baseUrl, restTemplate);
+    public WorkflowServiceProxy(String baseUrl, SpringRestTemplate callback) {
+        super(baseUrl, callback);
     }
 
     @Override
     public WorkflowDefinitionTO getDefinition(String type) {
-        return restTemplate
+        return getRestTemplate()
                 .getForObject(baseUrl + "workflow/definition/" + type, WorkflowDefinitionTO.class);
     }
 
     @Override
     public void updateDefinition(String type, WorkflowDefinitionTO definition) {
-        restTemplate.put(baseUrl + "workflow/definition/" + type, definition);
+        getRestTemplate().put(baseUrl + "workflow/definition/" + type, definition);
     }
 
     @Override
     public List<String> getDefinedTasks(final String type) {
-        return Arrays.asList(restTemplate.getForObject(baseUrl + "workflow/tasks/" + type, String.class));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "workflow/tasks/{type}", String.class, type));
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/types/AttributableType.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/types/AttributableType.java?rev=1433313&r1=1433312&r2=1433313&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/types/AttributableType.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/types/AttributableType.java Tue Jan 15 08:50:25 2013
@@ -24,4 +24,9 @@ public enum AttributableType {
     ROLE,
     MEMBERSHIP;
 
+    @Override
+    public String toString() {
+        return name().toLowerCase();
+    };
+
 }

Added: syncope/trunk/client/src/main/java/org/apache/syncope/types/TaskType.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/types/TaskType.java?rev=1433313&view=auto
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/types/TaskType.java (added)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/types/TaskType.java Tue Jan 15 08:50:25 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.types;
+
+public enum TaskType {
+
+    PROPAGATION("propagation"),
+    NOTIFICATION("notification"),
+    SCHEDULED("sched"),
+    SYNCHRONIZATION("sync");
+
+    private String name;
+
+    private TaskType(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static TaskType fromString(String name) {
+        if (name != null) {
+          for (TaskType t : TaskType.values()) {
+            if (t.name.equalsIgnoreCase(name)) {
+              return t;
+            }
+          }
+        }
+        return null;
+      }
+}

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=1433313&r1=1433312&r2=1433313&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 Tue Jan 15 08:50:25 2013
@@ -50,6 +50,7 @@ import org.apache.syncope.services.proxy
 import org.apache.syncope.services.proxy.ResourceServiceProxy;
 import org.apache.syncope.services.proxy.RoleServiceProxy;
 import org.apache.syncope.services.proxy.SchemaServiceProxy;
+import org.apache.syncope.services.proxy.SpringRestTemplate;
 import org.apache.syncope.services.proxy.TaskServiceProxy;
 import org.apache.syncope.services.proxy.UserRequestServiceProxy;
 import org.apache.syncope.services.proxy.UserServiceProxy;
@@ -65,7 +66,7 @@ import org.springframework.web.client.Re
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:restClientContext.xml", "classpath:testJDBCContext.xml" })
-public abstract class AbstractTest {
+public abstract class AbstractTest implements SpringRestTemplate {
 
     protected static AttributeTO attributeTO(final String schema, final String value) {
         AttributeTO attr = new AttributeTO();
@@ -91,7 +92,7 @@ public abstract class AbstractTest {
     public static final String ADMIN_UID = "admin";
 
     public static final String ADMIN_PWD = "password";
-    
+
     protected PolicyServiceProxy policyService;
 
     @Autowired
@@ -145,20 +146,25 @@ public abstract class AbstractTest {
     @Before
     public void resetRestTemplate() {
         setupRestTemplate(ADMIN_UID, ADMIN_PWD);
-        userService = new UserServiceProxy(BASE_URL, restTemplate);
-        roleService = new RoleServiceProxy(BASE_URL, restTemplate);
-        resourceService = new ResourceServiceProxy(BASE_URL, restTemplate);
-        entitlementService = new EntitlementServiceProxy(BASE_URL, restTemplate);
-        configurationService = new ConfigurationServiceProxy(BASE_URL, restTemplate);
-        connectorService = new ConnectorServiceProxy(BASE_URL, restTemplate);
-        loggerService = new LoggerServiceProxy(BASE_URL, restTemplate);
-        reportService = new ReportServiceProxy(BASE_URL, restTemplate);
-        taskService = new TaskServiceProxy(BASE_URL, restTemplate);
-        policyService = new PolicyServiceProxy(BASE_URL, restTemplate);
-        workflowService = new WorkflowServiceProxy(BASE_URL, restTemplate);
-        notificationService = new NotificationServiceProxy(BASE_URL, restTemplate);
-        schemaService = new SchemaServiceProxy(BASE_URL, restTemplate);
-        userRequestService = new UserRequestServiceProxy(BASE_URL, restTemplate);
+        userService = new UserServiceProxy(BASE_URL, this);
+        roleService = new RoleServiceProxy(BASE_URL, this);
+        resourceService = new ResourceServiceProxy(BASE_URL, this);
+        entitlementService = new EntitlementServiceProxy(BASE_URL, this);
+        configurationService = new ConfigurationServiceProxy(BASE_URL, this);
+        connectorService = new ConnectorServiceProxy(BASE_URL, this);
+        loggerService = new LoggerServiceProxy(BASE_URL, this);
+        reportService = new ReportServiceProxy(BASE_URL, this);
+        taskService = new TaskServiceProxy(BASE_URL, this);
+        policyService = new PolicyServiceProxy(BASE_URL, this);
+        workflowService = new WorkflowServiceProxy(BASE_URL, this);
+        notificationService = new NotificationServiceProxy(BASE_URL, this);
+        schemaService = new SchemaServiceProxy(BASE_URL, this);
+        userRequestService = new UserRequestServiceProxy(BASE_URL, this);
+    }
+
+    @Override
+    public RestTemplate getRestTemplate() {
+        return restTemplate;
     }
-    
+
 }