You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/02/13 16:01:56 UTC

[1/7] syncope git commit: [SYNCOPE-1274] Using Swagger annotations for TO hierarchies

Repository: syncope
Updated Branches:
  refs/heads/master dd638b27f -> eb1cd3ff2


http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index 5af2c0e..25c3993 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -34,7 +34,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 
 /**
@@ -57,7 +57,7 @@ public interface PolicyService extends JAXRSService {
     @GET
     @Path("{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractPolicyTO> T read(@NotNull @PathParam("key") String key);
+    <T extends PolicyTO> T read(@NotNull @PathParam("key") String key);
 
     /**
      * Returns a list of policies of the matching type.
@@ -68,7 +68,7 @@ public interface PolicyService extends JAXRSService {
      */
     @GET
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractPolicyTO> List<T> list(@NotNull @MatrixParam("type") PolicyType type);
+    <T extends PolicyTO> List<T> list(@NotNull @MatrixParam("type") PolicyType type);
 
     /**
      * Create a new policy.
@@ -79,7 +79,7 @@ public interface PolicyService extends JAXRSService {
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response create(@NotNull AbstractPolicyTO policyTO);
+    Response create(@NotNull PolicyTO policyTO);
 
     /**
      * Updates policy matching the given key.
@@ -91,7 +91,7 @@ public interface PolicyService extends JAXRSService {
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response update(@NotNull AbstractPolicyTO policyTO);
+    Response update(@NotNull PolicyTO policyTO);
 
     /**
      * Delete policy matching the given key.

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
index a22041a..69b06dc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -34,7 +34,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.rest.api.beans.SchemaQuery;
 
@@ -58,7 +58,7 @@ public interface SchemaService extends JAXRSService {
     @GET
     @Path("{type}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractSchemaTO> List<T> list(@BeanParam SchemaQuery query);
+    <T extends SchemaTO> List<T> list(@BeanParam SchemaQuery query);
 
     /**
      * Returns schema matching the given type and key.
@@ -71,7 +71,7 @@ public interface SchemaService extends JAXRSService {
     @GET
     @Path("{type}/{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractSchemaTO> T read(
+    <T extends SchemaTO> T read(
             @NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String key);
 
     /**
@@ -85,7 +85,7 @@ public interface SchemaService extends JAXRSService {
     @Path("{type}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response create(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
+    Response create(@NotNull @PathParam("type") SchemaType type, @NotNull SchemaTO schemaTO);
 
     /**
      * Updates the schema matching the given type and key.
@@ -98,7 +98,7 @@ public interface SchemaService extends JAXRSService {
     @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response update(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
+    Response update(@NotNull @PathParam("type") SchemaType type, @NotNull SchemaTO schemaTO);
 
     /**
      * Deletes the schema matching the given type and key.

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index 0fc5091..ab2990c 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
@@ -63,7 +63,7 @@ public interface TaskService extends ExecutableService {
     @GET
     @Path("{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractTaskTO> T read(
+    <T extends TaskTO> T read(
             @NotNull @PathParam("key") String key,
             @QueryParam(JAXRSService.PARAM_DETAILS) @DefaultValue("true") boolean details);
 
@@ -76,7 +76,7 @@ public interface TaskService extends ExecutableService {
      */
     @GET
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends AbstractTaskTO> PagedResult<T> list(@BeanParam TaskQuery query);
+    <T extends TaskTO> PagedResult<T> list(@BeanParam TaskQuery query);
 
     /**
      * Creates a new task.
@@ -97,7 +97,7 @@ public interface TaskService extends ExecutableService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response update(@NotNull AbstractTaskTO taskTO);
+    Response update(@NotNull TaskTO taskTO);
 
     /**
      * Deletes the task matching the provided key.

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
index 4f5e053..c03b6bf 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -38,7 +38,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
 
 @Component
-public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
+public class PolicyLogic extends AbstractTransactionalLogic<PolicyTO> {
 
     @Autowired
     private PolicyDAO policyDAO;
@@ -47,12 +47,12 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
     private PolicyDataBinder binder;
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_CREATE + "')")
-    public <T extends AbstractPolicyTO> T create(final T policyTO) {
+    public <T extends PolicyTO> T create(final T policyTO) {
         return binder.getPolicyTO(policyDAO.save(binder.create(policyTO)));
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_UPDATE + "')")
-    public AbstractPolicyTO update(final AbstractPolicyTO policyTO) {
+    public PolicyTO update(final PolicyTO policyTO) {
         Policy policy = policyDAO.find(policyTO.getKey());
         return binder.getPolicyTO(policyDAO.save(binder.update(policy, policyTO)));
     }
@@ -75,13 +75,13 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_LIST + "')")
-    public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
+    public <T extends PolicyTO> List<T> list(final PolicyType type) {
         return policyDAO.find(getPolicyClass(type)).stream().
                 <T>map(policy -> binder.getPolicyTO(policy)).collect(Collectors.toList());
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_READ + "')")
-    public <T extends AbstractPolicyTO> T read(final String key) {
+    public <T extends PolicyTO> T read(final String key) {
         Policy policy = policyDAO.find(key);
         if (policy == null) {
             throw new NotFoundException("Policy " + key + " not found");
@@ -91,7 +91,7 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_DELETE + "')")
-    public <T extends AbstractPolicyTO> T delete(final String key) {
+    public <T extends PolicyTO> T delete(final String key) {
         Policy policy = policyDAO.find(key);
         if (policy == null) {
             throw new NotFoundException("Policy " + key + " not found");
@@ -104,7 +104,7 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
     }
 
     @Override
-    protected AbstractPolicyTO resolveReference(final Method method, final Object... args)
+    protected PolicyTO resolveReference(final Method method, final Object... args)
             throws UnresolvedReferenceException {
 
         String key = null;
@@ -113,8 +113,8 @@ public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
             for (int i = 0; key == null && i < args.length; i++) {
                 if (args[i] instanceof String) {
                     key = (String) args[i];
-                } else if (args[i] instanceof AbstractPolicyTO) {
-                    key = ((AbstractPolicyTO) args[i]).getKey();
+                } else if (args[i] instanceof PolicyTO) {
+                    key = ((PolicyTO) args[i]).getKey();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index dba439b..4303a05 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.VirSchemaTO;
@@ -50,7 +50,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
 
 @Component
-public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
+public class SchemaLogic extends AbstractTransactionalLogic<SchemaTO> {
 
     @Autowired
     private PlainSchemaDAO plainSchemaDAO;
@@ -92,7 +92,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
 
     @PreAuthorize("hasRole('" + StandardEntitlement.SCHEMA_CREATE + "')")
     @SuppressWarnings("unchecked")
-    public <T extends AbstractSchemaTO> T create(final SchemaType schemaType, final T schemaTO) {
+    public <T extends SchemaTO> T create(final SchemaType schemaType, final T schemaTO) {
         if (StringUtils.isBlank(schemaTO.getKey())) {
             SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
             sce.getElements().add("Schema key");
@@ -146,7 +146,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
 
     @PreAuthorize("isAuthenticated()")
     @SuppressWarnings({ "unchecked", "Convert2Lambda" })
-    public <T extends AbstractSchemaTO> List<T> list(
+    public <T extends SchemaTO> List<T> list(
             final SchemaType schemaType, final List<String> anyTypeClasses) {
 
         List<AnyTypeClass> classes = new ArrayList<>(anyTypeClasses == null ? 0 : anyTypeClasses.size());
@@ -204,7 +204,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
 
     @PreAuthorize("isAuthenticated()")
     @SuppressWarnings("unchecked")
-    public <T extends AbstractSchemaTO> T read(final SchemaType schemaType, final String schemaKey) {
+    public <T extends SchemaTO> T read(final SchemaType schemaType, final String schemaKey) {
         T read;
         switch (schemaType) {
             case VIRTUAL:
@@ -239,7 +239,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.SCHEMA_UPDATE + "')")
-    public <T extends AbstractSchemaTO> void update(final SchemaType schemaType, final T schemaTO) {
+    public <T extends SchemaTO> void update(final SchemaType schemaType, final T schemaTO) {
         if (!doesSchemaExist(schemaType, schemaTO.getKey())) {
             throw new NotFoundException(schemaType + "/" + schemaTO.getKey());
         }
@@ -275,7 +275,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
     }
 
     @Override
-    protected AbstractSchemaTO resolveReference(final Method method, final Object... args)
+    protected SchemaTO resolveReference(final Method method, final Object... args)
             throws UnresolvedReferenceException {
 
         String kind = null;
@@ -288,15 +288,15 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
                     } else {
                         key = (String) args[i];
                     }
-                } else if (args[i] instanceof AbstractSchemaTO) {
-                    key = ((AbstractSchemaTO) args[i]).getKey();
+                } else if (args[i] instanceof SchemaTO) {
+                    key = ((SchemaTO) args[i]).getKey();
                 }
             }
         }
 
         if (key != null) {
             try {
-                AbstractSchemaTO result = null;
+                SchemaTO result = null;
 
                 PlainSchema plainSchema = plainSchemaDAO.find(key);
                 if (plainSchema == null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 2a4b316..018c3f7 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -27,7 +27,7 @@ import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
@@ -64,7 +64,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
 
 @Component
-public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
+public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
 
     @Autowired
     private TaskDAO taskDAO;
@@ -146,7 +146,7 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_LIST + "')")
     @SuppressWarnings("unchecked")
-    public <T extends AbstractTaskTO> Pair<Integer, List<T>> list(
+    public <T extends TaskTO> Pair<Integer, List<T>> list(
             final TaskType type,
             final String resource,
             final String notification,
@@ -180,7 +180,7 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_READ + "')")
-    public <T extends AbstractTaskTO> T read(final String key, final boolean details) {
+    public <T extends TaskTO> T read(final String key, final boolean details) {
         Task task = taskDAO.find(key);
         if (task == null) {
             throw new NotFoundException("Task " + key);
@@ -261,7 +261,7 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_DELETE + "')")
-    public <T extends AbstractTaskTO> T delete(final String key) {
+    public <T extends TaskTO> T delete(final String key) {
         Task task = taskDAO.find(key);
         if (task == null) {
             throw new NotFoundException("Task " + key);
@@ -373,7 +373,7 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
     }
 
     @Override
-    protected AbstractTaskTO resolveReference(final Method method, final Object... args)
+    protected TaskTO resolveReference(final Method method, final Object... args)
             throws UnresolvedReferenceException {
 
         String key = null;
@@ -384,8 +384,8 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
             for (int i = 0; key == null && i < args.length; i++) {
                 if (args[i] instanceof String) {
                     key = (String) args[i];
-                } else if (args[i] instanceof AbstractTaskTO) {
-                    key = ((AbstractTaskTO) args[i]).getKey();
+                } else if (args[i] instanceof TaskTO) {
+                    key = ((TaskTO) args[i]).getKey();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
index 2e00784..96bde02 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtils.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.persistence.api.entity.task;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
 
 public interface TaskUtils {
@@ -27,10 +27,10 @@ public interface TaskUtils {
 
     <T extends Task> T newTask();
 
-    <T extends AbstractTaskTO> T newTaskTO();
+    <T extends TaskTO> T newTaskTO();
 
     <T extends Task> Class<T> taskClass();
 
-    <T extends AbstractTaskTO> Class<T> taskTOClass();
+    <T extends TaskTO> Class<T> taskTOClass();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
index 6da4de9..78cbfcb 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/TaskUtilsFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.persistence.api.entity.task;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
 
 public interface TaskUtilsFactory {
@@ -27,7 +27,7 @@ public interface TaskUtilsFactory {
 
     TaskUtils getInstance(Task task);
 
-    TaskUtils getInstance(Class<? extends AbstractTaskTO> taskClass);
+    TaskUtils getInstance(Class<? extends TaskTO> taskClass);
 
-    TaskUtils getInstance(AbstractTaskTO taskTO);
+    TaskUtils getInstance(TaskTO taskTO);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
index 0905533..3f9c720 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtils.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity.task;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
@@ -110,7 +110,7 @@ public final class JPATaskUtils implements TaskUtils {
     }
 
     @Override
-    public <T extends AbstractTaskTO> Class<T> taskTOClass() {
+    public <T extends TaskTO> Class<T> taskTOClass() {
         Class<T> result = null;
 
         switch (type) {
@@ -141,7 +141,7 @@ public final class JPATaskUtils implements TaskUtils {
     }
 
     @Override
-    public <T extends AbstractTaskTO> T newTaskTO() {
+    public <T extends TaskTO> T newTaskTO() {
         final Class<T> taskClass = taskTOClass();
         try {
             return taskClass == null ? null : taskClass.newInstance();

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
index a26debd..be38e3a 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPATaskUtilsFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.persistence.jpa.entity.task;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
@@ -64,7 +64,7 @@ public class JPATaskUtilsFactory implements TaskUtilsFactory {
     }
 
     @Override
-    public TaskUtils getInstance(final Class<? extends AbstractTaskTO> taskClass) {
+    public TaskUtils getInstance(final Class<? extends TaskTO> taskClass) {
         TaskType type;
         if (taskClass == PropagationTaskTO.class) {
             type = TaskType.PROPAGATION;
@@ -84,7 +84,7 @@ public class JPATaskUtilsFactory implements TaskUtilsFactory {
     }
 
     @Override
-    public TaskUtils getInstance(final AbstractTaskTO taskTO) {
+    public TaskUtils getInstance(final TaskTO taskTO) {
         return getInstance(taskTO.getClass());
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
index cea03df..3ff922d 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
@@ -18,15 +18,15 @@
  */
 package org.apache.syncope.core.provisioning.api.data;
 
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PolicyDataBinder {
 
-    <T extends Policy> T create(AbstractPolicyTO policyTO);
+    <T extends Policy> T create(PolicyTO policyTO);
 
-    <T extends Policy> T update(T policy, AbstractPolicyTO policyTO);
+    <T extends Policy> T update(T policy, PolicyTO policyTO);
 
-    <T extends AbstractPolicyTO> T getPolicyTO(Policy policy);
+    <T extends PolicyTO> T getPolicyTO(Policy policy);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
index f5869d6..9746031 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/TaskDataBinder.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.api.data;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
@@ -36,6 +36,6 @@ public interface TaskDataBinder {
 
     ExecTO getExecTO(TaskExec execution);
 
-    <T extends AbstractTaskTO> T getTaskTO(Task task, TaskUtils taskUtil, boolean details);
+    <T extends TaskTO> T getTaskTO(Task task, TaskUtils taskUtil, boolean details);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
index e39f329..4666c11 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.provisioning.java.data;
 
 import java.util.stream.Collectors;
 import org.apache.syncope.core.provisioning.api.data.PolicyDataBinder;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.policy.AccountPolicyTO;
 import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
@@ -66,7 +66,7 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
     private EntityFactory entityFactory;
 
     @SuppressWarnings("unchecked")
-    private <T extends Policy> T getPolicy(final T policy, final AbstractPolicyTO policyTO) {
+    private <T extends Policy> T getPolicy(final T policy, final PolicyTO policyTO) {
         T result = policy;
 
         if (policyTO instanceof PasswordPolicyTO) {
@@ -170,18 +170,18 @@ public class PolicyDataBinderImpl implements PolicyDataBinder {
     }
 
     @Override
-    public <T extends Policy> T create(final AbstractPolicyTO policyTO) {
+    public <T extends Policy> T create(final PolicyTO policyTO) {
         return getPolicy(null, policyTO);
     }
 
     @Override
-    public <T extends Policy> T update(final T policy, final AbstractPolicyTO policyTO) {
+    public <T extends Policy> T update(final T policy, final PolicyTO policyTO) {
         return getPolicy(policy, policyTO);
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public <T extends AbstractPolicyTO> T getPolicyTO(final Policy policy) {
+    public <T extends PolicyTO> T getPolicyTO(final Policy policy) {
         T policyTO = null;
 
         if (policy instanceof PasswordPolicy) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
index 5009e5b..665c7ca 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
@@ -22,8 +22,8 @@ import java.util.stream.Collectors;
 import org.apache.syncope.core.provisioning.api.data.TaskDataBinder;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractProvisioningTaskTO;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
@@ -113,7 +113,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
     @Autowired
     private TaskUtilsFactory taskUtilsFactory;
 
-    private void fill(final ProvisioningTask task, final AbstractProvisioningTaskTO taskTO) {
+    private void fill(final ProvisioningTask task, final ProvisioningTaskTO taskTO) {
         if (task instanceof PushTask && taskTO instanceof PushTaskTO) {
             PushTask pushTask = (PushTask) task;
             PushTaskTO pushTaskTO = (PushTaskTO) taskTO;
@@ -247,7 +247,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
 
     @Override
     public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtils taskUtils) {
-        Class<? extends AbstractTaskTO> taskTOClass = taskUtils.taskTOClass();
+        Class<? extends TaskTO> taskTOClass = taskUtils.taskTOClass();
         if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) {
             throw new IllegalArgumentException(String.format("Expected %s, found %s", taskTOClass, taskTO.getClass()));
         }
@@ -265,8 +265,8 @@ public class TaskDataBinderImpl implements TaskDataBinder {
                 throw new NotFoundException("Implementation " + taskTO.getJobDelegate());
             }
             task.setJobDelegate(implementation);
-        } else if (taskTO instanceof AbstractProvisioningTaskTO) {
-            AbstractProvisioningTaskTO provisioningTaskTO = (AbstractProvisioningTaskTO) taskTO;
+        } else if (taskTO instanceof ProvisioningTaskTO) {
+            ProvisioningTaskTO provisioningTaskTO = (ProvisioningTaskTO) taskTO;
 
             ExternalResource resource = resourceDAO.find(provisioningTaskTO.getResource());
             if (resource == null) {
@@ -282,7 +282,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
 
     @Override
     public void updateSchedTask(final SchedTask task, final SchedTaskTO taskTO, final TaskUtils taskUtils) {
-        Class<? extends AbstractTaskTO> taskTOClass = taskUtils.taskTOClass();
+        Class<? extends TaskTO> taskTOClass = taskUtils.taskTOClass();
         if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) {
             throw new IllegalArgumentException(String.format("Expected %s, found %s", taskTOClass, taskTO.getClass()));
         }
@@ -298,7 +298,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
         task.setActive(taskTO.isActive());
 
         if (task instanceof ProvisioningTask) {
-            fill((ProvisioningTask) task, (AbstractProvisioningTaskTO) taskTO);
+            fill((ProvisioningTask) task, (ProvisioningTaskTO) taskTO);
         }
     }
 
@@ -349,7 +349,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
     }
 
     @Override
-    public <T extends AbstractTaskTO> T getTaskTO(final Task task, final TaskUtils taskUtils, final boolean details) {
+    public <T extends TaskTO> T getTaskTO(final Task task, final TaskUtils taskUtils, final boolean details) {
         T taskTO = taskUtils.newTaskTO();
         BeanUtils.copyProperties(task, taskTO, IGNORE_TASK_PROPERTIES);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
index 64f765d..2925fc7 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.rest.cxf.service;
 import java.net.URI;
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.service.PolicyService;
@@ -36,8 +36,8 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
     private PolicyLogic logic;
 
     @Override
-    public Response create(final AbstractPolicyTO policyTO) {
-        AbstractPolicyTO policy = logic.create(policyTO);
+    public Response create(final PolicyTO policyTO) {
+        PolicyTO policy = logic.create(policyTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(policy.getKey()).build();
         return Response.created(location).
                 header(RESTHeaders.RESOURCE_KEY, policy.getKey()).
@@ -51,17 +51,17 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
     }
 
     @Override
-    public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
+    public <T extends PolicyTO> List<T> list(final PolicyType type) {
         return logic.list(type);
     }
 
     @Override
-    public <T extends AbstractPolicyTO> T read(final String key) {
+    public <T extends PolicyTO> T read(final String key) {
         return logic.read(key);
     }
 
     @Override
-    public Response update(final AbstractPolicyTO policyTO) {
+    public Response update(final PolicyTO policyTO) {
         logic.update(policyTO);
         return Response.noContent().build();
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
index b6c7397..f650839 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.rest.cxf.service;
 import java.net.URI;
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.beans.SchemaQuery;
@@ -37,8 +37,8 @@ public class SchemaServiceImpl extends AbstractServiceImpl implements SchemaServ
     private SchemaLogic logic;
 
     @Override
-    public Response create(final SchemaType schemaType, final AbstractSchemaTO schemaTO) {
-        AbstractSchemaTO created = logic.create(schemaType, schemaTO);
+    public Response create(final SchemaType schemaType, final SchemaTO schemaTO) {
+        SchemaTO created = logic.create(schemaType, schemaTO);
 
         URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
         return Response.created(location).
@@ -53,17 +53,17 @@ public class SchemaServiceImpl extends AbstractServiceImpl implements SchemaServ
     }
 
     @Override
-    public <T extends AbstractSchemaTO> List<T> list(final SchemaQuery query) {
+    public <T extends SchemaTO> List<T> list(final SchemaQuery query) {
         return logic.list(query.getType(), query.getAnyTypeClasses());
     }
 
     @Override
-    public <T extends AbstractSchemaTO> T read(final SchemaType schemaType, final String key) {
+    public <T extends SchemaTO> T read(final SchemaType schemaType, final String key) {
         return logic.read(schemaType, key);
     }
 
     @Override
-    public Response update(final SchemaType schemaType, final AbstractSchemaTO schemaTO) {
+    public Response update(final SchemaType schemaType, final SchemaTO schemaTO) {
         logic.update(schemaType, schemaTO);
         return Response.noContent().build();
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
index 47a860c..37067a3 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
@@ -23,7 +23,7 @@ import java.util.List;
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
@@ -70,7 +70,7 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
 
     @SuppressWarnings("unchecked")
     @Override
-    public <T extends AbstractTaskTO> PagedResult<T> list(final TaskQuery query) {
+    public <T extends TaskTO> PagedResult<T> list(final TaskQuery query) {
         Pair<Integer, List<T>> result = logic.list(
                 query.getType(),
                 query.getResource(),
@@ -85,12 +85,12 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
     }
 
     @Override
-    public <T extends AbstractTaskTO> T read(final String key, final boolean details) {
+    public <T extends TaskTO> T read(final String key, final boolean details) {
         return logic.read(key, details);
     }
 
     @Override
-    public Response update(final AbstractTaskTO taskTO) {
+    public Response update(final TaskTO taskTO) {
         if (taskTO instanceof SchedTaskTO) {
             logic.updateSchedTask((SchedTaskTO) taskTO);
             return Response.noContent().build();

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/core/rest-cxf/src/main/resources/restCXFContext.xml
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/resources/restCXFContext.xml b/core/rest-cxf/src/main/resources/restCXFContext.xml
index 3d4ac8b..b08c142 100644
--- a/core/rest-cxf/src/main/resources/restCXFContext.xml
+++ b/core/rest-cxf/src/main/resources/restCXFContext.xml
@@ -50,7 +50,7 @@ under the License.
       <map>
         <entry>
           <key>
-            <value>org.apache.syncope.common.lib.policy.AbstractPolicyTO</value>
+            <value>org.apache.syncope.common.lib.policy.PolicyTO</value>
           </key>
           <value>policies</value>
         </entry>

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/fit/core-reference/src/main/resources/jboss/restCXFContext.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/jboss/restCXFContext.xml b/fit/core-reference/src/main/resources/jboss/restCXFContext.xml
index b3af331..1ec5aff 100644
--- a/fit/core-reference/src/main/resources/jboss/restCXFContext.xml
+++ b/fit/core-reference/src/main/resources/jboss/restCXFContext.xml
@@ -50,7 +50,7 @@ under the License.
       <map>
         <entry>
           <key>
-            <value>org.apache.syncope.common.lib.policy.AbstractPolicyTO</value>
+            <value>org.apache.syncope.common.lib.policy.PolicyTO</value>
           </key>
           <value>policies</value>
         </entry>

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index 0aea1db..32f350a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -47,8 +47,8 @@ import org.apache.syncope.common.lib.patch.AnyObjectPatch;
 import org.apache.syncope.common.lib.patch.AttrPatch;
 import org.apache.syncope.common.lib.patch.GroupPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -335,7 +335,7 @@ public abstract class AbstractITCase {
     }
 
     @SuppressWarnings("unchecked")
-    protected <T extends AbstractSchemaTO> T createSchema(final SchemaType type, final T schemaTO) {
+    protected <T extends SchemaTO> T createSchema(final SchemaType type, final T schemaTO) {
         Response response = schemaService.create(type, schemaTO);
         if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
             Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
@@ -487,7 +487,7 @@ public abstract class AbstractITCase {
     }
 
     @SuppressWarnings("unchecked")
-    protected <T extends AbstractPolicyTO> T createPolicy(final T policy) {
+    protected <T extends PolicyTO> T createPolicy(final T policy) {
         Response response = policyService.create(policy);
         if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
             Exception ex = clientFactory.getExceptionMapper().fromResponse(response);

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
index 49cc8f4..d59422a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.patch.DeassociationPatch;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
@@ -126,7 +126,7 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
     protected static ExecTO execTask(final TaskService taskService, final String taskKey, final String initialStatus,
             final int maxWaitSeconds, final boolean dryRun) {
 
-        AbstractTaskTO taskTO = taskService.read(taskKey, true);
+        TaskTO taskTO = taskService.read(taskKey, true);
         assertNotNull(taskTO);
         assertNotNull(taskTO.getExecutions());
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
index a130bd5..7ab6b22 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
@@ -27,7 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.apache.commons.lang3.SerializationUtils;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.ConnObjectTO;
@@ -54,7 +54,7 @@ public class PropagationTaskITCase extends AbstractTaskITCase {
         assertNotNull(tasks);
         assertEquals(2, tasks.getResult().size());
 
-        for (AbstractTaskTO task : tasks.getResult()) {
+        for (TaskTO task : tasks.getResult()) {
             assertNotNull(task);
         }
 
@@ -64,7 +64,7 @@ public class PropagationTaskITCase extends AbstractTaskITCase {
         assertEquals(2, tasks.getPage());
         assertEquals(2, tasks.getResult().size());
 
-        for (AbstractTaskTO task : tasks.getResult()) {
+        for (TaskTO task : tasks.getResult()) {
             assertNotNull(task);
         }
 
@@ -158,15 +158,15 @@ public class PropagationTaskITCase extends AbstractTaskITCase {
         }
 
         // check list
-        PagedResult<AbstractTaskTO> tasks = taskService.list(
+        PagedResult<TaskTO> tasks = taskService.list(
                 new TaskQuery.Builder(TaskType.PROPAGATION).page(1).size(2).details(false).build());
-        for (AbstractTaskTO item : tasks.getResult()) {
+        for (TaskTO item : tasks.getResult()) {
             assertTrue(item.getExecutions().isEmpty());
         }
 
         tasks = taskService.list(
                 new TaskQuery.Builder(TaskType.PROPAGATION).page(1).size(2).details(true).build());
-        for (AbstractTaskTO item : tasks.getResult()) {
+        for (TaskTO item : tasks.getResult()) {
             assertFalse(item.getExecutions().isEmpty());
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index 59fe873..3e6a4f0 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -50,7 +50,7 @@ import org.apache.syncope.common.lib.patch.DeassociationPatch;
 import org.apache.syncope.common.lib.patch.PasswordPatch;
 import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -1113,7 +1113,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     getLdapRemoteObject(RESOURCE_LDAP_ADMIN_DN, RESOURCE_LDAP_ADMIN_PWD, userDn.getValues().get(0)));
 
             // ...and propagated
-            PagedResult<AbstractTaskTO> propagationTasks = taskService.list(new TaskQuery.Builder(TaskType.PROPAGATION).
+            PagedResult<TaskTO> propagationTasks = taskService.list(new TaskQuery.Builder(TaskType.PROPAGATION).
                     resource(RESOURCE_NAME_DBPULL).
                     anyTypeKind(AnyTypeKind.USER).entityKey(user.getKey()).build());
             assertEquals(1, propagationTasks.getSize());


[7/7] syncope git commit: [SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(

Posted by il...@apache.org.
[SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(


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

Branch: refs/heads/master
Commit: eb1cd3ff22d099c3c4978f56d104433f5bc23f31
Parents: b0b0e32
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 13 17:01:43 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 13 17:01:43 2018 +0100

----------------------------------------------------------------------
 .../client/cli/commands/policy/PolicyRead.java  | 40 ++++----
 .../policy/PolicySyncopeOperations.java         |  6 +-
 .../client/cli/commands/task/TaskRead.java      | 41 +++++----
 .../commands/task/TaskSyncopeOperations.java    |  6 +-
 .../cli/src/main/resources/messages.properties  |  4 +-
 .../policies/AccountPolicyDirectoryPanel.java   |  3 +-
 .../policies/PasswordPolicyDirectoryPanel.java  |  2 +-
 .../console/policies/PolicyDirectoryPanel.java  | 12 +--
 .../policies/PolicyModalPanelBuilder.java       | 12 ++-
 .../policies/PolicyRuleDirectoryPanel.java      | 11 ++-
 .../policies/PolicyRuleWizardBuilder.java       |  4 +-
 .../policies/PullPolicyDirectoryPanel.java      |  2 +-
 .../console/policies/PullPolicyModalPanel.java  |  3 +-
 .../client/console/rest/PolicyRestClient.java   | 16 ++--
 .../client/console/rest/TaskRestClient.java     | 20 ++--
 .../tasks/NotificationTaskDirectoryPanel.java   |  2 +-
 .../tasks/PropagationTaskDirectoryPanel.java    |  2 +-
 .../tasks/ProvisioningTaskDirectoryPanel.java   |  4 +-
 .../console/tasks/PullTaskDirectoryPanel.java   |  3 +-
 .../console/tasks/PushTaskDirectoryPanel.java   |  2 +-
 .../console/tasks/SchedTaskDirectoryPanel.java  | 15 ++-
 .../console/tasks/SchedTaskWizardBuilder.java   | 10 +-
 .../client/console/tasks/SchedTasks.java        |  3 +-
 .../client/console/widgets/JobWidget.java       | 23 +++--
 .../syncope/common/rest/api/beans/AnyQuery.java |  3 +-
 .../common/rest/api/beans/TaskQuery.java        |  4 +-
 .../common/rest/api/service/PolicyService.java  | 23 +++--
 .../common/rest/api/service/TaskService.java    | 20 ++--
 .../apache/syncope/core/logic/PolicyLogic.java  | 73 +++++++++------
 .../apache/syncope/core/logic/TaskLogic.java    | 32 ++++++-
 .../api/dao/ExternalResourceDAO.java            |  2 +-
 .../core/persistence/api/dao/PolicyDAO.java     |  4 +-
 .../core/persistence/api/dao/RealmDAO.java      |  2 +-
 .../core/persistence/api/entity/Policy.java     | 26 ------
 .../api/entity/policy/AccountPolicy.java        |  1 -
 .../api/entity/policy/PasswordPolicy.java       |  1 -
 .../persistence/api/entity/policy/Policy.java   | 28 ++++++
 .../api/entity/policy/PolicyUtils.java          | 28 ++++++
 .../api/entity/policy/PolicyUtilsFactory.java   | 33 +++++++
 .../api/entity/policy/PullPolicy.java           |  1 -
 .../api/entity/policy/PushPolicy.java           |  1 -
 .../jpa/dao/JPAExternalResourceDAO.java         |  2 +-
 .../core/persistence/jpa/dao/JPAPolicyDAO.java  |  2 +-
 .../core/persistence/jpa/dao/JPARealmDAO.java   |  2 +-
 .../jpa/entity/policy/AbstractPolicy.java       |  2 +-
 .../jpa/entity/policy/JPAPolicyUtils.java       | 60 ++++++++++++
 .../entity/policy/JPAPolicyUtilsFactory.java    | 82 +++++++++++++++++
 .../entity/EntityValidationListener.java        |  2 +-
 .../core/persistence/jpa/inner/PolicyTest.java  |  2 +-
 .../provisioning/api/data/PolicyDataBinder.java |  2 +-
 .../java/data/PolicyDataBinderImpl.java         |  4 +-
 .../java/data/RealmDataBinderImpl.java          |  2 +-
 .../rest/cxf/service/PolicyServiceImpl.java     | 16 ++--
 .../core/rest/cxf/service/TaskServiceImpl.java  | 25 +++--
 ext/swagger-ui/pom.xml                          | 24 +----
 .../core/reference/ITImplementationLookup.java  |  3 +-
 .../org/apache/syncope/fit/AbstractITCase.java  |  5 +-
 .../org/apache/syncope/fit/cli/CLIITCase.java   | 21 -----
 .../syncope/fit/core/AbstractTaskITCase.java    | 31 ++++---
 .../apache/syncope/fit/core/GroupITCase.java    |  3 +-
 .../fit/core/IdentityRecertificationITCase.java |  3 +-
 .../syncope/fit/core/ImplementationITCase.java  |  9 +-
 .../syncope/fit/core/MembershipITCase.java      | 10 +-
 .../syncope/fit/core/MultitenancyITCase.java    |  7 +-
 .../fit/core/NotificationTaskITCase.java        | 18 ++--
 .../apache/syncope/fit/core/PolicyITCase.java   | 26 +++---
 .../syncope/fit/core/PropagationTaskITCase.java |  6 +-
 .../apache/syncope/fit/core/PullTaskITCase.java | 96 ++++++++++----------
 .../apache/syncope/fit/core/PushTaskITCase.java | 32 +++----
 .../apache/syncope/fit/core/RealmITCase.java    |  5 +-
 .../syncope/fit/core/SchedTaskITCase.java       | 18 ++--
 .../apache/syncope/fit/core/SwaggerITCase.java  | 64 -------------
 .../org/apache/syncope/fit/core/UserITCase.java | 15 +--
 .../syncope/fit/core/UserIssuesITCase.java      |  5 +-
 74 files changed, 670 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
index 5b50a69..26ee655 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
@@ -19,11 +19,14 @@
 package org.apache.syncope.client.cli.commands.policy;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.policy.PolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,7 +34,8 @@ public class PolicyRead extends AbstractPolicyCommand {
 
     private static final Logger LOG = LoggerFactory.getLogger(PolicyRead.class);
 
-    private static final String READ_HELP_MESSAGE = "policy --read {POLICY-KEY} {POLICY-KEY} [...]";
+    private static final String READ_HELP_MESSAGE = "policy --read {POLICY-TYPE} {POLICY-KEY}\n"
+            + "   Policy type:  ACCOUNT / PASSWORD / PULL / PUSH";
 
     private final Input input;
 
@@ -40,24 +44,26 @@ public class PolicyRead extends AbstractPolicyCommand {
     }
 
     public void read() {
-        if (input.parameterNumber() >= 1) {
-            final List<PolicyTO> policyTOs = new ArrayList<>();
-            for (final String parameter : input.getParameters()) {
-                try {
-                    policyTOs.add(policySyncopeOperations.read(parameter));
-                } catch (final NumberFormatException ex) {
-                    LOG.error("Error reading policy", ex);
-                    policyResultManager.notBooleanDeletedError("policy", parameter);
-                } catch (final WebServiceException | SyncopeClientException ex) {
-                    LOG.error("Error reading policy", ex);
-                    if (ex.getMessage().startsWith("NotFound")) {
-                        policyResultManager.notFoundError("Policy", parameter);
-                    } else {
-                        policyResultManager.genericError(ex.getMessage());
-                    }
+        if (input.parameterNumber() >= 2) {
+            final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
+            try {
+                final List<PolicyTO> policyTOs = new ArrayList<>();
+                for (final String parameter : parameters) {
+                    policyTOs.add(policySyncopeOperations.read(input.firstParameter(), parameter));
                 }
+                policyResultManager.printPolicies(policyTOs);
+            } catch (final SyncopeClientException | WebServiceException ex) {
+                LOG.error("Error reading policy", ex);
+                if (ex.getMessage().startsWith("NotFound")) {
+                    policyResultManager.notFoundError("Policy", parameters[0]);
+                } else {
+                    policyResultManager.genericError(ex.getMessage());
+                }
+            } catch (final IllegalArgumentException ex) {
+                LOG.error("Error reading policy", ex);
+                policyResultManager.typeNotValidError(
+                        "policy", input.firstParameter(), CommandUtils.fromEnumToArray(PolicyType.class));
             }
-            policyResultManager.printPolicies(policyTOs);
         } else {
             policyResultManager.commandOptionError(READ_HELP_MESSAGE);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
index 9bfad75..f738ad9 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
@@ -28,8 +28,8 @@ public class PolicySyncopeOperations {
 
     private final PolicyService policyService = SyncopeServices.get(PolicyService.class);
 
-    public <T extends PolicyTO> T read(final String policyKey) {
-        return policyService.read(policyKey);
+    public <T extends PolicyTO> T read(final String type, final String policyKey) {
+        return policyService.read(PolicyType.valueOf(type), policyKey);
     }
 
     public <T extends PolicyTO> List<T> list(final String policyType) {
@@ -37,6 +37,6 @@ public class PolicySyncopeOperations {
     }
 
     public void delete(final String policyKey) {
-        policyService.delete(policyKey);
+        policyService.delete(null, policyKey);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
index 0c05681..be5221a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
@@ -19,11 +19,14 @@
 package org.apache.syncope.client.cli.commands.task;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.TaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,7 +34,8 @@ public class TaskRead extends AbstractTaskCommand {
 
     private static final Logger LOG = LoggerFactory.getLogger(TaskRead.class);
 
-    private static final String READ_HELP_MESSAGE = "task --read {TASK-KEY} {TASK-KEY} [...]";
+    private static final String READ_HELP_MESSAGE = "task --read {TASK-TYPE} {TASK-KEY}\n"
+            + "   Task type:  PROPAGATION / NOTIFICATION / SCHEDULED / PULL / PUSH";
 
     private final Input input;
 
@@ -40,25 +44,26 @@ public class TaskRead extends AbstractTaskCommand {
     }
 
     public void read() {
-        if (input.parameterNumber() >= 1) {
-            final List<TaskTO> taskTOs = new ArrayList<>();
-            for (final String parameter : input.getParameters()) {
-                try {
-                    taskTOs.add(taskSyncopeOperations.read(parameter));
-                } catch (final NumberFormatException ex) {
-                    LOG.error("Error reading task", ex);
-                    taskResultManager.notBooleanDeletedError("task", parameter);
-                } catch (final SyncopeClientException | WebServiceException ex) {
-                    LOG.error("Error reading task", ex);
-                    if (ex.getMessage().startsWith("NotFound")) {
-                        taskResultManager.notFoundError("Task", parameter);
-                    } else {
-                        taskResultManager.genericError(ex.getMessage());
-                    }
-                    break;
+        if (input.parameterNumber() >= 2) {
+            final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
+            try {
+                final List<TaskTO> taskTOs = new ArrayList<>();
+                for (final String parameter : parameters) {
+                    taskTOs.add(taskSyncopeOperations.read(input.firstParameter(), parameter));
                 }
+                taskResultManager.printTasks(taskTOs);
+            } catch (final SyncopeClientException | WebServiceException ex) {
+                LOG.error("Error reading task", ex);
+                if (ex.getMessage().startsWith("NotFound")) {
+                    taskResultManager.notFoundError("Task", parameters[0]);
+                } else {
+                    taskResultManager.genericError(ex.getMessage());
+                }
+            } catch (final IllegalArgumentException ex) {
+                LOG.error("Error reading task", ex);
+                taskResultManager.typeNotValidError(
+                        "task", input.firstParameter(), CommandUtils.fromEnumToArray(TaskType.class));
             }
-            taskResultManager.printTasks(taskTOs);
         } else {
             taskResultManager.commandOptionError(READ_HELP_MESSAGE);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
index ad94a4f..48fd7c6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
@@ -36,12 +36,12 @@ public class TaskSyncopeOperations {
         return taskService.listJobs();
     }
 
-    public <T extends TaskTO> T read(final String taskKey) {
-        return taskService.read(taskKey, true);
+    public <T extends TaskTO> T read(final String type, final String taskKey) {
+        return taskService.read(TaskType.valueOf(type), taskKey, true);
     }
 
     public void delete(final String taskKey) {
-        taskService.delete(taskKey);
+        taskService.delete(null, taskKey);
     }
 
     public List<TaskTO> list(final String type) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/cli/src/main/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/cli/src/main/resources/messages.properties b/client/cli/src/main/resources/messages.properties
index 0e47a36..48cdc15 100644
--- a/client/cli/src/main/resources/messages.properties
+++ b/client/cli/src/main/resources/messages.properties
@@ -22,14 +22,14 @@ entitlement.help.message=\nUsage: entitlement [options]\n  Options:\n    --help
 group.help.message=\nUsage: group [options]\n  Options:\n    --help \n    --details \n    --list \n    --read \n       Syntax: --read {GROUP-KEY} {GROUP-KEY} [...]\n    --read-attr-by-schema-type {GROUP-KEY} {SCHEMA-TYPE}\n       Schema type: PLAIN / DERIVED / VIRTUAL\n    --read-attr-by-schema {GROUP-KEY} {SCHEMA-TYPE} {SCHEMA-KEY}\n       Schema type: PLAIN / DERIVED / VIRTUAL\n    --delete \n       Syntax: --delete {GROUP-KEY} {GROUP-KEY} [...]\n
 logger.help.message=\nUsage: logger [options]\n  Options:\n    --help \n    --details \n    --list \n    --read \n       Syntax: --read {LOG-NAME} {LOG-NAME} [...]\n    --update \n       Syntax: --update {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]\n    --update-all \n       Syntax: --update-all {LOG-LEVEL} \n    --create \n       Syntax: --create {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]\n    --delete \n       Syntax: --delete {LOG-NAME} {LOG-NAME} [...]\n
 notification.help.message=\nUsage: notification [options]\n  Options:\n    --help \n    --list \n    --read \n       Syntax: --read {NOTIFICATION-KEY} \n    --delete \n       Syntax: --delete {NOTIFICATION-KEY}\n
-policy.help.message=\nUsage: policy [options]\n  Options:\n    --help \n    --details \n    --list \n       Syntax: --list-policy {POLICY-TYPE} \n          Policy type: ACCOUNT / PASSWORD / PULL / PUSH\n    --read \n       Syntax: --read {POLICY-KEY} {POLICY-KEY} [...]\n    --delete \n       Syntax: --delete {POLICY-KEY} {POLICY-KEY} [...]\n
+policy.help.message=\nUsage: policy [options]\n  Options:\n    --help \n    --details \n    --list \n       Syntax: --list-policy {POLICY-TYPE} \n          Policy type: ACCOUNT / PASSWORD / PULL / PUSH\n    --read \n       Syntax: --read {POLICY-TYPE} {POLICY-KEY}\n   Policy type:  ACCOUNT / PASSWORD / PULL / PUSH\n    --delete \n       Syntax: --delete {POLICY-KEY} {POLICY-KEY} [...]\n
 question.help.message=\nUsage: question [options]\n  Options:\n    --help \n    --list \n    --read \n       Syntax: --read {QUESTION-KEY} {QUESTION-KEY} [...]\n    --delete \n       Syntax: --delete {QUESTION-KEY} {QUESTION-KEY} [...]\n
 realm.help.message=\nUsage: realm [options]\n  Options:\n    --help \n    --details \n    --list \n
 report.help.message=\nUsage: report [options]\n  Options:\n    --help \n    --details\n    --list \n    --list-jobs \n    --read \n       Syntax: --read {REPORT-KEY} {REPORT-KEY} [...] \n    --delete \n       Syntax: --delete {REPORT-KEY} {REPORT-KEY} [...]\n    --execute \n       Syntax: --execute {REPORT-KEY} \n    --delete-execution \n       Syntax: --delete-execution {EXECUTION-KEY} {EXECUTION-KEY} [...]\n    --export-execution-result \n       Syntax: --export-execution-result {EXECUTION-KEY} {EXECUTION-KEY} [...] {FORMAT}\n          Format: CSV / HTML / PDF / XML / RTF\n
 resource.help.message=\nUsage: resource [options]\n  Options:\n    --help \n    --details \n    --list \n    --read \n       Syntax: --read {RESOURCE-KEY} {RESOURCE-KEY} [...]\n    --delete \n       Syntax: --delete {RESOURCE-KEY} {RESOURCE-KEY} [...]\n
 role.help.message=\nUsage: role [options]\n  Options:\n    --help \n    --details \n    --list \n    --read \n       Syntax: --read {ROLE-KEY} {ROLE-KEY} [...]\n    --delete \n       Syntax: --delete {ROLE-KEY} {ROLE-KEY} [...]\n
 schema.help.message=\nUsage: schema [options]\n  Options:\n    --help \n    --details \n    --list-all\n    --list-plain\n    --list-derived\n    --list-virtual\n    --read {SCHEMA-TYPE} {SCHEMA-KEY}\n        Schema type: PLAIN / DERIVED / VIRTUAL\n    --delete {SCHEMA-TYPE} {SCHEMA-KEY}\n        Schema type: PLAIN / DERIVED / VIRTUAL\n
-task.help.message=\nUsage: task [options]\n  Options:\n    --help \n    --details\n    --list\n       Syntax: --list {TASK-TYPE} \n          Task type: NOTIFICATION / PROPAGATION / PUSH / SCHEDULED / PULL\n    --list-running-jobs \n    --list-scheduled-jobs \n    --read \n       Syntax: --read {TASK-KEY} {TASK-KEY} [...]\n    --delete \n       Syntax: --delete {TASK-KEY} {TASK-KEY} [...]\n    --delete-all-prop\n    --delete-execution \n       Syntax: --delete-execution {TASK-EXEC-KEY} {TASK-EXEC-KEY} [...]\n    --execute \n       Syntax: --execute {TASK-KEY} {DRY-RUN}\n          Dry run: true / false\n
+task.help.message=\nUsage: task [options]\n  Options:\n    --help \n    --details\n    --list\n       Syntax: --list {TASK-TYPE} \n          Task type: NOTIFICATION / PROPAGATION / PUSH / SCHEDULED / PULL\n    --list-running-jobs \n    --list-scheduled-jobs \n    --read \n       Syntax: --read {TASK-TYPE} {TASK-KEY}\n   Task type:  PROPAGATION / NOTIFICATION / SCHEDULED / PULL / PUSH\n    --delete \n       Syntax: --delete {TASK-KEY} {TASK-KEY} [...]\n    --delete-all-prop\n    --delete-execution \n       Syntax: --delete-execution {TASK-EXEC-KEY} {TASK-EXEC-KEY} [...]\n    --execute \n       Syntax: --execute {TASK-KEY} {DRY-RUN}\n          Dry run: true / false\n
 user.help.message=\nUsage: user [options]\n  Options:\n    --help \n    --details \n    --list \n    --get-user-key\n       Syntax: --get-user-key {USERNAME}\n    --get-username\n       Syntax: --get-username {USER-KEY}\n    --read-by-userkey \n       Syntax: --read-by-userkey {USER-KEY} {USER-KEY} [...]\n    --read-by-username\n       Syntax: --read-by-username {USERNAME} {USERNAME} [...]\n    --search-by-attribute \n       Syntax: --search-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}\n    --search-by-role \n       Syntax: --search-by-role {REALM} {ROLE-KEY}\n    --search-by-resource \n       Syntax: --search-by-resource {REALM} {RESOURCE-KEY}\n    --delete \n       Syntax: --delete {USER-KEY} {USER-KEY} [...]\n    --delete-all \n       Syntax: --delete-all {REALM}\n    --delete-by-attribute \n       Syntax: --delete-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}\n
 workflow.help.message=\nUsage: workflow [options]\n  Options:\n    --help \n    --export-diagram {ANY-TYPE-KIND}\n        Any type kind: ANY_OBJECT / USER / GROUP\n    --export-definition {ANY-TYPE-KIND}\n        Any type kind: ANY_OBJECT / USER / GROUP\n
 migrate.help.message=\nUsage: migrate [options]\n  Options:\n    --help \n    --conf {SRC} {DST}\n        Syncope 1.2.X content.xml SRC absolute path\n        Syncope 2.0.X *Content.xml DST absolute path\n

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java
index dd89ea1..a51acaa 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java
@@ -45,7 +45,8 @@ public class AccountPolicyDirectoryPanel extends PolicyDirectoryPanel<AccountPol
     public AccountPolicyDirectoryPanel(final String id, final PageReference pageRef) {
         super(id, PolicyType.ACCOUNT, pageRef);
 
-        this.addNewItemPanelBuilder(new PolicyModalPanelBuilder<>(new AccountPolicyTO(), modal, pageRef), true);
+        this.addNewItemPanelBuilder(new PolicyModalPanelBuilder<>(
+                PolicyType.ACCOUNT, new AccountPolicyTO(), modal, pageRef), true);
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.POLICY_CREATE);
 
         initResultTable();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PasswordPolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PasswordPolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PasswordPolicyDirectoryPanel.java
index 32fce97..3aa8be4 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PasswordPolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PasswordPolicyDirectoryPanel.java
@@ -45,7 +45,7 @@ public class PasswordPolicyDirectoryPanel extends PolicyDirectoryPanel<PasswordP
         super(id, PolicyType.PASSWORD, pageRef);
 
         this.addNewItemPanelBuilder(
-                new PolicyModalPanelBuilder<>(new PasswordPolicyTO(), modal, pageRef), true);
+                new PolicyModalPanelBuilder<>(PolicyType.PASSWORD, new PasswordPolicyTO(), modal, pageRef), true);
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.POLICY_CREATE);
 
         initResultTable();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
index d4b41f6..ab029ef 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
@@ -79,11 +79,11 @@ public abstract class PolicyDirectoryPanel<T extends PolicyTO>
 
     protected final BaseModal<T> policySpecModal = new BaseModal<>("outer");
 
-    private final PolicyType policyType;
+    private final PolicyType type;
 
     public PolicyDirectoryPanel(final String id, final PolicyType policyType, final PageReference pageRef) {
         super(id, pageRef, true);
-        this.policyType = policyType;
+        this.type = policyType;
         this.restClient = new PolicyRestClient();
 
         ruleCompositionModal.size(Modal.Size.Large);
@@ -143,7 +143,7 @@ public abstract class PolicyDirectoryPanel<T extends PolicyTO>
             public void onClick(final AjaxRequestTarget target, final PolicyTO ignore) {
                 send(PolicyDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(
-                                restClient.getPolicy(model.getObject().getKey()), target));
+                                restClient.getPolicy(type, model.getObject().getKey()), target));
             }
         }, ActionLink.ActionType.EDIT, StandardEntitlement.POLICY_UPDATE);
 
@@ -170,7 +170,7 @@ public abstract class PolicyDirectoryPanel<T extends PolicyTO>
             public void onClick(final AjaxRequestTarget target, final PolicyTO ignore) {
                 final T policyTO = model.getObject();
                 try {
-                    restClient.delete(policyTO.getKey());
+                    restClient.delete(type, policyTO.getKey());
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     target.add(container);
                 } catch (SyncopeClientException e) {
@@ -221,14 +221,14 @@ public abstract class PolicyDirectoryPanel<T extends PolicyTO>
 
         @Override
         public Iterator<T> iterator(final long first, final long count) {
-            List<T> list = restClient.getPolicies(policyType);
+            List<T> list = restClient.getPolicies(type);
             Collections.sort(list, comparator);
             return list.subList((int) first, (int) first + (int) count).iterator();
         }
 
         @Override
         public long size() {
-            return restClient.getPolicies(policyType).size();
+            return restClient.getPolicies(type).size();
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
index 75ddd09..0eac09c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
@@ -46,6 +46,7 @@ import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
 import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -62,10 +63,15 @@ public class PolicyModalPanelBuilder<T extends PolicyTO> extends AbstractModalPa
 
     private final BaseModal<T> modal;
 
+    private final PolicyType type;
+
     private final PolicyRestClient restClient = new PolicyRestClient();
 
-    public PolicyModalPanelBuilder(final T policyTO, final BaseModal<T> modal, final PageReference pageRef) {
+    public PolicyModalPanelBuilder(
+            final PolicyType type, final T policyTO, final BaseModal<T> modal, final PageReference pageRef) {
+
         super(policyTO, pageRef);
+        this.type = type;
         this.modal = modal;
     }
 
@@ -156,9 +162,9 @@ public class PolicyModalPanelBuilder<T extends PolicyTO> extends AbstractModalPa
         public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
             try {
                 if (policyTO.getKey() == null) {
-                    restClient.createPolicy(policyTO);
+                    restClient.createPolicy(type, policyTO);
                 } else {
-                    restClient.updatePolicy(policyTO);
+                    restClient.updatePolicy(type, policyTO);
                 }
                 SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                 Profile.this.modal.close(target);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
index 6d0bfd5..150c359 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
@@ -80,6 +80,8 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
     private final BaseModal<T> baseModal;
 
+    private final PolicyType type;
+
     private final String policy;
 
     protected PolicyRuleDirectoryPanel(
@@ -89,6 +91,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
         disableCheckBoxes();
 
         this.baseModal = baseModal;
+        this.type = type;
         this.policy = policy;
         this.restClient = new PolicyRestClient();
 
@@ -157,10 +160,10 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
             public void onClick(final AjaxRequestTarget target, final PolicyRuleWrapper ignore) {
                 RuleConf rule = model.getObject().getConf();
                 try {
-                    T actual = restClient.getPolicy(policy);
+                    T actual = restClient.getPolicy(type, policy);
                     if (actual instanceof ComposablePolicy) {
                         ((ComposablePolicy) actual).getRules().remove(model.getObject().getImplementationKey());
-                        restClient.updatePolicy(actual);
+                        restClient.updatePolicy(type, actual);
 
                         SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                         customActionOnFinishCallback(target);
@@ -251,7 +254,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
         @Override
         public Iterator<PolicyRuleWrapper> iterator(final long first, final long count) {
-            final T actual = restClient.getPolicy(policy);
+            final T actual = restClient.getPolicy(type, policy);
 
             List<PolicyRuleWrapper> rules = actual instanceof ComposablePolicy
                     ? getPolicyRuleWrappers((ComposablePolicy) actual)
@@ -263,7 +266,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
         @Override
         public long size() {
-            final T actual = restClient.getPolicy(policy);
+            final T actual = restClient.getPolicy(type, policy);
             return actual instanceof ComposablePolicy
                     ? getPolicyRuleWrappers((ComposablePolicy) actual).size()
                     : 0;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
index baf2c51..eb93982 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
@@ -73,7 +73,7 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
 
     @Override
     protected Serializable onApplyInternal(final PolicyRuleWrapper modelObject) {
-        PolicyTO policyTO = restClient.getPolicy(policy);
+        PolicyTO policyTO = restClient.getPolicy(type, policy);
 
         ComposablePolicy composable;
         if (policyTO instanceof ComposablePolicy) {
@@ -96,7 +96,7 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
             composable.getRules().add(modelObject.getImplementationKey());
         }
 
-        restClient.updatePolicy(policyTO);
+        restClient.updatePolicy(type, policyTO);
         return modelObject;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
index 735aa24..e0c49a4 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
@@ -46,7 +46,7 @@ public class PullPolicyDirectoryPanel extends PolicyDirectoryPanel<PullPolicyTO>
         final PullPolicyTO defaultItem = new PullPolicyTO();
 
         this.addNewItemPanelBuilder(
-                new PolicyModalPanelBuilder<>(defaultItem, modal, pageRef), true);
+                new PolicyModalPanelBuilder<>(PolicyType.PULL, defaultItem, modal, pageRef), true);
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.POLICY_CREATE);
 
         initResultTable();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyModalPanel.java
index 23a2283..b265caf 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyModalPanel.java
@@ -47,6 +47,7 @@ import org.apache.syncope.common.lib.to.ImplementationTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -146,7 +147,7 @@ public class PullPolicyModalPanel extends AbstractModalPanel<PullPolicyTO> {
                     }
                 }
             });
-            restClient.updatePolicy(getItem());
+            restClient.updatePolicy(PolicyType.PULL, getItem());
 
             SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
             this.modal.close(target);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
index 6b0619e..c6446c8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
@@ -34,10 +34,10 @@ public class PolicyRestClient extends BaseRestClient {
 
     private static final long serialVersionUID = -1392090291817187902L;
 
-    public <T extends PolicyTO> T getPolicy(final String key) {
+    public <T extends PolicyTO> T getPolicy(final PolicyType type, final String key) {
         T policy = null;
         try {
-            policy = getService(PolicyService.class).read(key);
+            policy = getService(PolicyService.class).read(type, key);
         } catch (Exception e) {
             LOG.warn("No policy found for id {}", key, e);
         }
@@ -58,16 +58,16 @@ public class PolicyRestClient extends BaseRestClient {
         return res;
     }
 
-    public <T extends PolicyTO> void createPolicy(final T policy) {
-        getService(PolicyService.class).create(policy);
+    public <T extends PolicyTO> void createPolicy(final PolicyType type, final T policy) {
+        getService(PolicyService.class).create(type, policy);
     }
 
-    public <T extends PolicyTO> void updatePolicy(final T policy) {
-        getService(PolicyService.class).update(policy);
+    public <T extends PolicyTO> void updatePolicy(final PolicyType type, final T policy) {
+        getService(PolicyService.class).update(type, policy);
     }
 
-    public void delete(final String key) {
-        getService(PolicyService.class).delete(key);
+    public void delete(final PolicyType type, final String key) {
+        getService(PolicyService.class).delete(type, key);
     }
 
     private class PolicyComparator implements Comparator<PolicyTO>, Serializable {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
index ced4689..d184085 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
@@ -183,19 +183,19 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
     }
 
     public PropagationTaskTO readPropagationTask(final String taskKey) {
-        return getService(TaskService.class).read(taskKey, false);
+        return getService(TaskService.class).read(TaskType.PROPAGATION, taskKey, false);
     }
 
     public NotificationTaskTO readNotificationTask(final String taskKey) {
-        return getService(TaskService.class).read(taskKey, false);
+        return getService(TaskService.class).read(TaskType.NOTIFICATION, taskKey, false);
     }
 
-    public <T extends SchedTaskTO> T readSchedTask(final Class<T> reference, final String taskKey) {
-        return getService(TaskService.class).read(taskKey, false);
+    public <T extends TaskTO> T readTask(final TaskType type, final String taskKey) {
+        return getService(TaskService.class).read(type, taskKey, false);
     }
 
-    public void delete(final String taskKey, final Class<? extends TaskTO> taskToClass) {
-        getService(TaskService.class).delete(taskKey);
+    public void delete(final TaskType type, final String taskKey) {
+        getService(TaskService.class).delete(type, taskKey);
     }
 
     @Override
@@ -218,12 +218,12 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
         return getService(TaskService.class).listRecentExecutions(max);
     }
 
-    public void create(final SchedTaskTO taskTO) {
-        getService(TaskService.class).create(taskTO);
+    public void create(final TaskType type, final SchedTaskTO taskTO) {
+        getService(TaskService.class).create(type, taskTO);
     }
 
-    public void update(final SchedTaskTO taskTO) {
-        getService(TaskService.class).update(taskTO);
+    public void update(final TaskType type, final SchedTaskTO taskTO) {
+        getService(TaskService.class).update(type, taskTO);
     }
 
     public BulkActionResult bulkAction(final BulkAction action) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/NotificationTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/NotificationTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/NotificationTaskDirectoryPanel.java
index 5cd47c7..a0bc61f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/NotificationTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/NotificationTaskDirectoryPanel.java
@@ -160,7 +160,7 @@ public abstract class NotificationTaskDirectoryPanel
             @Override
             public void onClick(final AjaxRequestTarget target, final NotificationTaskTO modelObject) {
                 try {
-                    restClient.delete(taskTO.getKey(), NotificationTaskTO.class);
+                    restClient.delete(TaskType.NOTIFICATION, taskTO.getKey());
                     updateResultTable(target);
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     target.add(container);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/PropagationTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PropagationTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PropagationTaskDirectoryPanel.java
index ba3b122..ae30e66 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PropagationTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PropagationTaskDirectoryPanel.java
@@ -167,7 +167,7 @@ public abstract class PropagationTaskDirectoryPanel
             @Override
             public void onClick(final AjaxRequestTarget target, final PropagationTaskTO modelObject) {
                 try {
-                    restClient.delete(taskTO.getKey(), PropagationTaskTO.class);
+                    restClient.delete(TaskType.PROPAGATION, taskTO.getKey());
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     target.add(container);
                     PropagationTaskDirectoryPanel.this.getTogglePanel().close(target);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
index 2ae10aa..07c2ef3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
@@ -51,10 +51,12 @@ public abstract class ProvisioningTaskDirectoryPanel<T extends ProvisioningTaskT
     protected ProvisioningTaskDirectoryPanel(
             final BaseModal<?> baseModal,
             final MultilevelPanel multiLevelPanelRef,
+            final TaskType taskType,
             final Class<T> reference,
             final String resource,
             final PageReference pageRef) {
-        super(baseModal, multiLevelPanelRef, reference, pageRef);
+
+        super(baseModal, multiLevelPanelRef, taskType, reference, pageRef);
         this.resource = resource;
 
         this.schedTaskTO.setResource(resource);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/PullTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PullTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PullTaskDirectoryPanel.java
index 9af1251..a0329d8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PullTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PullTaskDirectoryPanel.java
@@ -39,7 +39,8 @@ public abstract class PullTaskDirectoryPanel extends ProvisioningTaskDirectoryPa
             final MultilevelPanel multiLevelPanelRef,
             final String resource,
             final PageReference pageRef) {
-        super(baseModal, multiLevelPanelRef, PullTaskTO.class, resource, pageRef);
+
+        super(baseModal, multiLevelPanelRef, TaskType.PULL, PullTaskTO.class, resource, pageRef);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskDirectoryPanel.java
index 440b0e2..ac2dd0b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/PushTaskDirectoryPanel.java
@@ -37,7 +37,7 @@ public abstract class PushTaskDirectoryPanel extends ProvisioningTaskDirectoryPa
             final MultilevelPanel multiLevelPanelRef,
             final String resource,
             final PageReference pageRef) {
-        super(baseModal, multiLevelPanelRef, PushTaskTO.class, resource, pageRef);
+        super(baseModal, multiLevelPanelRef, TaskType.PUSH, PushTaskTO.class, resource, pageRef);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
index 5135193..824b778 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
@@ -72,6 +72,8 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
 
     private static final long serialVersionUID = 4984337552918213290L;
 
+    protected TaskType taskType;
+
     protected final Class<T> reference;
 
     protected T schedTaskTO;
@@ -83,9 +85,12 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
     protected SchedTaskDirectoryPanel(
             final BaseModal<?> baseModal,
             final MultilevelPanel multiLevelPanelRef,
+            final TaskType taskType,
             final Class<T> reference,
             final PageReference pageRef) {
+
         super(baseModal, multiLevelPanelRef, pageRef);
+        this.taskType = taskType;
         this.reference = reference;
 
         try {
@@ -94,7 +99,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
             LOG.error("Falure instantiating task", e);
         }
 
-        this.addNewItemPanelBuilder(new SchedTaskWizardBuilder<>(schedTaskTO, pageRef), true);
+        this.addNewItemPanelBuilder(new SchedTaskWizardBuilder<>(taskType, schedTaskTO, pageRef), true);
 
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.TASK_CREATE);
 
@@ -115,7 +120,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
                     final TemplatableTO targetObject, final String type, final AnyTO anyTO) {
 
                 targetObject.getTemplates().put(type, anyTO);
-                new TaskRestClient().update(SchedTaskTO.class.cast(targetObject));
+                new TaskRestClient().update(taskType, SchedTaskTO.class.cast(targetObject));
                 return targetObject;
             }
         };
@@ -203,7 +208,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
                 SchedTaskDirectoryPanel.this.getTogglePanel().close(target);
                 send(SchedTaskDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(
-                                restClient.readSchedTask(reference, model.getObject().getKey()),
+                                restClient.readTask(taskType, model.getObject().getKey()),
                                 target).setResourceModel(
                                 new StringResourceModel("inner.task.edit",
                                         SchedTaskDirectoryPanel.this,
@@ -252,7 +257,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
             @Override
             public void onClick(final AjaxRequestTarget target, final T ignore) {
                 try {
-                    restClient.delete(taskTO.getKey(), reference);
+                    restClient.delete(taskType, taskTO.getKey());
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     target.add(container);
                     SchedTaskDirectoryPanel.this.getTogglePanel().close(target);
@@ -287,7 +292,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
 
     @Override
     protected SchedTasksProvider<T> dataProvider() {
-        return new SchedTasksProvider<>(reference, TaskType.SCHEDULED, rows);
+        return new SchedTasksProvider<>(reference, taskType, rows);
     }
 
     protected class SchedTasksProvider<T extends SchedTaskTO> extends TaskDataProvider<T> {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
index ef58d82..8efd140 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
@@ -42,6 +42,7 @@ import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.MatchingRule;
 import org.apache.syncope.common.lib.types.PullMode;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.lib.types.UnmatchingRule;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -61,6 +62,8 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
 
     private final ImplementationRestClient implRestClient = new ImplementationRestClient();
 
+    private final TaskType type;
+
     private PushTaskWrapper wrapper;
 
     private CrontabPanel crontabPanel;
@@ -79,8 +82,9 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
         }
     };
 
-    public SchedTaskWizardBuilder(final T taskTO, final PageReference pageRef) {
+    public SchedTaskWizardBuilder(final TaskType type, final T taskTO, final PageReference pageRef) {
         super(taskTO, pageRef);
+        this.type = type;
     }
 
     @Override
@@ -91,9 +95,9 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
 
         modelObject.setCronExpression(crontabPanel.getCronExpression());
         if (modelObject.getKey() == null) {
-            taskRestClient.create(modelObject);
+            taskRestClient.create(type, modelObject);
         } else {
-            taskRestClient.update(modelObject);
+            taskRestClient.update(type, modelObject);
         }
         return modelObject;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTasks.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTasks.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTasks.java
index d0e8907..562d632 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTasks.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTasks.java
@@ -23,6 +23,7 @@ import org.apache.syncope.client.console.panels.MultilevelPanel;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.model.Model;
@@ -39,7 +40,7 @@ public class SchedTasks extends AbstractTasks {
         add(mlp);
 
         mlp.setFirstLevel(new SchedTaskDirectoryPanel<SchedTaskTO>(
-                baseModal, mlp, SchedTaskTO.class, pageReference) {
+                baseModal, mlp, TaskType.SCHEDULED, SchedTaskTO.class, pageReference) {
 
             private static final long serialVersionUID = -2195387360323687302L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
index ba77916..5e4a9d5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
@@ -53,9 +53,10 @@ import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.types.JobType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
@@ -352,8 +353,7 @@ public class JobWidget extends BaseWidget {
                         final IModel<JobTO> rowModel) {
 
                     JobTO jobTO = rowModel.getObject();
-                    JobActionPanel panel =
-                            new JobActionPanel(componentId, jobTO, JobWidget.this, pageRef);
+                    JobActionPanel panel = new JobActionPanel(componentId, jobTO, JobWidget.this, pageRef);
                     MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.ENABLE,
                             String.format("%s,%s%s,%s",
                                     StandardEntitlement.TASK_EXECUTE,
@@ -405,11 +405,18 @@ public class JobWidget extends BaseWidget {
                             break;
 
                         case TASK:
-                            ProvisioningTaskTO schedTaskTO = new TaskRestClient().
-                                    readSchedTask(ProvisioningTaskTO.class, jobTO.getRefKey());
-
-                            SchedTaskWizardBuilder<SchedTaskTO> swb =
-                                    new SchedTaskWizardBuilder<>(schedTaskTO, pageRef);
+                            ProvisioningTaskTO schedTaskTO;
+                            try {
+                                schedTaskTO = new TaskRestClient().readTask(TaskType.PULL, jobTO.getRefKey());
+                            } catch (Exception e) {
+                                LOG.debug("Failed to read {} as {}, attempting {}",
+                                        jobTO.getRefKey(), TaskType.PULL, TaskType.PUSH, e);
+                                schedTaskTO = new TaskRestClient().readTask(TaskType.PUSH, jobTO.getRefKey());
+                            }
+
+                            SchedTaskWizardBuilder<ProvisioningTaskTO> swb =
+                                    new SchedTaskWizardBuilder<>(schedTaskTO instanceof PullTaskTO
+                                            ? TaskType.PULL : TaskType.PUSH, schedTaskTO, pageRef);
                             swb.setEventSink(AvailableJobsPanel.this);
 
                             target.add(jobModal.setContent(swb.build(BaseModal.CONTENT_ID, AjaxWizard.Mode.EDIT)));

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
index 1ce1233..aad9157 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyQuery.java
@@ -19,7 +19,6 @@
 package org.apache.syncope.common.rest.api.beans;
 
 import javax.ws.rs.DefaultValue;
-import javax.ws.rs.MatrixParam;
 import javax.ws.rs.QueryParam;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.JAXRSService;
@@ -63,7 +62,7 @@ public class AnyQuery extends AbstractQuery {
     }
 
     @DefaultValue(SyncopeConstants.ROOT_REALM)
-    @MatrixParam("realm")
+    @QueryParam("realm")
     public void setRealm(final String realm) {
         this.realm = realm;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
index dc74d26..c96d7b2 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
@@ -21,7 +21,7 @@ package org.apache.syncope.common.rest.api.beans;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.DefaultValue;
-import javax.ws.rs.MatrixParam;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.QueryParam;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.TaskType;
@@ -86,7 +86,7 @@ public class TaskQuery extends AbstractQuery {
     }
 
     @NotNull
-    @MatrixParam("type")
+    @PathParam("type")
     public void setType(final TaskType type) {
         this.type = type;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index 25c3993..40e65ac 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -26,7 +26,6 @@ import javax.validation.constraints.NotNull;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
-import javax.ws.rs.MatrixParam;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
@@ -50,14 +49,15 @@ public interface PolicyService extends JAXRSService {
     /**
      * Returns the policy matching the given key.
      *
+     * @param type policy type
      * @param key key of requested policy
      * @param <T> response type (extending PolicyTO)
      * @return policy with matching id
      */
     @GET
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends PolicyTO> T read(@NotNull @PathParam("key") String key);
+    <T extends PolicyTO> T read(@NotNull @PathParam("type") PolicyType type, @NotNull @PathParam("key") String key);
 
     /**
      * Returns a list of policies of the matching type.
@@ -67,41 +67,46 @@ public interface PolicyService extends JAXRSService {
      * @return list of policies with matching type
      */
     @GET
+    @Path("{type}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    <T extends PolicyTO> List<T> list(@NotNull @MatrixParam("type") PolicyType type);
+    <T extends PolicyTO> List<T> list(@NotNull @PathParam("type") PolicyType type);
 
     /**
      * Create a new policy.
      *
+     * @param type policy type
      * @param policyTO Policy to be created (needs to match type)
      * @return Response object featuring Location header of created policy
      */
     @POST
+    @Path("{type}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response create(@NotNull PolicyTO policyTO);
+    Response create(@NotNull @PathParam("type") PolicyType type, @NotNull PolicyTO policyTO);
 
     /**
      * Updates policy matching the given key.
      *
+     * @param type policy type
      * @param policyTO Policy to replace existing policy
      * @return an empty response if operation was successful
      */
     @PUT
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response update(@NotNull PolicyTO policyTO);
+    Response update(@NotNull @PathParam("type") PolicyType type, @NotNull PolicyTO policyTO);
 
     /**
      * Delete policy matching the given key.
      *
+     * @param type policy type
      * @param key key of policy to be deleted
      * @return an empty response if operation was successful
      */
     @DELETE
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response delete(@NotNull @PathParam("key") String key);
+    Response delete(@NotNull @PathParam("type") PolicyType type, @NotNull @PathParam("key") String key);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index ab2990c..c46dec0 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -40,6 +40,7 @@ import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.beans.TaskQuery;
 
 /**
@@ -55,15 +56,17 @@ public interface TaskService extends ExecutableService {
     /**
      * Returns the task matching the given key.
      *
+     * @param type task type
      * @param key key of task to be read
      * @param details whether include executions or not, defaults to true
      * @param <T> type of taskTO
      * @return task with matching id
      */
     @GET
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     <T extends TaskTO> T read(
+            @NotNull @PathParam("type") TaskType type,
             @NotNull @PathParam("key") String key,
             @QueryParam(JAXRSService.PARAM_DETAILS) @DefaultValue("true") boolean details);
 
@@ -75,40 +78,45 @@ public interface TaskService extends ExecutableService {
      * @return paged list of existing tasks matching the given query
      */
     @GET
+    @Path("{type}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     <T extends TaskTO> PagedResult<T> list(@BeanParam TaskQuery query);
 
     /**
      * Creates a new task.
      *
+     * @param type task type
      * @param taskTO task to be created
      * @return Response object featuring Location header of created task
      */
     @POST
+    @Path("{type}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response create(@NotNull SchedTaskTO taskTO);
+    Response create(@NotNull @PathParam("type") TaskType type, @NotNull SchedTaskTO taskTO);
 
     /**
      * Updates the task matching the provided key.
      *
+     * @param type task type
      * @param taskTO updated task to be stored
      * @return an empty response if operation was successful
      */
     @PUT
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response update(@NotNull TaskTO taskTO);
+    Response update(@NotNull @PathParam("type") TaskType type, @NotNull SchedTaskTO taskTO);
 
     /**
      * Deletes the task matching the provided key.
      *
+     * @param type task type
      * @param key key of task to be deleted
      * @return an empty response if operation was successful
      */
     @DELETE
-    @Path("{key}")
+    @Path("{type}/{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    Response delete(@NotNull @PathParam("key") String key);
+    Response delete(@NotNull @PathParam("type") TaskType type, @NotNull @PathParam("key") String key);
 
     /**
      * Executes the provided bulk action.

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
index c03b6bf..2506a90 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
@@ -22,16 +22,16 @@ import java.lang.reflect.Method;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.policy.PolicyTO;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
-import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.PolicyUtils;
+import org.apache.syncope.core.persistence.api.entity.policy.PolicyUtilsFactory;
 import org.apache.syncope.core.provisioning.api.data.PolicyDataBinder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -46,61 +46,78 @@ public class PolicyLogic extends AbstractTransactionalLogic<PolicyTO> {
     @Autowired
     private PolicyDataBinder binder;
 
+    @Autowired
+    private PolicyUtilsFactory policyUtilsFactory;
+
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_CREATE + "')")
-    public <T extends PolicyTO> T create(final T policyTO) {
+    public <T extends PolicyTO> T create(final PolicyType type, final T policyTO) {
+        PolicyUtils policyUtils = policyUtilsFactory.getInstance(policyTO);
+        if (policyUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
+            throw sce;
+        }
+
         return binder.getPolicyTO(policyDAO.save(binder.create(policyTO)));
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_UPDATE + "')")
-    public PolicyTO update(final PolicyTO policyTO) {
+    public PolicyTO update(final PolicyType type, final PolicyTO policyTO) {
         Policy policy = policyDAO.find(policyTO.getKey());
-        return binder.getPolicyTO(policyDAO.save(binder.update(policy, policyTO)));
-    }
-
-    private Class<? extends Policy> getPolicyClass(final PolicyType policyType) {
-        switch (policyType) {
-            case ACCOUNT:
-                return AccountPolicy.class;
-
-            case PASSWORD:
-                return PasswordPolicy.class;
 
-            case PULL:
-                return PullPolicy.class;
-
-            case PUSH:
-            default:
-                return PushPolicy.class;
+        PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
+        if (policyUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
+            throw sce;
         }
+
+        return binder.getPolicyTO(policyDAO.save(binder.update(policy, policyTO)));
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_LIST + "')")
     public <T extends PolicyTO> List<T> list(final PolicyType type) {
-        return policyDAO.find(getPolicyClass(type)).stream().
+        PolicyUtils policyUtils = policyUtilsFactory.getInstance(type);
+
+        return policyDAO.find(policyUtils.policyClass()).stream().
                 <T>map(policy -> binder.getPolicyTO(policy)).collect(Collectors.toList());
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_READ + "')")
-    public <T extends PolicyTO> T read(final String key) {
+    public <T extends PolicyTO> T read(final PolicyType type, final String key) {
         Policy policy = policyDAO.find(key);
         if (policy == null) {
             throw new NotFoundException("Policy " + key + " not found");
         }
 
+        PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
+        if (type != null && policyUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
+            throw sce;
+        }
+
         return binder.getPolicyTO(policy);
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.POLICY_DELETE + "')")
-    public <T extends PolicyTO> T delete(final String key) {
+    public <T extends PolicyTO> T delete(final PolicyType type, final String key) {
         Policy policy = policyDAO.find(key);
         if (policy == null) {
             throw new NotFoundException("Policy " + key + " not found");
         }
 
-        T policyToDelete = binder.getPolicyTO(policy);
+        PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
+        if (type != null && policyUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
+            throw sce;
+        }
+
+        T deleted = binder.getPolicyTO(policy);
         policyDAO.delete(policy);
 
-        return policyToDelete;
+        return deleted;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 018c3f7..a9ac3d3 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -94,8 +94,13 @@ public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
     private TaskUtilsFactory taskUtilsFactory;
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_CREATE + "')")
-    public <T extends SchedTaskTO> T createSchedTask(final T taskTO) {
+    public <T extends SchedTaskTO> T createSchedTask(final TaskType type, final T taskTO) {
         TaskUtils taskUtils = taskUtilsFactory.getInstance(taskTO);
+        if (taskUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
+            throw sce;
+        }
 
         SchedTask task = binder.createSchedTask(taskTO, taskUtils);
         task = taskDAO.save(task);
@@ -117,13 +122,18 @@ public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_UPDATE + "')")
-    public <T extends SchedTaskTO> T updateSchedTask(final SchedTaskTO taskTO) {
+    public <T extends SchedTaskTO> T updateSchedTask(final TaskType type, final SchedTaskTO taskTO) {
         SchedTask task = taskDAO.find(taskTO.getKey());
         if (task == null) {
             throw new NotFoundException("Task " + taskTO.getKey());
         }
 
         TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
+        if (taskUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
+            throw sce;
+        }
 
         binder.updateSchedTask(task, taskTO, taskUtils);
         task = taskDAO.save(task);
@@ -180,11 +190,19 @@ public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_READ + "')")
-    public <T extends TaskTO> T read(final String key, final boolean details) {
+    public <T extends TaskTO> T read(final TaskType type, final String key, final boolean details) {
         Task task = taskDAO.find(key);
         if (task == null) {
             throw new NotFoundException("Task " + key);
         }
+
+        TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
+        if (type != null && taskUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
+            throw sce;
+        }
+
         return binder.getTaskTO(task, taskUtilsFactory.getInstance(task), details);
     }
 
@@ -261,12 +279,18 @@ public class TaskLogic extends AbstractExecutableLogic<TaskTO> {
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_DELETE + "')")
-    public <T extends TaskTO> T delete(final String key) {
+    public <T extends TaskTO> T delete(final TaskType type, final String key) {
         Task task = taskDAO.find(key);
         if (task == null) {
             throw new NotFoundException("Task " + key);
         }
+
         TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
+        if (type != null && taskUtils.getType() != type) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
+            throw sce;
+        }
 
         T taskToDelete = binder.getTaskTO(task, taskUtils, true);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
index ea1ceb8..ecde5f1 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.persistence.api.dao;
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
index 456850c..e841a3c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
@@ -20,11 +20,11 @@ package org.apache.syncope.core.persistence.api.dao;
 
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
 public interface PolicyDAO extends DAO<Policy> {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
index c838338..42ba819 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RealmDAO.java
@@ -21,8 +21,8 @@ package org.apache.syncope.core.persistence.api.dao;
 import java.util.List;
 import java.util.regex.Pattern;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
 public interface RealmDAO extends DAO<Realm> {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
deleted file mode 100644
index 85fc90e..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.core.persistence.api.entity;
-
-public interface Policy extends Entity {
-
-    String getDescription();
-
-    void setDescription(String description);
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
index 3fe3c5e..af09b39 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.entity.policy;
 import java.util.List;
 import java.util.Set;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
 public interface AccountPolicy extends Policy {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PasswordPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PasswordPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PasswordPolicy.java
index e44eba0..e6575df 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PasswordPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PasswordPolicy.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.persistence.api.entity.policy;
 
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PasswordPolicy extends Policy {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/Policy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/Policy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/Policy.java
new file mode 100644
index 0000000..b152221
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/Policy.java
@@ -0,0 +1,28 @@
+/*
+ * 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.core.persistence.api.entity.policy;
+
+import org.apache.syncope.core.persistence.api.entity.Entity;
+
+public interface Policy extends Entity {
+
+    String getDescription();
+
+    void setDescription(String description);
+}


[6/7] syncope git commit: [SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtils.java
new file mode 100644
index 0000000..e712646
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtils.java
@@ -0,0 +1,28 @@
+/*
+ * 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.core.persistence.api.entity.policy;
+
+import org.apache.syncope.common.lib.types.PolicyType;
+
+public interface PolicyUtils {
+
+    PolicyType getType();
+
+    Class<? extends Policy> policyClass();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtilsFactory.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtilsFactory.java
new file mode 100644
index 0000000..e3092c0
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PolicyUtilsFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.core.persistence.api.entity.policy;
+
+import org.apache.syncope.common.lib.policy.PolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+
+public interface PolicyUtilsFactory {
+
+    PolicyUtils getInstance(PolicyType type);
+
+    PolicyUtils getInstance(Policy policy);
+
+    PolicyUtils getInstance(Class<? extends PolicyTO> policyClass);
+
+    PolicyUtils getInstance(PolicyTO policyTO);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
index 6612fe5..d8d1a69 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Optional;
 import org.apache.syncope.common.lib.types.ConflictResolutionAction;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PullPolicy extends Policy {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
index 4365e72..d6819b7 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.persistence.api.entity.policy;
 
 import org.apache.syncope.common.lib.policy.PushPolicySpec;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PushPolicy extends Policy {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index 530b539..3ad39f6 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -42,8 +42,8 @@ import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 38d260f..52bca60 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -26,8 +26,8 @@ import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
 import org.apache.syncope.core.persistence.jpa.entity.policy.AbstractPolicy;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index 3594b70..7f90046 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -31,9 +31,9 @@ import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.jpa.entity.JPARealm;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractPolicy.java
index 0d5b57c..27fcb85 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractPolicy.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractPolicy.java
@@ -22,7 +22,7 @@ import javax.persistence.Entity;
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
 import javax.validation.constraints.NotNull;
-import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
 
 @Entity

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtils.java
new file mode 100644
index 0000000..d87325e
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtils.java
@@ -0,0 +1,60 @@
+/*
+ * 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.core.persistence.jpa.entity.policy;
+
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.PolicyUtils;
+import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+
+public class JPAPolicyUtils implements PolicyUtils {
+
+    private final PolicyType type;
+
+    protected JPAPolicyUtils(final PolicyType type) {
+        this.type = type;
+    }
+
+    @Override
+    public PolicyType getType() {
+        return type;
+    }
+
+    @Override
+    public Class<? extends Policy> policyClass() {
+        switch (type) {
+            case ACCOUNT:
+                return AccountPolicy.class;
+
+            case PASSWORD:
+                return PasswordPolicy.class;
+
+            case PULL:
+                return PullPolicy.class;
+
+            case PUSH:
+            default:
+                return PushPolicy.class;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtilsFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtilsFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtilsFactory.java
new file mode 100644
index 0000000..6ecd1d0
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/JPAPolicyUtilsFactory.java
@@ -0,0 +1,82 @@
+/*
+ * 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.core.persistence.jpa.entity.policy;
+
+import org.apache.syncope.common.lib.policy.AccountPolicyTO;
+import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
+import org.apache.syncope.common.lib.policy.PullPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.PolicyUtils;
+import org.apache.syncope.core.persistence.api.entity.policy.PolicyUtilsFactory;
+import org.springframework.stereotype.Component;
+import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
+
+@Component
+public class JPAPolicyUtilsFactory implements PolicyUtilsFactory {
+
+    @Override
+    public PolicyUtils getInstance(final PolicyType type) {
+        return new JPAPolicyUtils(type);
+    }
+
+    @Override
+    public PolicyUtils getInstance(final Policy policy) {
+        PolicyType type;
+        if (policy instanceof AccountPolicy) {
+            type = PolicyType.ACCOUNT;
+        } else if (policy instanceof PasswordPolicy) {
+            type = PolicyType.PASSWORD;
+        } else if (policy instanceof PullPolicy) {
+            type = PolicyType.PULL;
+        } else if (policy instanceof PushPolicy) {
+            type = PolicyType.PUSH;
+        } else {
+            throw new IllegalArgumentException("Invalid policy: " + policy);
+        }
+
+        return getInstance(type);
+    }
+
+    @Override
+    public PolicyUtils getInstance(final Class<? extends PolicyTO> policyClass) {
+        PolicyType type;
+        if (policyClass == AccountPolicyTO.class) {
+            type = PolicyType.ACCOUNT;
+        } else if (policyClass == PasswordPolicyTO.class) {
+            type = PolicyType.PASSWORD;
+        } else if (policyClass == PullPolicyTO.class) {
+            type = PolicyType.PULL;
+        } else {
+            throw new IllegalArgumentException("Invalid PolicyTO class: " + policyClass.getName());
+        }
+
+        return getInstance(type);
+    }
+
+    @Override
+    public PolicyUtils getInstance(final PolicyTO policyTO) {
+        return getInstance(policyTO.getClass());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
index 3b46f62..4fde449 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/EntityValidationListener.java
@@ -31,9 +31,9 @@ import org.apache.syncope.core.persistence.api.entity.Any;
 import org.apache.syncope.core.persistence.api.entity.DynMembership;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 import org.apache.syncope.core.persistence.api.entity.GroupableRelatable;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
 import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.task.Task;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
index 1301395..2fa7345 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/PolicyTest.java
@@ -37,8 +37,8 @@ import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
 import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.CorrelationRule;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.jpa.AbstractTest;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
index 3ff922d..6fd25ef 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/PolicyDataBinder.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.core.provisioning.api.data;
 
 import org.apache.syncope.common.lib.policy.PolicyTO;
-import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 
 public interface PolicyDataBinder {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
index 4666c11..319690e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/PolicyDataBinderImpl.java
@@ -36,14 +36,14 @@ import org.apache.syncope.core.persistence.api.entity.EntityFactory;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.policy.CorrelationRule;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 
 @Component
 public class PolicyDataBinderImpl implements PolicyDataBinder {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
index d877700..8b006e1 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -35,9 +35,9 @@ import org.apache.syncope.core.persistence.api.entity.AnyType;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.EntityFactory;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.provisioning.api.data.RealmDataBinder;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
index 2925fc7..c115ca6 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
@@ -36,8 +36,8 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
     private PolicyLogic logic;
 
     @Override
-    public Response create(final PolicyTO policyTO) {
-        PolicyTO policy = logic.create(policyTO);
+    public Response create(final PolicyType type, final PolicyTO policyTO) {
+        PolicyTO policy = logic.create(type, policyTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(policy.getKey()).build();
         return Response.created(location).
                 header(RESTHeaders.RESOURCE_KEY, policy.getKey()).
@@ -45,8 +45,8 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
     }
 
     @Override
-    public Response delete(final String key) {
-        logic.delete(key);
+    public Response delete(final PolicyType type, final String key) {
+        logic.delete(type, key);
         return Response.noContent().build();
     }
 
@@ -56,13 +56,13 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
     }
 
     @Override
-    public <T extends PolicyTO> T read(final String key) {
-        return logic.read(key);
+    public <T extends PolicyTO> T read(final PolicyType type, final String key) {
+        return logic.read(type, key);
     }
 
     @Override
-    public Response update(final PolicyTO policyTO) {
-        logic.update(policyTO);
+    public Response update(final PolicyType type, final PolicyTO policyTO) {
+        logic.update(type, policyTO);
         return Response.noContent().build();
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
index 37067a3..cd24751 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
@@ -28,6 +28,7 @@ import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.beans.TaskQuery;
 import org.apache.syncope.common.rest.api.service.TaskService;
@@ -48,10 +49,10 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
     }
 
     @Override
-    public Response create(final SchedTaskTO taskTO) {
+    public Response create(final TaskType type, final SchedTaskTO taskTO) {
         SchedTaskTO createdTask;
         if (taskTO != null) {
-            createdTask = logic.createSchedTask(taskTO);
+            createdTask = logic.createSchedTask(type, taskTO);
         } else {
             throw new BadRequestException();
         }
@@ -63,8 +64,8 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
     }
 
     @Override
-    public Response delete(final String key) {
-        logic.delete(key);
+    public Response delete(final TaskType type, final String key) {
+        logic.delete(type, key);
         return Response.noContent().build();
     }
 
@@ -85,18 +86,14 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
     }
 
     @Override
-    public <T extends TaskTO> T read(final String key, final boolean details) {
-        return logic.read(key, details);
+    public <T extends TaskTO> T read(final TaskType type, final String key, final boolean details) {
+        return logic.read(type, key, details);
     }
 
     @Override
-    public Response update(final TaskTO taskTO) {
-        if (taskTO instanceof SchedTaskTO) {
-            logic.updateSchedTask((SchedTaskTO) taskTO);
-            return Response.noContent().build();
-        } else {
-            throw new BadRequestException();
-        }
+    public Response update(final TaskType type, final SchedTaskTO taskTO) {
+        logic.updateSchedTask(type, taskTO);
+        return Response.noContent().build();
     }
 
     @Override
@@ -107,7 +104,7 @@ public class TaskServiceImpl extends AbstractExecutableService implements TaskSe
             case DELETE:
                 for (String key : bulkAction.getTargets()) {
                     try {
-                        result.getResults().put(logic.delete(key).getKey(), BulkActionResult.Status.SUCCESS);
+                        result.getResults().put(logic.delete(null, key).getKey(), BulkActionResult.Status.SUCCESS);
                     } catch (Exception e) {
                         LOG.error("Error performing delete for task {}", key, e);
                         result.getResults().put(key, BulkActionResult.Status.FAILURE);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/ext/swagger-ui/pom.xml
----------------------------------------------------------------------
diff --git a/ext/swagger-ui/pom.xml b/ext/swagger-ui/pom.xml
index be72a97..d4226ec 100644
--- a/ext/swagger-ui/pom.xml
+++ b/ext/swagger-ui/pom.xml
@@ -102,29 +102,7 @@ under the License.
           </execution>
         </executions>
       </plugin>
-          
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <id>addMatrixParamSupport</id>
-            <phase>process-resources</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <target>
-                <replace file="${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/swagger-ui-bundle.js"
-                         token="function i(e){var t=e.req,n=e.value,r=e.parameter,i=r.name,o=r.style,a=r.explode,s=(0,h.default)({key:r.name,value:n,style:o||&quot;simple&quot;,explode:a||!1,escape:!1});t.url=t.url.replace(&quot;{&quot;+i+&quot;}&quot;,s)}"
-                         value="function i(e){var t=e.req,r=e.value,n=e.parameter,a=n.name,u=n.style,o=n.explode,i=(0,h.default)({key:n.name,value:r,style:u||&quot;simple&quot;,explode:o||!1,escape:&quot;matrix&quot;===u});&quot;matrix&quot;!==u||!n.explode&amp;&amp;void 0!==n.explode?t.url=t.url.replace(&quot;{&quot;+a+&quot;}&quot;,i):t.url=t.url.concat(i)}"/>
-              </target>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
+         
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
index f6ec448..8466864 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/ITImplementationLookup.java
@@ -40,6 +40,7 @@ import org.apache.syncope.common.lib.report.UserReportletConf;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.core.logic.TaskLogic;
 import org.apache.syncope.core.migration.MigrationPullActions;
 import org.apache.syncope.core.provisioning.java.job.report.AuditReportlet;
@@ -255,7 +256,7 @@ public class ITImplementationLookup implements ImplementationLookup {
                     SchedTaskTO task = new SchedTaskTO();
                     task.setJobDelegate(reindex.getKey());
                     task.setName("Elasticsearch Reindex");
-                    task = taskLogic.createSchedTask(task);
+                    task = taskLogic.createSchedTask(TaskType.SCHEDULED, task);
 
                     taskLogic.execute(task.getKey(), null, false);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index 32f350a..08d626b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -62,6 +62,7 @@ import org.apache.syncope.common.lib.to.RoleTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.PatchOperation;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.TraceLevel;
 import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -487,8 +488,8 @@ public abstract class AbstractITCase {
     }
 
     @SuppressWarnings("unchecked")
-    protected <T extends PolicyTO> T createPolicy(final T policy) {
-        Response response = policyService.create(policy);
+    protected <T extends PolicyTO> T createPolicy(final PolicyType type, final T policy) {
+        Response response = policyService.create(type, policy);
         if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
             Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
             if (ex != null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java
index 5fb9c52..ac7339d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java
@@ -38,7 +38,6 @@ import org.apache.syncope.client.cli.commands.entitlement.EntitlementCommand;
 import org.apache.syncope.client.cli.commands.group.GroupCommand;
 import org.apache.syncope.client.cli.commands.install.InstallCommand;
 import org.apache.syncope.client.cli.commands.logger.LoggerCommand;
-import org.apache.syncope.client.cli.commands.policy.PolicyCommand;
 import org.apache.syncope.client.cli.commands.report.ReportCommand;
 import org.apache.syncope.client.cli.commands.role.RoleCommand;
 import org.apache.syncope.client.cli.commands.user.UserCommand;
@@ -264,26 +263,6 @@ public class CLIITCase extends AbstractITCase {
     }
 
     @Test
-    public void policyError() {
-        Process process = null;
-        try {
-            PROCESS_BUILDER.command(getCommand(
-                    new PolicyCommand().getClass().getAnnotation(Command.class).name(),
-                    PolicyCommand.PolicyOptions.READ.getOptionName(),
-                    "wrong"));
-            process = PROCESS_BUILDER.start();
-            final String result = IOUtils.toString(process.getInputStream(), StandardCharsets.UTF_8);
-            assertTrue(result.contains("- Policy wrong doesn't exist"));
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            if (process != null) {
-                process.destroy();
-            }
-        }
-    }
-
-    @Test
     public void lastStatements() {
         Process process = null;
         try {

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
index d59422a..11fbb0b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
@@ -58,6 +58,8 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
 
         private final TaskService taskService;
 
+        private final TaskType type;
+
         private final String taskKey;
 
         private final int maxWaitSeconds;
@@ -65,9 +67,11 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
         private final boolean dryRun;
 
         public ThreadExec(
-                final TaskService taskService, final String taskKey, final int maxWaitSeconds, final boolean dryRun) {
+                final TaskService taskService, final TaskType type, final String taskKey,
+                final int maxWaitSeconds, final boolean dryRun) {
 
             this.taskService = taskService;
+            this.type = type;
             this.taskKey = taskKey;
             this.maxWaitSeconds = maxWaitSeconds;
             this.dryRun = dryRun;
@@ -75,7 +79,7 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
 
         @Override
         public ExecTO call() throws Exception {
-            return execProvisioningTask(taskService, taskKey, maxWaitSeconds, dryRun);
+            return execProvisioningTask(taskService, type, taskKey, maxWaitSeconds, dryRun);
         }
     }
 
@@ -123,10 +127,11 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
         }
     }
 
-    protected static ExecTO execTask(final TaskService taskService, final String taskKey, final String initialStatus,
-            final int maxWaitSeconds, final boolean dryRun) {
+    protected static ExecTO execTask(
+            final TaskService taskService, final TaskType type, final String taskKey,
+            final String initialStatus, final int maxWaitSeconds, final boolean dryRun) {
 
-        TaskTO taskTO = taskService.read(taskKey, true);
+        TaskTO taskTO = taskService.read(type, taskKey, true);
         assertNotNull(taskTO);
         assertNotNull(taskTO.getExecutions());
 
@@ -145,7 +150,7 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
             } catch (InterruptedException e) {
             }
 
-            taskTO = taskService.read(taskTO.getKey(), true);
+            taskTO = taskService.read(type, taskTO.getKey(), true);
 
             assertNotNull(taskTO);
             assertNotNull(taskTO.getExecutions());
@@ -159,25 +164,27 @@ public abstract class AbstractTaskITCase extends AbstractITCase {
     }
 
     public static ExecTO execProvisioningTask(
-            final TaskService taskService, final String taskKey, final int maxWaitSeconds, final boolean dryRun) {
+            final TaskService taskService, final TaskType type, final String taskKey,
+            final int maxWaitSeconds, final boolean dryRun) {
 
-        return execTask(taskService, taskKey, "JOB_FIRED", maxWaitSeconds, dryRun);
+        return execTask(taskService, type, taskKey, "JOB_FIRED", maxWaitSeconds, dryRun);
     }
 
     protected static ExecTO execNotificationTask(
             final TaskService taskService, final String taskKey, final int maxWaitSeconds) {
 
-        return execTask(taskService, taskKey, NotificationJob.Status.SENT.name(), maxWaitSeconds, false);
+        return execTask(taskService, TaskType.NOTIFICATION, taskKey,
+                NotificationJob.Status.SENT.name(), maxWaitSeconds, false);
     }
 
-    protected void execProvisioningTasks(final TaskService taskService,
-            final Set<String> taskKeys, final int maxWaitSeconds, final boolean dryRun) throws Exception {
+    protected void execProvisioningTasks(final TaskService taskService, final TaskType type, final Set<String> taskKeys,
+            final int maxWaitSeconds, final boolean dryRun) throws Exception {
 
         ExecutorService service = Executors.newFixedThreadPool(taskKeys.size());
         List<Future<ExecTO>> futures = new ArrayList<>();
 
         for (String key : taskKeys) {
-            futures.add(service.submit(new ThreadExec(taskService, key, maxWaitSeconds, dryRun)));
+            futures.add(service.submit(new ThreadExec(taskService, type, key, maxWaitSeconds, dryRun)));
             // avoid flooding the test server
             try {
                 Thread.sleep(2000);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
index 1b7f931..172d18c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
@@ -85,6 +85,7 @@ import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.GroupService;
 import org.apache.syncope.common.rest.api.service.SyncopeService;
@@ -915,7 +916,7 @@ public class GroupITCase extends AbstractITCase {
             do {
                 Thread.sleep(1000);
 
-                taskTO = taskService.read(exec.getRefKey(), true);
+                taskTO = taskService.read(TaskType.SCHEDULED, exec.getRefKey(), true);
 
                 assertNotNull(taskTO);
                 assertNotNull(taskTO.getExecutions());

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java
index ea43662..54abfeb 100755
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java
@@ -25,12 +25,13 @@ import java.util.List;
 import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
 import org.apache.syncope.common.lib.to.WorkflowFormTO;
 import org.junit.jupiter.api.Test;
+import org.apache.syncope.common.lib.types.TaskType;
 
 public class IdentityRecertificationITCase extends AbstractTaskITCase {
 
     @Test
     public void recertification() {
-        execTask(taskService, "e95555d2-1b09-42c8-b25b-f4c4ec598989", "JOB_FIRED", 50, false);
+        execTask(taskService, TaskType.SCHEDULED, "e95555d2-1b09-42c8-b25b-f4c4ec598989", "JOB_FIRED", 50, false);
 
         List<WorkflowFormTO> forms = userWorkflowService.getForms();
         assertFalse(forms.isEmpty());

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
index b4e243d..109e750 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ImplementationITCase.java
@@ -30,6 +30,7 @@ import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.service.ImplementationService;
 import org.apache.syncope.fit.AbstractITCase;
 import org.apache.syncope.fit.core.reference.TestPullActions;
@@ -78,15 +79,15 @@ public class ImplementationITCase extends AbstractITCase {
 
         implementationService.create(implementationTO);
 
-        PullTaskTO pullTask = taskService.read(AbstractTaskITCase.PULL_TASK_KEY, false);
+        PullTaskTO pullTask = taskService.read(TaskType.PULL, AbstractTaskITCase.PULL_TASK_KEY, false);
         assertNotNull(pullTask);
 
         int before = pullTask.getActions().size();
 
         pullTask.getActions().add(implementationTO.getKey());
-        taskService.update(pullTask);
+        taskService.update(TaskType.PULL, pullTask);
 
-        pullTask = taskService.read(AbstractTaskITCase.PULL_TASK_KEY, false);
+        pullTask = taskService.read(TaskType.PULL, AbstractTaskITCase.PULL_TASK_KEY, false);
         assertNotNull(pullTask);
 
         int after = pullTask.getActions().size();
@@ -101,7 +102,7 @@ public class ImplementationITCase extends AbstractITCase {
         }
 
         pullTask.getActions().remove(implementationTO.getKey());
-        taskService.update(pullTask);
+        taskService.update(TaskType.PULL, pullTask);
 
         implementationService.delete(implementationTO.getKey());
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
index a4f6ac5..9e524da 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java
@@ -49,6 +49,7 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.PatchOperation;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.service.TaskService;
 import org.apache.syncope.fit.AbstractITCase;
@@ -267,15 +268,16 @@ public class MembershipITCase extends AbstractITCase {
             userService.delete(user.getKey());
 
             // 4. create pull task and execute
-            newTask = taskService.read("7c2242f4-14af-4ab5-af31-cdae23783655", true);
+            newTask = taskService.read(TaskType.PULL, "7c2242f4-14af-4ab5-af31-cdae23783655", true);
             newTask.setResource(newResource.getKey());
             newTask.setDestinationRealm("/even/two");
 
-            Response response = taskService.create(newTask);
+            Response response = taskService.create(TaskType.PULL, newTask);
             newTask = getObject(response.getLocation(), TaskService.class, PullTaskTO.class);
             assertNotNull(newTask);
 
-            ExecTO execution = AbstractTaskITCase.execProvisioningTask(taskService, newTask.getKey(), 50, false);
+            ExecTO execution = AbstractTaskITCase.execProvisioningTask(
+                    taskService, TaskType.PULL, newTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // 5. verify that pulled user has
@@ -292,7 +294,7 @@ public class MembershipITCase extends AbstractITCase {
             fail(e.getMessage());
         } finally {
             if (newTask != null && !"83f7e85d-9774-43fe-adba-ccd856312994".equals(newTask.getKey())) {
-                taskService.delete(newTask.getKey());
+                taskService.delete(TaskType.PULL, newTask.getKey());
             }
             resourceService.delete(newResource.getKey());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
index db176df..7f23c31 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
@@ -49,6 +49,7 @@ import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.PullMode;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.beans.SchemaQuery;
 import org.apache.syncope.common.rest.api.service.ConnectorService;
@@ -193,15 +194,15 @@ public class MultitenancyITCase extends AbstractITCase {
             task.setPullMode(PullMode.FULL_RECONCILIATION);
             task.setPerformCreate(true);
 
-            response = adminClient.getService(TaskService.class).create(task);
+            response = adminClient.getService(TaskService.class).create(TaskType.PULL, task);
             assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
-            task = adminClient.getService(TaskService.class).read(
+            task = adminClient.getService(TaskService.class).read(TaskType.PULL,
                     StringUtils.substringAfterLast(response.getLocation().toASCIIString(), "/"), true);
             assertNotNull(resource);
 
             // pull
             ExecTO execution = AbstractTaskITCase.execProvisioningTask(
-                    adminClient.getService(TaskService.class), task.getKey(), 50, false);
+                    adminClient.getService(TaskService.class), TaskType.PULL, task.getKey(), 50, false);
 
             // verify execution status
             String status = execution.getStatus();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
index 38832be..8ac0cea 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java
@@ -64,7 +64,7 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
         assertTrue(verifyMail(sender, subject, created.getRight()));
 
         // verify message body
-        taskTO = taskService.read(taskTO.getKey(), true);
+        taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
         assertNotNull(taskTO);
         assertTrue(taskTO.isExecuted());
         assertNotNull(taskTO.getTextBody());
@@ -108,9 +108,11 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
             int preExecs = taskTO.getExecutions().size();
 
             // 4. verify notification could not be delivered
-            execTask(taskService, taskTO.getKey(), NotificationJob.Status.NOT_SENT.name(), 5, false);
+            execTask(
+                    taskService, TaskType.NOTIFICATION, taskTO.getKey(), NotificationJob.Status.NOT_SENT.name(), 5,
+                    false);
 
-            taskTO = taskService.read(taskTO.getKey(), true);
+            taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
             assertNotNull(taskTO);
             assertFalse(taskTO.isExecuted());
             assertTrue(preExecs <= taskTO.getExecutions().size());
@@ -137,11 +139,11 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
         // generate an execution in order to verify the deletion of a notification task with one or more executions
         execNotificationTask(taskService, taskTO.getKey(), 50);
 
-        taskTO = taskService.read(taskTO.getKey(), true);
+        taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
         assertTrue(taskTO.isExecuted());
         assertFalse(taskTO.getExecutions().isEmpty());
 
-        taskService.delete(taskTO.getKey());
+        taskService.delete(TaskType.NOTIFICATION, taskTO.getKey());
     }
 
     @Test
@@ -161,7 +163,7 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
             execNotificationTask(taskService, taskTO.getKey(), 50);
 
             // 4. verify
-            taskTO = taskService.read(taskTO.getKey(), true);
+            taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
             assertNotNull(taskTO);
             assertTrue(taskTO.isExecuted());
             assertEquals(1, taskTO.getExecutions().size());
@@ -191,7 +193,7 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
         assertTrue(verifyMail(sender, subject, created.getRight()));
 
         // verify that last exec status was updated
-        taskTO = taskService.read(taskTO.getKey(), true);
+        taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
         assertNotNull(taskTO);
         assertTrue(taskTO.isExecuted());
         assertTrue(taskTO.getExecutions().isEmpty());
@@ -214,7 +216,7 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase {
         assertTrue(verifyMail(sender, subject, created.getRight()));
 
         // verify task
-        taskTO = taskService.read(taskTO.getKey(), true);
+        taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
         assertTrue(taskTO.isExecuted());
         assertNotNull(taskTO);
         assertTrue(taskTO.getRecipients().contains("syncope445@syncope.apache.org"));

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
index 3afec6d..943ce6a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java
@@ -89,7 +89,7 @@ public class PolicyITCase extends AbstractITCase {
 
     @Test
     public void getAccountPolicy() {
-        AccountPolicyTO policyTO = policyService.read("06e2ed52-6966-44aa-a177-a0ca7434201f");
+        AccountPolicyTO policyTO = policyService.read(PolicyType.ACCOUNT, "06e2ed52-6966-44aa-a177-a0ca7434201f");
 
         assertNotNull(policyTO);
         assertTrue(policyTO.getUsedByResources().isEmpty());
@@ -98,7 +98,7 @@ public class PolicyITCase extends AbstractITCase {
 
     @Test
     public void getPasswordPolicy() {
-        PasswordPolicyTO policyTO = policyService.read("986d1236-3ac5-4a19-810c-5ab21d79cba1");
+        PasswordPolicyTO policyTO = policyService.read(PolicyType.PASSWORD, "986d1236-3ac5-4a19-810c-5ab21d79cba1");
 
         assertNotNull(policyTO);
         assertTrue(policyTO.getUsedByResources().contains(RESOURCE_NAME_NOPROPAGATION));
@@ -107,7 +107,7 @@ public class PolicyITCase extends AbstractITCase {
 
     @Test
     public void getPullPolicy() {
-        PullPolicyTO policyTO = policyService.read("66691e96-285f-4464-bc19-e68384ea4c85");
+        PullPolicyTO policyTO = policyService.read(PolicyType.PULL, "66691e96-285f-4464-bc19-e68384ea4c85");
 
         assertNotNull(policyTO);
         assertTrue(policyTO.getUsedByRealms().isEmpty());
@@ -115,20 +115,20 @@ public class PolicyITCase extends AbstractITCase {
 
     @Test
     public void create() throws IOException {
-        PullPolicyTO policyTO = createPolicy(buildPullPolicyTO());
+        PullPolicyTO policyTO = createPolicy(PolicyType.PULL, buildPullPolicyTO());
         assertNotNull(policyTO);
         assertEquals("TestPullRule", policyTO.getCorrelationRules().get(AnyTypeKind.USER.name()));
     }
 
     @Test
     public void update() {
-        PasswordPolicyTO globalPolicy = policyService.read("ce93fcda-dc3a-4369-a7b0-a6108c261c85");
+        PasswordPolicyTO globalPolicy = policyService.read(PolicyType.PASSWORD, "ce93fcda-dc3a-4369-a7b0-a6108c261c85");
 
         PasswordPolicyTO policy = SerializationUtils.clone(globalPolicy);
         policy.setDescription("A simple password policy");
 
         // create a new password policy using the former as a template
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.PASSWORD, policy);
         assertNotNull(policy);
         assertNotEquals("ce93fcda-dc3a-4369-a7b0-a6108c261c85", policy.getKey());
 
@@ -140,8 +140,8 @@ public class PolicyITCase extends AbstractITCase {
         rule.setBody(POJOHelper.serialize(ruleConf));
 
         // update new password policy
-        policyService.update(policy);
-        policy = policyService.read(policy.getKey());
+        policyService.update(PolicyType.PASSWORD, policy);
+        policy = policyService.read(PolicyType.PASSWORD, policy.getKey());
         assertNotNull(policy);
 
         ruleConf = POJOHelper.deserialize(rule.getBody(), DefaultPasswordRuleConf.class);
@@ -153,13 +153,13 @@ public class PolicyITCase extends AbstractITCase {
     public void delete() throws IOException {
         PullPolicyTO policy = buildPullPolicyTO();
 
-        PullPolicyTO policyTO = createPolicy(policy);
+        PullPolicyTO policyTO = createPolicy(PolicyType.PULL, policy);
         assertNotNull(policyTO);
 
-        policyService.delete(policyTO.getKey());
+        policyService.delete(PolicyType.PULL, policyTO.getKey());
 
         try {
-            policyService.read(policyTO.getKey());
+            policyService.read(PolicyType.PULL, policyTO.getKey());
             fail("This should not happen");
         } catch (SyncopeClientException e) {
             assertNotNull(e);
@@ -193,7 +193,7 @@ public class PolicyITCase extends AbstractITCase {
 
         policy.getRules().add(rule.getKey());
 
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.ACCOUNT, policy);
         assertNotNull(policy);
     }
 
@@ -217,7 +217,7 @@ public class PolicyITCase extends AbstractITCase {
 
         policy.getRules().add(rule.getKey());
 
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.ACCOUNT, policy);
         assertNotNull(policy);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
index 7ab6b22..f74b224 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java
@@ -76,7 +76,7 @@ public class PropagationTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void read() {
-        PropagationTaskTO taskTO = taskService.read("316285cc-ae52-4ea2-a33b-7355e189ac3f", true);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, "316285cc-ae52-4ea2-a33b-7355e189ac3f", true);
         assertNotNull(taskTO);
         assertNotNull(taskTO.getExecutions());
         assertTrue(taskTO.getExecutions().isEmpty());
@@ -171,12 +171,12 @@ public class PropagationTaskITCase extends AbstractTaskITCase {
         }
 
         // check read
-        PropagationTaskTO task = taskService.read("1e697572-b896-484c-ae7f-0c8f63fcbc6c", false);
+        PropagationTaskTO task = taskService.read(TaskType.PROPAGATION, "1e697572-b896-484c-ae7f-0c8f63fcbc6c", false);
         assertNotNull(task);
         assertEquals("1e697572-b896-484c-ae7f-0c8f63fcbc6c", task.getKey());
         assertTrue(task.getExecutions().isEmpty());
 
-        task = taskService.read("1e697572-b896-484c-ae7f-0c8f63fcbc6c", true);
+        task = taskService.read(TaskType.PROPAGATION, "1e697572-b896-484c-ae7f-0c8f63fcbc6c", true);
         assertNotNull(task);
         assertEquals("1e697572-b896-484c-ae7f-0c8f63fcbc6c", task.getKey());
         assertFalse(task.getExecutions().isEmpty());

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index 3e6a4f0..708c2fa 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -73,6 +73,7 @@ import org.apache.syncope.common.lib.types.ConnConfProperty;
 import org.apache.syncope.common.lib.types.ConnectorCapability;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 import org.apache.syncope.common.lib.types.PullMode;
@@ -119,9 +120,9 @@ public class PullTaskITCase extends AbstractTaskITCase {
         }
         assertNotNull(pullActions);
 
-        PullTaskTO pullTask = taskService.read(PULL_TASK_KEY, true);
+        PullTaskTO pullTask = taskService.read(TaskType.PULL, PULL_TASK_KEY, true);
         pullTask.getActions().add(pullActions.getKey());
-        taskService.update(pullTask);
+        taskService.update(TaskType.PULL, pullTask);
     }
 
     @Test
@@ -160,11 +161,11 @@ public class PullTaskITCase extends AbstractTaskITCase {
         groupTemplate.getResources().add(RESOURCE_NAME_LDAP);
         task.getTemplates().put(AnyTypeKind.GROUP.name(), groupTemplate);
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.PULL, task);
         PullTaskTO actual = getObject(response.getLocation(), TaskService.class, PullTaskTO.class);
         assertNotNull(actual);
 
-        task = taskService.read(actual.getKey(), true);
+        task = taskService.read(TaskType.PULL, actual.getKey(), true);
         assertNotNull(task);
         assertEquals(actual.getKey(), task.getKey());
         assertEquals(actual.getJobDelegate(), task.getJobDelegate());
@@ -229,7 +230,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     page(1).size(1).build()).getTotalCount();
             assertNotNull(usersPre);
 
-            ExecTO exec = execProvisioningTask(taskService, PULL_TASK_KEY, 50, false);
+            ExecTO exec = execProvisioningTask(taskService, TaskType.PULL, PULL_TASK_KEY, 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
 
             LOG.debug("Execution of task {}:\n{}", PULL_TASK_KEY, exec);
@@ -297,7 +298,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             Set<String> otherPullTaskKeys = new HashSet<>();
             otherPullTaskKeys.add("feae4e57-15ca-40d9-b973-8b9015efca49");
             otherPullTaskKeys.add("55d5e74b-497e-4bc0-9156-73abef4b9adc");
-            execProvisioningTasks(taskService, otherPullTaskKeys, 50, false);
+            execProvisioningTasks(taskService, TaskType.PULL, otherPullTaskKeys, 50, false);
 
             // Matching --> UNLINK
             assertFalse(userService.read("test9").getResources().contains(RESOURCE_NAME_CSV));
@@ -309,7 +310,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void dryRun() {
-        ExecTO execution = execProvisioningTask(taskService, PULL_TASK_KEY, 50, true);
+        ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, PULL_TASK_KEY, 50, true);
         assertEquals("SUCCESS", execution.getStatus());
     }
 
@@ -319,7 +320,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
         try {
             ExecTO execution = execProvisioningTask(
-                    taskService, "83f7e85d-9774-43fe-adba-ccd856312994", 50, false);
+                    taskService, TaskType.PULL, "83f7e85d-9774-43fe-adba-ccd856312994", 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             userTO = userService.read("testuser1");
@@ -332,7 +333,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
             // re-execute the same PullTask: now user must be active
             execution = execProvisioningTask(
-                    taskService, "83f7e85d-9774-43fe-adba-ccd856312994", 50, false);
+                    taskService, TaskType.PULL, "83f7e85d-9774-43fe-adba-ccd856312994", 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             userTO = userService.read("testuser1");
@@ -352,7 +353,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
         ldapCleanup();
 
         // 0. pull
-        ExecTO execution = execProvisioningTask(taskService, "1e419ca4-ea81-4493-a14f-28b90113686d", 50, false);
+        ExecTO execution = execProvisioningTask(
+                taskService, TaskType.PULL, "1e419ca4-ea81-4493-a14f-28b90113686d", 50, false);
 
         // 1. verify execution status
         assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
@@ -365,7 +367,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertNotNull(matchingGroups);
         assertEquals(1, matchingGroups.getResult().size());
         // SYNCOPE-898
-        PullTaskTO task = taskService.read("1e419ca4-ea81-4493-a14f-28b90113686d", false);
+        PullTaskTO task = taskService.read(TaskType.PULL, "1e419ca4-ea81-4493-a14f-28b90113686d", false);
         assertEquals("/", task.getDestinationRealm());
         assertEquals("/", matchingGroups.getResult().get(0).getRealm());
 
@@ -396,7 +398,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertNull(groupTO.getGroupOwner());
 
         // SYNCOPE-317
-        execProvisioningTask(taskService, "1e419ca4-ea81-4493-a14f-28b90113686d", 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, "1e419ca4-ea81-4493-a14f-28b90113686d", 50, false);
 
         // 4. verify that LDAP group membership is propagated as Syncope membership
         int i = 0;
@@ -487,12 +489,12 @@ public class PullTaskITCase extends AbstractTaskITCase {
             }
 
             // ensure that the pull task does not have the DELETE capability (SYNCOPE-923)
-            PullTaskTO pullTask = taskService.read("30cfd653-257b-495f-8665-281281dbcb3d", false);
+            PullTaskTO pullTask = taskService.read(TaskType.PULL, "30cfd653-257b-495f-8665-281281dbcb3d", false);
             assertNotNull(pullTask);
             assertFalse(pullTask.isPerformDelete());
 
             // 4. pull
-            execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
 
             // 5. verify that printer was re-created in Syncope (implies that location does not start with given prefix,
             // hence PrefixItemTransformer was applied during pull)
@@ -535,16 +537,16 @@ public class PullTaskITCase extends AbstractTaskITCase {
             reconFilterBuilder = getObject(response.getLocation(), ImplementationService.class, ImplementationTO.class);
             assertNotNull(reconFilterBuilder);
 
-            task = taskService.read("7c2242f4-14af-4ab5-af31-cdae23783655", true);
+            task = taskService.read(TaskType.PULL, "7c2242f4-14af-4ab5-af31-cdae23783655", true);
             task.setPullMode(PullMode.FILTERED_RECONCILIATION);
             task.setReconFilterBuilder(reconFilterBuilder.getKey());
-            response = taskService.create(task);
+            response = taskService.create(TaskType.PULL, task);
             task = getObject(response.getLocation(), TaskService.class, PullTaskTO.class);
             assertNotNull(task);
             assertEquals(reconFilterBuilder.getKey(), task.getReconFilterBuilder());
 
             // 3. exec task
-            ExecTO execution = execProvisioningTask(taskService, task.getKey(), 50, false);
+            ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, task.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // 4. verify that only enabled user was pulled
@@ -561,7 +563,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             jdbcTemplate.execute("DELETE FROM testpull WHERE id = '" + user1OnTestPull + "'");
             jdbcTemplate.execute("DELETE FROM testpull WHERE id = '" + user2OnTestPull + "'");
             if (task != null && !"7c2242f4-14af-4ab5-af31-cdae23783655".equals(task.getKey())) {
-                taskService.delete(task.getKey());
+                taskService.delete(TaskType.PULL, task.getKey());
             }
             if (userTO != null) {
                 userService.delete(userTO.getKey());
@@ -611,7 +613,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             pullTask.setPerformUpdate(true);
             pullTask.setPerformDelete(true);
 
-            response = taskService.create(pullTask);
+            response = taskService.create(TaskType.PULL, pullTask);
             if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
                 throw (RuntimeException) clientFactory.getExceptionMapper().fromResponse(response);
             }
@@ -626,7 +628,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     + "(1041, 'syncTokenWithErrors2', 'Surname2', "
                     + "false, 'syncTokenWithErrors1@syncope.apache.org', '2015-05-23 13:53:24.293')");
 
-            ExecTO exec = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            ExecTO exec = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
 
             resForTest = resourceService.read(resForTest.getKey());
@@ -636,7 +638,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     + "SET email='syncTokenWithErrors2@syncope.apache.org', lastModification='2016-05-23 13:53:24.293' "
                     + "WHERE ID=1041");
 
-            exec = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            exec = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
 
             resForTest = resourceService.read(resForTest.getKey());
@@ -695,19 +697,19 @@ public class PullTaskITCase extends AbstractTaskITCase {
             //-----------------------------
 
             // Update pull task
-            PullTaskTO task = taskService.read("81d88f73-d474-4450-9031-605daa4e313f", true);
+            PullTaskTO task = taskService.read(TaskType.PULL, "81d88f73-d474-4450-9031-605daa4e313f", true);
             assertNotNull(task);
 
             task.getTemplates().put(AnyTypeKind.USER.name(), template);
 
-            taskService.update(task);
-            PullTaskTO actual = taskService.read(task.getKey(), true);
+            taskService.update(TaskType.PULL, task);
+            PullTaskTO actual = taskService.read(TaskType.PULL, task.getKey(), true);
             assertNotNull(actual);
             assertEquals(task.getKey(), actual.getKey());
             assertFalse(actual.getTemplates().get(AnyTypeKind.USER.name()).getResources().isEmpty());
             assertFalse(((UserTO) actual.getTemplates().get(AnyTypeKind.USER.name())).getMemberships().isEmpty());
 
-            ExecTO execution = execProvisioningTask(taskService, actual.getKey(), 50, false);
+            ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, actual.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             userTO = userService.read("testuser2");
@@ -732,7 +734,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                 + "('" + id + "', 'issuesyncope230', 'Surname', false, 'syncope230@syncope.apache.org', NULL)");
 
         // 2. execute PullTask for resource-db-pull (table TESTPULL on external H2)
-        execProvisioningTask(taskService, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
 
         // 3. read e-mail address for user created by the PullTask first execution
         UserTO userTO = userService.read("issuesyncope230");
@@ -744,7 +746,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         jdbcTemplate.execute("UPDATE TESTPULL SET email='updatedSYNCOPE230@syncope.apache.org' WHERE id='" + id + "'");
 
         // 5. re-execute the PullTask
-        execProvisioningTask(taskService, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, "7c2242f4-14af-4ab5-af31-cdae23783655", 50, false);
 
         // 6. verify that the e-mail was updated
         userTO = userService.read("issuesyncope230");
@@ -777,9 +779,9 @@ public class PullTaskITCase extends AbstractTaskITCase {
         }
         assertNotNull(corrRule);
 
-        PullPolicyTO policyTO = policyService.read("9454b0d7-2610-400a-be82-fc23cf553dd6");
+        PullPolicyTO policyTO = policyService.read(PolicyType.PULL, "9454b0d7-2610-400a-be82-fc23cf553dd6");
         policyTO.getCorrelationRules().put(AnyTypeKind.USER.name(), corrRule.getKey());
-        policyService.update(policyTO);
+        policyService.update(PolicyType.PULL, policyTO);
         // -----------------------------
 
         PullTaskTO task = new PullTaskTO();
@@ -792,7 +794,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         task.setPerformDelete(true);
         task.setPerformUpdate(true);
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.PULL, task);
         task = getObject(response.getLocation(), TaskService.class, PullTaskTO.class);
 
         UserTO userTO = UserITCase.getUniqueSampleTO("s258_1@apache.org");
@@ -814,9 +816,9 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
         userService.update(userPatch);
 
-        execProvisioningTask(taskService, task.getKey(), 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, task.getKey(), 50, false);
 
-        PullTaskTO executed = taskService.read(task.getKey(), true);
+        PullTaskTO executed = taskService.read(TaskType.PULL, task.getKey(), true);
         assertEquals(1, executed.getExecutions().size());
 
         // asser for just one match
@@ -840,7 +842,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
 
             ExecTO taskExecTO = execProvisioningTask(
-                    taskService, "986867e2-993b-430e-8feb-aa9abb4c1dcd", 50, false);
+                    taskService, TaskType.PULL, "986867e2-993b-430e-8feb-aa9abb4c1dcd", 50, false);
 
             assertNotNull(taskExecTO.getStatus());
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(taskExecTO.getStatus()));
@@ -871,7 +873,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertTrue(userTO.getVirAttrs().isEmpty());
 
         // Update pull task
-        PullTaskTO task = taskService.read("38abbf9e-a1a3-40a1-a15f-7d0ac02f47f1", true);
+        PullTaskTO task = taskService.read(TaskType.PULL, "38abbf9e-a1a3-40a1-a15f-7d0ac02f47f1", true);
         assertNotNull(task);
 
         UserTO template = new UserTO();
@@ -881,10 +883,10 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
         task.getTemplates().put(AnyTypeKind.USER.name(), template);
 
-        taskService.update(task);
+        taskService.update(TaskType.PULL, task);
 
         // exec task: one user from CSV will match the user created above and template will be applied
-        execProvisioningTask(taskService, task.getKey(), 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, task.getKey(), 50, false);
 
         // check that template was successfully applied...
         userTO = userService.read(userTO.getKey());
@@ -937,17 +939,17 @@ public class PullTaskITCase extends AbstractTaskITCase {
         pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
         pullTask.setResource(RESOURCE_NAME_TESTDB);
         pullTask.getActions().add(pullActions.getKey());
-        Response taskResponse = taskService.create(pullTask);
+        Response taskResponse = taskService.create(TaskType.PULL, pullTask);
 
         PullTaskTO actual = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
         assertNotNull(actual);
 
-        pullTask = taskService.read(actual.getKey(), true);
+        pullTask = taskService.read(TaskType.PULL, actual.getKey(), true);
         assertNotNull(pullTask);
         assertEquals(actual.getKey(), pullTask.getKey());
         assertEquals(actual.getJobDelegate(), pullTask.getJobDelegate());
 
-        ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+        ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
         assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
         // 5. Test the pulled user
@@ -955,7 +957,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertNotNull(self);
 
         // 6. Delete PullTask + user
-        taskService.delete(pullTask.getKey());
+        taskService.delete(TaskType.PULL, pullTask.getKey());
         deleteUser(user.getKey());
     }
 
@@ -1026,12 +1028,12 @@ public class PullTaskITCase extends AbstractTaskITCase {
             pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
             pullTask.setResource(RESOURCE_NAME_LDAP);
             pullTask.getActions().add(pullActions.getKey());
-            Response taskResponse = taskService.create(pullTask);
+            Response taskResponse = taskService.create(TaskType.PULL, pullTask);
 
             pullTask = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
             assertNotNull(pullTask);
 
-            ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // 7. Test the pulled user
@@ -1042,7 +1044,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
         } finally {
             // Delete PullTask + user + reset the connector
             if (pullTask != null) {
-                taskService.delete(pullTask.getKey());
+                taskService.delete(TaskType.PULL, pullTask.getKey());
             }
 
             if (resourceConnector != null && property != null) {
@@ -1085,13 +1087,13 @@ public class PullTaskITCase extends AbstractTaskITCase {
             template.getPlainAttrs().add(attrTO("firstname", "'fixed'"));
             pullTask.getTemplates().put(AnyTypeKind.USER.name(), template);
 
-            Response taskResponse = taskService.create(pullTask);
+            Response taskResponse = taskService.create(TaskType.PULL, pullTask);
             pullTask = getObject(taskResponse.getLocation(), TaskService.class, PullTaskTO.class);
             assertNotNull(pullTask);
             assertFalse(pullTask.getTemplates().isEmpty());
 
             // 3. exec the pull task
-            ExecTO execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            ExecTO execution = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // the user is successfully pulled...
@@ -1127,7 +1129,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             assertEquals("pullFromLDAP2@syncope.apache.org", connObject.getAttr("mail").get().getValues().get(0));
 
             // 5. exec the pull task again
-            execution = execProvisioningTask(taskService, pullTask.getKey(), 50, false);
+            execution = execProvisioningTask(taskService, TaskType.PULL, pullTask.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(execution.getStatus()));
 
             // the internal is updated...
@@ -1145,7 +1147,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             fail(e.getMessage());
         } finally {
             if (pullTask != null) {
-                taskService.delete(pullTask.getKey());
+                taskService.delete(TaskType.PULL, pullTask.getKey());
             }
 
             if (propagationGroup != null) {


[2/7] syncope git commit: [SYNCOPE-1274] Using Swagger annotations for TO hierarchies

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index 80ec8d1..f6af472 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -36,7 +36,7 @@ import org.apache.syncope.client.enduser.annotations.Resource;
 import org.apache.syncope.client.enduser.model.CustomAttribute;
 import org.apache.syncope.client.enduser.model.CustomAttributesInfo;
 import org.apache.syncope.client.enduser.model.SchemaResponse;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.TypeExtensionTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.SchemaType;
@@ -91,8 +91,8 @@ public class SchemaResource extends BaseResource {
             Map<String, CustomAttributesInfo> customForm = SyncopeEnduserApplication.get().getCustomForm();
 
             SchemaService schemaService = SyncopeEnduserSession.get().getService(SchemaService.class);
-            final List<AbstractSchemaTO> plainSchemas = classes.isEmpty()
-                    ? Collections.<AbstractSchemaTO>emptyList()
+            final List<SchemaTO> plainSchemas = classes.isEmpty()
+                    ? Collections.<SchemaTO>emptyList()
                     : customForm == null || customForm.isEmpty() || customForm.get(SchemaType.PLAIN.name()) == null
                     ? schemaService.list(
                             new SchemaQuery.Builder().type(SchemaType.PLAIN).anyTypeClasses(classes).build())
@@ -100,9 +100,9 @@ public class SchemaResource extends BaseResource {
                     ? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.PLAIN).
                             anyTypeClasses(classes).build()), group, customForm.get(SchemaType.PLAIN.name()).
                             getAttributes())
-                    : Collections.<AbstractSchemaTO>emptyList();
-            final List<AbstractSchemaTO> derSchemas = classes.isEmpty()
-                    ? Collections.<AbstractSchemaTO>emptyList()
+                    : Collections.<SchemaTO>emptyList();
+            final List<SchemaTO> derSchemas = classes.isEmpty()
+                    ? Collections.<SchemaTO>emptyList()
                     : customForm == null || customForm.isEmpty() || customForm.get(SchemaType.DERIVED.name()) == null
                     ? schemaService.list(
                             new SchemaQuery.Builder().type(SchemaType.DERIVED).anyTypeClasses(classes).build())
@@ -110,9 +110,9 @@ public class SchemaResource extends BaseResource {
                     ? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.DERIVED).
                             anyTypeClasses(classes).build()), group, customForm.get(SchemaType.DERIVED.name()).
                             getAttributes())
-                    : Collections.<AbstractSchemaTO>emptyList();
-            final List<AbstractSchemaTO> virSchemas = classes.isEmpty()
-                    ? Collections.<AbstractSchemaTO>emptyList()
+                    : Collections.<SchemaTO>emptyList();
+            final List<SchemaTO> virSchemas = classes.isEmpty()
+                    ? Collections.<SchemaTO>emptyList()
                     : customForm == null || customForm.isEmpty() || customForm.get(SchemaType.VIRTUAL.name()) == null
                     ? schemaService.list(
                             new SchemaQuery.Builder().type(SchemaType.VIRTUAL).anyTypeClasses(classes).build())
@@ -120,7 +120,7 @@ public class SchemaResource extends BaseResource {
                     ? customizeSchemas(schemaService.list(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).
                             anyTypeClasses(classes).build()), group, customForm.get(SchemaType.VIRTUAL.name()).
                             getAttributes())
-                    : Collections.<AbstractSchemaTO>emptyList();
+                    : Collections.<SchemaTO>emptyList();
 
             if (group != null) {
                 plainSchemas.forEach(schema -> {
@@ -158,8 +158,8 @@ public class SchemaResource extends BaseResource {
         return response;
     }
 
-    private List<AbstractSchemaTO> customizeSchemas(
-            final List<AbstractSchemaTO> schemaTOs,
+    private List<SchemaTO> customizeSchemas(
+            final List<SchemaTO> schemaTOs,
             final String groupParam,
             final Map<String, CustomAttribute> customForm) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
index c4105e8..8186c4f 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
@@ -34,7 +34,7 @@ import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.staxutils.DocumentDepthProperties;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.rest.api.DateParamConverterProvider;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 
@@ -102,7 +102,7 @@ public class SyncopeClientFactoryBean {
         defaultJAXBProvider.setMarshallerProperties(marshallerProperties);
 
         Map<String, String> collectionWrapperMap = new HashMap<>();
-        collectionWrapperMap.put(AbstractPolicyTO.class.getName(), "policies");
+        collectionWrapperMap.put(PolicyTO.class.getName(), "policies");
         defaultJAXBProvider.setCollectionWrapperMap(collectionWrapperMap);
 
         return defaultJAXBProvider;

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/pom.xml
----------------------------------------------------------------------
diff --git a/common/lib/pom.xml b/common/lib/pom.xml
index f24f60a..82d5c72 100644
--- a/common/lib/pom.xml
+++ b/common/lib/pom.xml
@@ -49,6 +49,11 @@ under the License.
     </dependency>
 
     <dependency>
+      <groupId>io.swagger.core.v3</groupId>
+      <artifactId>swagger-annotations</artifactId>
+    </dependency>      
+
+    <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-annotations</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
index 432b766..4562f70 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.to.GroupTO;
@@ -33,7 +33,7 @@ import org.apache.syncope.common.lib.to.UserTO;
 
 @XmlType
 // Reporting here only classes used via PagedResult
-@XmlSeeAlso({ AbstractTaskTO.class, ReportTO.class, GroupTO.class, UserTO.class, AnyObjectTO.class })
+@XmlSeeAlso({ TaskTO.class, ReportTO.class, GroupTO.class, UserTO.class, AnyObjectTO.class })
 public abstract class AbstractBaseBean implements Serializable {
 
     private static final long serialVersionUID = 3119542005279892164L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java
index ee86a88..6f72065 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java
@@ -18,6 +18,8 @@
  */
 package org.apache.syncope.common.lib.patch;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
 
@@ -39,6 +41,8 @@ public abstract class AbstractPatchItem<T> extends AbstractPatch {
 
     private T value;
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public T getValue() {
         return value;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java
index 75298a9..9a37cae 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.common.lib.patch;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashSet;
 import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
@@ -38,6 +39,13 @@ public class AnyObjectPatch extends AnyPatch {
 
     private final Set<MembershipPatch> memberships = new HashSet<>();
 
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.patch.AnyObjectPatch")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public StringReplacePatchItem getName() {
         return name;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
index 0dadbf8..136c8ce 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
@@ -20,20 +20,33 @@ package org.apache.syncope.common.lib.patch;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.PathParam;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.AbstractBaseBean;
 import org.apache.syncope.common.lib.to.AttrTO;
 
 @XmlType
+@XmlSeeAlso({ UserPatch.class, GroupPatch.class, AnyObjectPatch.class })
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
+@JsonPropertyOrder(value = { "@class", "key" })
+@Schema(subTypes = { UserPatch.class, GroupPatch.class, AnyObjectPatch.class }, discriminatorProperty = "@class")
 public abstract class AnyPatch extends AbstractBaseBean implements AttributablePatch {
 
     private static final long serialVersionUID = -7445489774552440544L;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    private String discriminator;
+
     private String key;
 
     private StringReplacePatchItem realm;
@@ -46,6 +59,15 @@ public abstract class AnyPatch extends AbstractBaseBean implements AttributableP
 
     private final Set<StringPatchItem> resources = new HashSet<>();
 
+    @Schema(name = "@class", required = true, readOnly = false)
+    public abstract String getDiscriminator();
+
+    public void setDiscriminator(final String discriminator) {
+        // do nothing
+    }
+
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getKey() {
         return key;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java
index 553711c..0ddddfb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.patch;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -52,6 +53,13 @@ public class GroupPatch extends AnyPatch {
 
     private final List<TypeExtensionTO> typeExtensions = new ArrayList<>();
 
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.patch.GroupPatch")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public StringReplacePatchItem getName() {
         return name;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java
index 5dc50f1..c9e7038 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.common.lib.patch;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashSet;
 import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
@@ -48,6 +49,13 @@ public class UserPatch extends AnyPatch {
 
     private final Set<StringPatchItem> roles = new HashSet<>();
 
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.patch.UserPatch")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public StringReplacePatchItem getUsername() {
         return username;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPolicyTO.java
deleted file mode 100644
index bc41628..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPolicyTO.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.lib.policy;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ws.rs.PathParam;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.to.EntityTO;
-
-@XmlRootElement(name = "abstractPolicy")
-@XmlType
-@XmlSeeAlso({ AccountPolicyTO.class, PasswordPolicyTO.class, PullPolicyTO.class })
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public abstract class AbstractPolicyTO extends AbstractBaseBean implements EntityTO {
-
-    private static final long serialVersionUID = -2903888572649721035L;
-
-    private String key;
-
-    private String description;
-
-    private final List<String> usedByResources = new ArrayList<>();
-
-    private final List<String> usedByRealms = new ArrayList<>();
-
-    @Override
-    public String getKey() {
-        return key;
-    }
-
-    @PathParam("key")
-    @Override
-    public void setKey(final String key) {
-        this.key = key;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @XmlElementWrapper(name = "usedByResources")
-    @XmlElement(name = "resource")
-    @JsonProperty("usedByResources")
-    public List<String> getUsedByResources() {
-        return usedByResources;
-    }
-
-    @XmlElementWrapper(name = "usedByRealms")
-    @XmlElement(name = "group")
-    @JsonProperty("usedByRealms")
-    public List<String> getUsedByRealms() {
-        return usedByRealms;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
index 7811c00..bf05ea3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
@@ -19,16 +19,18 @@
 package org.apache.syncope.common.lib.policy;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "accountPolicy")
 @XmlType
-public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolicy {
+public class AccountPolicyTO extends PolicyTO implements ComposablePolicy {
 
     private static final long serialVersionUID = -1557150042828800134L;
 
@@ -40,6 +42,14 @@ public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolic
 
     private final List<String> passthroughResources = new ArrayList<>();
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.policy.AccountPolicyTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public boolean isPropagateSuspension() {
         return propagateSuspension;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
index fd7d55c..9f71072 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
@@ -19,16 +19,18 @@
 package org.apache.syncope.common.lib.policy;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "passwordPolicy")
 @XmlType
-public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePolicy {
+public class PasswordPolicyTO extends PolicyTO implements ComposablePolicy {
 
     private static final long serialVersionUID = -5606086441294799690L;
 
@@ -38,6 +40,14 @@ public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePoli
 
     private final List<String> rules = new ArrayList<>();
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.policy.PasswordPolicyTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public boolean isAllowNullPassword() {
         return allowNullPassword;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
new file mode 100644
index 0000000..f8ef978
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
@@ -0,0 +1,106 @@
+/*
+ * 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.lib.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.to.EntityTO;
+
+@XmlRootElement(name = "policy")
+@XmlType
+@XmlSeeAlso({ AccountPolicyTO.class, PasswordPolicyTO.class, PullPolicyTO.class })
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
+@JsonPropertyOrder(value = { "@class", "key", "description" })
+@Schema(
+        subTypes = { AccountPolicyTO.class, PasswordPolicyTO.class, PullPolicyTO.class },
+        discriminatorProperty = "@class")
+public abstract class PolicyTO extends AbstractBaseBean implements EntityTO {
+
+    private static final long serialVersionUID = -2903888572649721035L;
+
+    @XmlTransient
+    @JsonProperty("@class")
+    private String discriminator;
+
+    private String key;
+
+    private String description;
+
+    private final List<String> usedByResources = new ArrayList<>();
+
+    private final List<String> usedByRealms = new ArrayList<>();
+
+    @Schema(name = "@class", required = true, readOnly = false)
+    public abstract String getDiscriminator();
+
+    public void setDiscriminator(final String discriminator) {
+        // do nothing
+    }
+
+    @Schema(readOnly = true)
+    @Override
+    public String getKey() {
+        return key;
+    }
+
+    @PathParam("key")
+    @Override
+    public void setKey(final String key) {
+        this.key = key;
+    }
+
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    @Schema(readOnly = true)
+    @XmlElementWrapper(name = "usedByResources")
+    @XmlElement(name = "resource")
+    @JsonProperty("usedByResources")
+    public List<String> getUsedByResources() {
+        return usedByResources;
+    }
+
+    @Schema(readOnly = true)
+    @XmlElementWrapper(name = "usedByRealms")
+    @XmlElement(name = "group")
+    @JsonProperty("usedByRealms")
+    public List<String> getUsedByRealms() {
+        return usedByRealms;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
index 3ecdbf2..6ac847a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
@@ -19,9 +19,11 @@
 package org.apache.syncope.common.lib.policy;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
@@ -29,12 +31,20 @@ import org.apache.syncope.common.lib.types.ConflictResolutionAction;
 
 @XmlRootElement(name = "pullPolicy")
 @XmlType
-public class PullPolicyTO extends AbstractPolicyTO {
+public class PullPolicyTO extends PolicyTO {
 
     private static final long serialVersionUID = 993024634238024242L;
 
     private ConflictResolutionAction conflictResolutionAction;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.policy.PullPolicyTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
     private final Map<String, String> correlationRules = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
index 1459211..b9b71ba 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractAnnotatedBean.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import org.apache.syncope.common.lib.AbstractBaseBean;
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.Date;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.lang3.StringUtils;
@@ -64,6 +65,7 @@ public class AbstractAnnotatedBean extends AbstractBaseBean {
      */
     private Date lastChangeDate;
 
+    @Schema(readOnly = true)
     public String getCreator() {
         return creator;
     }
@@ -72,6 +74,7 @@ public class AbstractAnnotatedBean extends AbstractBaseBean {
         this.creator = creator;
     }
 
+    @Schema(readOnly = true)
     public Date getCreationDate() {
         if (creationDate != null) {
             return new Date(creationDate.getTime());
@@ -87,6 +90,7 @@ public class AbstractAnnotatedBean extends AbstractBaseBean {
         }
     }
 
+    @Schema(readOnly = true)
     public String getLastModifier() {
         return lastModifier;
     }
@@ -95,6 +99,7 @@ public class AbstractAnnotatedBean extends AbstractBaseBean {
         this.lastModifier = lastModifier;
     }
 
+    @Schema(readOnly = true)
     public Date getLastChangeDate() {
         if (lastChangeDate != null) {
             return new Date(lastChangeDate.getTime());

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
deleted file mode 100644
index 14637ee..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.lib.to;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.types.MatchingRule;
-import org.apache.syncope.common.lib.types.UnmatchingRule;
-
-@XmlRootElement(name = "abstractProvisioningTask")
-@XmlType
-@XmlSeeAlso({ PushTaskTO.class, PullTaskTO.class })
-public class AbstractProvisioningTaskTO extends SchedTaskTO {
-
-    private static final long serialVersionUID = -2143537546915809016L;
-
-    private String resource;
-
-    private boolean performCreate;
-
-    private boolean performUpdate;
-
-    private boolean performDelete;
-
-    private boolean syncStatus;
-
-    private UnmatchingRule unmatchingRule;
-
-    private MatchingRule matchingRule;
-
-    private final List<String> actions = new ArrayList<>();
-
-    public String getResource() {
-        return resource;
-    }
-
-    public void setResource(final String resource) {
-        this.resource = resource;
-    }
-
-    public boolean isPerformCreate() {
-        return performCreate;
-    }
-
-    public void setPerformCreate(final boolean performCreate) {
-        this.performCreate = performCreate;
-    }
-
-    public boolean isPerformUpdate() {
-        return performUpdate;
-    }
-
-    public void setPerformUpdate(final boolean performUpdate) {
-        this.performUpdate = performUpdate;
-    }
-
-    public boolean isPerformDelete() {
-        return performDelete;
-    }
-
-    public void setPerformDelete(final boolean performDelete) {
-        this.performDelete = performDelete;
-    }
-
-    public boolean isSyncStatus() {
-        return syncStatus;
-    }
-
-    public void setSyncStatus(final boolean syncStatus) {
-        this.syncStatus = syncStatus;
-    }
-
-    @XmlElementWrapper(name = "actions")
-    @XmlElement(name = "action")
-    @JsonProperty("actions")
-    public List<String> getActions() {
-        return actions;
-    }
-
-    public UnmatchingRule getUnmatchingRule() {
-        return unmatchingRule;
-    }
-
-    public void setUnmatchingRule(final UnmatchingRule unmatchigRule) {
-        this.unmatchingRule = unmatchigRule;
-    }
-
-    public MatchingRule getMatchingRule() {
-        return matchingRule;
-    }
-
-    public void setMatchingRule(final MatchingRule matchigRule) {
-        this.matchingRule = matchigRule;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java
deleted file mode 100644
index 2917c98..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.lib.to;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import javax.ws.rs.PathParam;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-
-@XmlRootElement(name = "abstractSchema")
-@XmlType
-@XmlSeeAlso({ PlainSchemaTO.class, DerSchemaTO.class, VirSchemaTO.class })
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public abstract class AbstractSchemaTO extends AbstractBaseBean implements EntityTO {
-
-    private static final long serialVersionUID = 4088388951694301759L;
-
-    private String key;
-
-    private String anyTypeClass;
-
-    @Override
-    public String getKey() {
-        return key;
-    }
-
-    @PathParam("key")
-    @Override
-    public void setKey(final String key) {
-        this.key = key;
-    }
-
-    public String getAnyTypeClass() {
-        return anyTypeClass;
-    }
-
-    public void setAnyTypeClass(final String anyTypeClass) {
-        this.anyTypeClass = anyTypeClass;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
index 88962c5..9a65fa3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.Date;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.AbstractBaseBean;
@@ -31,6 +32,7 @@ public class AbstractStartEndBean extends AbstractBaseBean {
 
     private Date end;
 
+    @Schema(readOnly = true)
     public Date getStart() {
         return start == null
                 ? null
@@ -43,6 +45,7 @@ public class AbstractStartEndBean extends AbstractBaseBean {
                 : new Date(start.getTime());
     }
 
+    @Schema(readOnly = true)
     public Date getEnd() {
         return end == null
                 ? null

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
deleted file mode 100644
index 65603f7..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractTaskTO.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.lib.to;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.ws.rs.PathParam;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "abstractTask")
-@XmlType
-@XmlSeeAlso({ PropagationTaskTO.class, SchedTaskTO.class, NotificationTaskTO.class })
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public abstract class AbstractTaskTO extends AbstractStartEndBean implements EntityTO {
-
-    private static final long serialVersionUID = 386450127003321197L;
-
-    private String key;
-
-    private String latestExecStatus;
-
-    private final List<ExecTO> executions = new ArrayList<>();
-
-    @Override
-    public String getKey() {
-        return key;
-    }
-
-    @PathParam("key")
-    @Override
-    public void setKey(final String key) {
-        this.key = key;
-    }
-
-    public String getLatestExecStatus() {
-        return latestExecStatus;
-    }
-
-    public void setLatestExecStatus(final String latestExecStatus) {
-        this.latestExecStatus = latestExecStatus;
-    }
-
-    @XmlElementWrapper(name = "executions")
-    @XmlElement(name = "execution")
-    @JsonProperty("executions")
-    public List<ExecTO> getExecutions() {
-        return executions;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
index 61d8eb1..61c7173 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
@@ -20,12 +20,14 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "anyObject")
@@ -42,6 +44,14 @@ public class AnyObjectTO extends AnyTO implements GroupableRelatableTO {
 
     private final List<MembershipTO> dynMemberships = new ArrayList<>();
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.AnyObjectTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public String getName() {
         return name;
     }
@@ -80,6 +90,7 @@ public class AnyObjectTO extends AnyTO implements GroupableRelatableTO {
         return memberships;
     }
 
+    @Schema(readOnly = true)
     @XmlElementWrapper(name = "dynMemberships")
     @XmlElement(name = "dynMembership")
     @JsonProperty("dynMemberships")

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
index e411e1a..b29c6e4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
@@ -20,7 +20,9 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -29,15 +31,22 @@ import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlType
 @XmlSeeAlso({ UserTO.class, GroupTO.class, AnyObjectTO.class })
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
+@JsonPropertyOrder(value = { "@class", "key", "type", "realm", "username", "name" })
+@Schema(subTypes = { UserTO.class, GroupTO.class, AnyObjectTO.class }, discriminatorProperty = "@class")
 public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, AttributableTO {
 
     private static final long serialVersionUID = -754311920679872084L;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    private String discriminator;
+
     private String key;
 
     private String type;
@@ -58,6 +67,14 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
 
     private final Set<String> resources = new HashSet<>();
 
+    @Schema(name = "@class", required = true, readOnly = false)
+    public abstract String getDiscriminator();
+
+    public void setDiscriminator(final String discriminator) {
+        // do nothing
+    }
+
+    @Schema(readOnly = true)
     @Override
     public String getKey() {
         return key;
@@ -68,6 +85,7 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
         this.key = key;
     }
 
+    @Schema(readOnly = true)
     public String getType() {
         return type;
     }
@@ -84,6 +102,7 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
         this.realm = realm;
     }
 
+    @Schema(readOnly = true)
     @XmlElementWrapper(name = "dynRealms")
     @XmlElement(name = "dynRealmF")
     @JsonProperty("dynRealms")
@@ -91,6 +110,7 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
         return dynRealms;
     }
 
+    @Schema(readOnly = true)
     public String getStatus() {
         return status;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
index bd63527..82a47da 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import org.apache.syncope.common.lib.AbstractBaseBean;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -45,7 +46,7 @@ public class AttrTO extends AbstractBaseBean {
             return this;
         }
 
-        public Builder schemaInfo(final AbstractSchemaTO schemaInfo) {
+        public Builder schemaInfo(final SchemaTO schemaInfo) {
             instance.schemaInfo = schemaInfo;
             return this;
         }
@@ -73,7 +74,7 @@ public class AttrTO extends AbstractBaseBean {
     /**
      * (Optional) schema information for this attribute.
      */
-    private AbstractSchemaTO schemaInfo;
+    private SchemaTO schemaInfo;
 
     /**
      * Name of the schema that this attribute is referring to.
@@ -88,17 +89,20 @@ public class AttrTO extends AbstractBaseBean {
     /**
      * @return schema information for this attribute; may be {@code NULL}
      */
-    public AbstractSchemaTO getSchemaInfo() {
+    @Schema(readOnly = true)
+    public SchemaTO getSchemaInfo() {
         return schemaInfo;
     }
 
-    public void setSchemaInfo(final AbstractSchemaTO schemaInfo) {
+    public void setSchemaInfo(final SchemaTO schemaInfo) {
         this.schemaInfo = schemaInfo;
     }
 
     /**
      * @return the name of the schema that this attribute is referring to
      */
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getSchema() {
         return schema;
     }
@@ -115,9 +119,9 @@ public class AttrTO extends AbstractBaseBean {
     /**
      * @return attribute values as strings
      */
-    @XmlElementWrapper(name = "values")
-    @XmlElement(name = "value")
-    @JsonProperty("values")
+    @XmlElementWrapper(name = "values", required = true)
+    @XmlElement(name = "value", required = true)
+    @JsonProperty(value = "values", required = true)
     public List<String> getValues() {
         return values;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/DerSchemaTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/DerSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/DerSchemaTO.java
index dc84864..d2242b5 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/DerSchemaTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/DerSchemaTO.java
@@ -18,17 +18,28 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
-@XmlRootElement(name = "derivedSchema")
+@XmlRootElement(name = "derSchema")
 @XmlType
-public class DerSchemaTO extends AbstractSchemaTO {
+public class DerSchemaTO extends SchemaTO {
 
     private static final long serialVersionUID = -6747399803792103108L;
 
     private String expression;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.DerSchemaTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public String getExpression() {
         return expression;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
index 3f0b163..e1de0d7 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -28,6 +29,7 @@ import java.util.Optional;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
@@ -60,6 +62,14 @@ public class GroupTO extends AnyTO {
 
     private final List<TypeExtensionTO> typeExtensions = new ArrayList<>();
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.GroupTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     @Override
     public String getType() {
         return AnyTypeKind.GROUP.name();
@@ -102,6 +112,7 @@ public class GroupTO extends AnyTO {
         this.udynMembershipCond = uDynMembershipCond;
     }
 
+    @Schema(readOnly = true)
     public int getStaticUserMembershipCount() {
         return staticUserMembershipCount;
     }
@@ -110,6 +121,7 @@ public class GroupTO extends AnyTO {
         this.staticUserMembershipCount = staticUserMembershipCount;
     }
 
+    @Schema(readOnly = true)
     public int getDynamicUserMembershipCount() {
         return dynamicUserMembershipCount;
     }
@@ -118,6 +130,7 @@ public class GroupTO extends AnyTO {
         this.dynamicUserMembershipCount = dynamicUserMembershipCount;
     }
 
+    @Schema(readOnly = true)
     public int getStaticAnyObjectMembershipCount() {
         return staticAnyObjectMembershipCount;
     }
@@ -126,6 +139,7 @@ public class GroupTO extends AnyTO {
         this.staticAnyObjectMembershipCount = staticAnyObjectMembershipCount;
     }
 
+    @Schema(readOnly = true)
     public int getDynamicAnyObjectMembershipCount() {
         return dynamicAnyObjectMembershipCount;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
index 44155e4..0f6b4f1 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTaskTO.java
@@ -19,18 +19,20 @@
 package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashSet;
 import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.TraceLevel;
 
 @XmlRootElement(name = "notificationTask")
 @XmlType
-public class NotificationTaskTO extends AbstractTaskTO {
+public class NotificationTaskTO extends TaskTO {
 
     private static final long serialVersionUID = 371671242591093846L;
 
@@ -54,6 +56,15 @@ public class NotificationTaskTO extends AbstractTaskTO {
 
     private TraceLevel traceLevel;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.NotificationTaskTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
+    @Schema(readOnly = true)
     public String getNotification() {
         return notification;
     }
@@ -62,6 +73,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.notification = notification;
     }
 
+    @Schema(readOnly = true)
     public AnyTypeKind getAnyTypeKind() {
         return anyTypeKind;
     }
@@ -70,6 +82,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.anyTypeKind = anyTypeKind;
     }
 
+    @Schema(readOnly = true)
     public String getEntityKey() {
         return entityKey;
     }
@@ -78,6 +91,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.entityKey = entityKey;
     }
 
+    @Schema(readOnly = true)
     @XmlElementWrapper(name = "recipients")
     @XmlElement(name = "recipient")
     @JsonProperty("recipients")
@@ -85,6 +99,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         return recipients;
     }
 
+    @Schema(readOnly = true)
     public String getSender() {
         return sender;
     }
@@ -93,6 +108,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.sender = sender;
     }
 
+    @Schema(readOnly = true)
     public String getSubject() {
         return subject;
     }
@@ -101,6 +117,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.subject = subject;
     }
 
+    @Schema(readOnly = true)
     public String getTextBody() {
         return textBody;
     }
@@ -109,6 +126,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.textBody = textBody;
     }
 
+    @Schema(readOnly = true)
     public String getHtmlBody() {
         return htmlBody;
     }
@@ -117,6 +135,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.htmlBody = htmlBody;
     }
 
+    @Schema(readOnly = true)
     public boolean isExecuted() {
         return executed;
     }
@@ -125,6 +144,7 @@ public class NotificationTaskTO extends AbstractTaskTO {
         this.executed = executed;
     }
 
+    @Schema(readOnly = true)
     public TraceLevel getTraceLevel() {
         return traceLevel;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/PlainSchemaTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PlainSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PlainSchemaTO.java
index fc17702..2eba6f6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PlainSchemaTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PlainSchemaTO.java
@@ -18,16 +18,19 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
 
-@XmlRootElement(name = "schema")
+@XmlRootElement(name = "plainSchema")
 @XmlType
-public class PlainSchemaTO extends AbstractSchemaTO {
+public class PlainSchemaTO extends SchemaTO {
 
     private static final long serialVersionUID = -8133983392476990308L;
 
@@ -55,6 +58,14 @@ public class PlainSchemaTO extends AbstractSchemaTO {
 
     private String mimeType;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.PlainSchemaTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public String getConversionPattern() {
         return conversionPattern;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
index 3ef94de..66f804e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
@@ -18,14 +18,18 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ResourceOperation;
 
 @XmlRootElement(name = "propagationTask")
 @XmlType
-public class PropagationTaskTO extends AbstractTaskTO {
+public class PropagationTaskTO extends TaskTO {
 
     private static final long serialVersionUID = 386450127003321197L;
 
@@ -47,6 +51,16 @@ public class PropagationTaskTO extends AbstractTaskTO {
 
     private String entityKey;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.PropagationTaskTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getConnObjectKey() {
         return connObjectKey;
     }
@@ -63,6 +77,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.oldConnObjectKey = oldConnObjectKey;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getResource() {
         return resource;
     }
@@ -71,6 +87,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.resource = resource;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public ResourceOperation getOperation() {
         return operation;
     }
@@ -79,6 +97,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.operation = operation;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getAttributes() {
         return attributes;
     }
@@ -87,6 +107,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.attributes = attributes;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getObjectClassName() {
         return objectClassName;
     }
@@ -95,6 +117,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.objectClassName = objectClassName;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public AnyTypeKind getAnyTypeKind() {
         return anyTypeKind;
     }
@@ -103,6 +127,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.anyTypeKind = anyTypeKind;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getAnyType() {
         return anyType;
     }
@@ -111,6 +137,8 @@ public class PropagationTaskTO extends AbstractTaskTO {
         this.anyType = anyType;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getEntityKey() {
         return entityKey;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningTaskTO.java
new file mode 100644
index 0000000..c152190
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningTaskTO.java
@@ -0,0 +1,122 @@
+/*
+ * 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.lib.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.types.MatchingRule;
+import org.apache.syncope.common.lib.types.UnmatchingRule;
+
+@XmlRootElement(name = "provisioningTask")
+@XmlType
+@XmlSeeAlso({ PushTaskTO.class, PullTaskTO.class })
+@Schema(subTypes = { PushTaskTO.class, PullTaskTO.class }, discriminatorProperty = "@class")
+public abstract class ProvisioningTaskTO extends SchedTaskTO {
+
+    private static final long serialVersionUID = -5722284116974636425L;
+
+    private String resource;
+
+    private boolean performCreate;
+
+    private boolean performUpdate;
+
+    private boolean performDelete;
+
+    private boolean syncStatus;
+
+    private UnmatchingRule unmatchingRule;
+
+    private MatchingRule matchingRule;
+
+    private final List<String> actions = new ArrayList<>();
+
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
+    public String getResource() {
+        return resource;
+    }
+
+    public void setResource(final String resource) {
+        this.resource = resource;
+    }
+
+    public boolean isPerformCreate() {
+        return performCreate;
+    }
+
+    public void setPerformCreate(final boolean performCreate) {
+        this.performCreate = performCreate;
+    }
+
+    public boolean isPerformUpdate() {
+        return performUpdate;
+    }
+
+    public void setPerformUpdate(final boolean performUpdate) {
+        this.performUpdate = performUpdate;
+    }
+
+    public boolean isPerformDelete() {
+        return performDelete;
+    }
+
+    public void setPerformDelete(final boolean performDelete) {
+        this.performDelete = performDelete;
+    }
+
+    public boolean isSyncStatus() {
+        return syncStatus;
+    }
+
+    public void setSyncStatus(final boolean syncStatus) {
+        this.syncStatus = syncStatus;
+    }
+
+    @XmlElementWrapper(name = "actions")
+    @XmlElement(name = "action")
+    @JsonProperty("actions")
+    public List<String> getActions() {
+        return actions;
+    }
+
+    public UnmatchingRule getUnmatchingRule() {
+        return unmatchingRule;
+    }
+
+    public void setUnmatchingRule(final UnmatchingRule unmatchigRule) {
+        this.unmatchingRule = unmatchigRule;
+    }
+
+    public MatchingRule getMatchingRule() {
+        return matchingRule;
+    }
+
+    public void setMatchingRule(final MatchingRule matchigRule) {
+        this.matchingRule = matchigRule;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/PullTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PullTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PullTaskTO.java
index 08edaf2..16e578d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PullTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PullTaskTO.java
@@ -19,11 +19,14 @@
 package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
@@ -32,16 +35,28 @@ import org.apache.syncope.common.lib.types.PullMode;
 @XmlRootElement(name = "pullTask")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-public class PullTaskTO extends AbstractProvisioningTaskTO implements TemplatableTO {
+public class PullTaskTO extends ProvisioningTaskTO implements TemplatableTO {
 
     private static final long serialVersionUID = -2143537546915809017L;
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     private PullMode pullMode;
 
     private String reconFilterBuilder;
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     private String destinationRealm;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.PullTaskTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
     private final Map<String, AnyTO> templates = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
index 7dfc623..2dc02c1 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
@@ -19,11 +19,14 @@
 package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
@@ -31,15 +34,25 @@ import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 @XmlRootElement(name = "pushTask")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-public class PushTaskTO extends AbstractProvisioningTaskTO {
+public class PushTaskTO extends ProvisioningTaskTO {
 
     private static final long serialVersionUID = -2143537546915809018L;
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     private String sourceRealm;
 
     @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
     private final Map<String, String> filters = new HashMap<>();
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.PushTaskTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public String getSourceRealm() {
         return sourceRealm;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
index e6c0697..d903ad3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchedTaskTO.java
@@ -18,16 +18,20 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.Date;
-
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "schedTask")
 @XmlType
-@XmlSeeAlso(AbstractProvisioningTaskTO.class)
-public class SchedTaskTO extends AbstractTaskTO {
+@XmlSeeAlso({ ProvisioningTaskTO.class })
+@Schema(subTypes = { ProvisioningTaskTO.class }, discriminatorProperty = "@class")
+public class SchedTaskTO extends TaskTO {
 
     private static final long serialVersionUID = -5722284116974636425L;
 
@@ -47,6 +51,14 @@ public class SchedTaskTO extends AbstractTaskTO {
 
     private boolean active = true;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.SchedTaskTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public Date getStartAt() {
         return startAt == null ? null : new Date(startAt.getTime());
     }
@@ -71,6 +83,7 @@ public class SchedTaskTO extends AbstractTaskTO {
         this.jobDelegate = jobDelegate;
     }
 
+    @Schema(readOnly = true)
     public Date getLastExec() {
         return lastExec == null ? null : new Date(lastExec.getTime());
     }
@@ -79,6 +92,7 @@ public class SchedTaskTO extends AbstractTaskTO {
         this.lastExec = lastExec == null ? null : new Date(lastExec.getTime());
     }
 
+    @Schema(readOnly = true)
     public Date getNextExec() {
         return nextExec == null ? null : new Date(nextExec.getTime());
     }
@@ -99,6 +113,8 @@ public class SchedTaskTO extends AbstractTaskTO {
         return name;
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public void setName(final String name) {
         this.name = name;
     }
@@ -110,5 +126,4 @@ public class SchedTaskTO extends AbstractTaskTO {
     public void setActive(final boolean active) {
         this.active = active;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchemaTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchemaTO.java
new file mode 100644
index 0000000..99b5768
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SchemaTO.java
@@ -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.lib.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlRootElement(name = "schema")
+@XmlType
+@XmlSeeAlso({ PlainSchemaTO.class, DerSchemaTO.class, VirSchemaTO.class })
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
+@JsonPropertyOrder(value = { "@class", "key" })
+@Schema(subTypes = { PlainSchemaTO.class, DerSchemaTO.class, VirSchemaTO.class }, discriminatorProperty = "@class")
+public abstract class SchemaTO extends AbstractBaseBean implements EntityTO {
+
+    private static final long serialVersionUID = 4088388951694301759L;
+
+    @XmlTransient
+    @JsonProperty("@class")
+    private String discriminator;
+
+    private String key;
+
+    private String anyTypeClass;
+
+    @Schema(name = "@class", required = true, readOnly = false)
+    public abstract String getDiscriminator();
+
+    public void setDiscriminator(final String discriminator) {
+        // do nothing
+    }
+
+    @Override
+    public String getKey() {
+        return key;
+    }
+
+    @PathParam("key")
+    @Override
+    public void setKey(final String key) {
+        this.key = key;
+    }
+
+    public String getAnyTypeClass() {
+        return anyTypeClass;
+    }
+
+    public void setAnyTypeClass(final String anyTypeClass) {
+        this.anyTypeClass = anyTypeClass;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskTO.java
new file mode 100644
index 0000000..4b175b3
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskTO.java
@@ -0,0 +1,92 @@
+/*
+ * 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.lib.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "task")
+@XmlType
+@XmlSeeAlso({ PropagationTaskTO.class, ProvisioningTaskTO.class, NotificationTaskTO.class })
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
+@JsonPropertyOrder(value = { "@class", "key" })
+@Schema(
+        subTypes = { PropagationTaskTO.class, ProvisioningTaskTO.class, NotificationTaskTO.class },
+        discriminatorProperty = "@class")
+public abstract class TaskTO extends AbstractStartEndBean implements EntityTO {
+
+    private static final long serialVersionUID = 386450127003321197L;
+
+    @XmlTransient
+    @JsonProperty("@class")
+    private String discriminator;
+
+    private String key;
+
+    private String latestExecStatus;
+
+    private final List<ExecTO> executions = new ArrayList<>();
+
+    @Schema(name = "@class", required = true, readOnly = false)
+    public abstract String getDiscriminator();
+
+    public void setDiscriminator(final String discriminator) {
+        // do nothing
+    }
+
+    @Schema(readOnly = true)
+    @Override
+    public String getKey() {
+        return key;
+    }
+
+    @PathParam("key")
+    @Override
+    public void setKey(final String key) {
+        this.key = key;
+    }
+
+    @Schema(readOnly = true)
+    public String getLatestExecStatus() {
+        return latestExecStatus;
+    }
+
+    public void setLatestExecStatus(final String latestExecStatus) {
+        this.latestExecStatus = latestExecStatus;
+    }
+
+    @Schema(readOnly = true)
+    @XmlElementWrapper(name = "executions")
+    @XmlElement(name = "execution")
+    @JsonProperty("executions")
+    public List<ExecTO> getExecutions() {
+        return executions;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index d518f0e..79d5c12 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -70,6 +71,13 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
 
     private final List<MembershipTO> dynMemberships = new ArrayList<>();
 
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.UserTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     @Override
     public String getType() {
         return AnyTypeKind.USER.name();
@@ -95,6 +103,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         return roles;
     }
 
+    @Schema(readOnly = true)
     @XmlElementWrapper(name = "dynRoles")
     @XmlElement(name = "role")
     @JsonProperty("dynRoles")
@@ -102,6 +111,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         return dynRoles;
     }
 
+    @Schema(readOnly = true)
     public String getToken() {
         return token;
     }
@@ -110,6 +120,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         this.token = token;
     }
 
+    @Schema(readOnly = true)
     public Date getTokenExpireTime() {
         if (tokenExpireTime != null) {
             return new Date(tokenExpireTime.getTime());
@@ -125,6 +136,8 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         }
     }
 
+    @JsonProperty(required = true)
+    @XmlElement(required = true)
     public String getUsername() {
         return username;
     }
@@ -133,6 +146,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         this.username = username;
     }
 
+    @Schema(readOnly = true)
     public Date getChangePwdDate() {
         if (changePwdDate != null) {
             return new Date(changePwdDate.getTime());
@@ -140,10 +154,12 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         return null;
     }
 
+    @Schema(readOnly = true)
     public Integer getFailedLogins() {
         return failedLogins;
     }
 
+    @Schema(readOnly = true)
     public Date getLastLoginDate() {
         if (lastLoginDate != null) {
             return new Date(lastLoginDate.getTime());
@@ -187,6 +203,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         this.securityAnswer = securityAnswer;
     }
 
+    @Schema(readOnly = true)
     public boolean isSuspended() {
         return suspended;
     }
@@ -195,6 +212,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         this.suspended = suspended;
     }
 
+    @Schema(readOnly = true)
     public boolean isMustChangePassword() {
         return mustChangePassword;
     }
@@ -233,6 +251,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         return memberships;
     }
 
+    @Schema(readOnly = true)
     @XmlElementWrapper(name = "dynMemberships")
     @XmlElement(name = "dynMembership")
     @JsonProperty("dynMemberships")

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java
index 1f10e6b..df7121b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java
@@ -18,10 +18,13 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 
-@XmlRootElement(name = "virtualSchema")
-public class VirSchemaTO extends AbstractSchemaTO {
+@XmlRootElement(name = "virSchema")
+public class VirSchemaTO extends SchemaTO {
 
     private static final long serialVersionUID = -8198557479659701343L;
 
@@ -33,6 +36,14 @@ public class VirSchemaTO extends AbstractSchemaTO {
 
     private String extAttrName;
 
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.VirSchemaTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+
     public boolean isReadonly() {
         return readonly;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
index 673666d..82f17ee 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.common.lib.types;
 
 import javax.xml.bind.annotation.XmlEnum;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.VirSchemaTO;
@@ -40,17 +40,17 @@ public enum SchemaType {
      */
     VIRTUAL(VirSchemaTO.class);
 
-    private final Class<? extends AbstractSchemaTO> toClass;
+    private final Class<? extends SchemaTO> toClass;
 
-    SchemaType(final Class<? extends AbstractSchemaTO> toClass) {
+    SchemaType(final Class<? extends SchemaTO> toClass) {
         this.toClass = toClass;
     }
 
-    public Class<? extends AbstractSchemaTO> getToClass() {
+    public Class<? extends SchemaTO> getToClass() {
         return toClass;
     }
 
-    public static SchemaType fromToClass(final Class<? extends AbstractSchemaTO> toClass) {
+    public static SchemaType fromToClass(final Class<? extends SchemaTO> toClass) {
         SchemaType schemaType = null;
 
         if (PlainSchemaTO.class.equals(toClass)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/common/rest-api/pom.xml
----------------------------------------------------------------------
diff --git a/common/rest-api/pom.xml b/common/rest-api/pom.xml
index 5e1a137..fb073e8 100644
--- a/common/rest-api/pom.xml
+++ b/common/rest-api/pom.xml
@@ -47,11 +47,6 @@ under the License.
       <groupId>javax.ws.rs</groupId>
       <artifactId>javax.ws.rs-api</artifactId>
     </dependency>
-    
-    <dependency>
-      <groupId>io.swagger.core.v3</groupId>
-      <artifactId>swagger-annotations</artifactId>
-    </dependency>      
 
     <dependency>
       <groupId>org.apache.syncope.common</groupId>


[3/7] syncope git commit: [SYNCOPE-1274] Using Swagger annotations for TO hierarchies

Posted by il...@apache.org.
[SYNCOPE-1274] Using Swagger annotations for TO hierarchies


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

Branch: refs/heads/master
Commit: 0e93bec6c37c9d8a2d0b1d69613e8173cd49726e
Parents: dd638b2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Feb 12 17:29:13 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 13 15:44:06 2018 +0100

----------------------------------------------------------------------
 .../client/cli/commands/policy/PolicyRead.java  |   4 +-
 .../commands/policy/PolicyResultManager.java    |   6 +-
 .../policy/PolicySyncopeOperations.java         |   6 +-
 .../client/cli/commands/schema/SchemaRead.java  |   4 +-
 .../commands/schema/SchemaResultManager.java    |  12 +-
 .../schema/SchemaSyncopeOperations.java         |  12 +-
 .../cli/commands/task/TaskDeleteAllProp.java    |   4 +-
 .../client/cli/commands/task/TaskDetails.java   |  16 +--
 .../client/cli/commands/task/TaskRead.java      |   4 +-
 .../cli/commands/task/TaskResultManager.java    |  13 +-
 .../commands/task/TaskSyncopeOperations.java    |   8 +-
 .../console/commons/TaskDataProvider.java       |   4 +-
 .../panels/AbstractSchemaDetailsPanel.java      |   8 +-
 .../client/console/panels/BeanPanel.java        |  22 +---
 .../console/panels/PlainSchemaDetails.java      |   4 +-
 .../client/console/panels/SchemaModalPanel.java |  16 +--
 .../client/console/panels/SchemaTypePanel.java  |  40 +++---
 .../client/console/panels/TogglePanel.java      |  12 +-
 .../console/policies/PolicyDirectoryPanel.java  |  12 +-
 .../policies/PolicyModalPanelBuilder.java       |   4 +-
 .../policies/PolicyRuleDirectoryPanel.java      |   4 +-
 .../policies/PolicyRuleWizardBuilder.java       |   4 +-
 .../client/console/rest/PolicyRestClient.java   |  14 +--
 .../client/console/rest/SchemaRestClient.java   |  12 +-
 .../client/console/rest/TaskRestClient.java     |   8 +-
 .../tasks/ProvisioningTaskDirectoryPanel.java   |   6 +-
 .../console/tasks/SchedTaskWizardBuilder.java   |   4 +-
 .../console/tasks/TaskDirectoryPanel.java       |   6 +-
 .../console/tasks/TaskExecutionDetails.java     |   4 +-
 .../html/form/ActionLinksTogglePanel.java       |  12 +-
 .../client/console/widgets/JobWidget.java       |   5 +-
 .../console/wizards/any/AbstractAttrs.java      |   4 +-
 .../resources/ResourceSecurityPanel.java        |   9 +-
 .../client/enduser/model/SchemaResponse.java    |  26 ++--
 .../enduser/resources/SchemaResource.java       |  24 ++--
 .../client/lib/SyncopeClientFactoryBean.java    |   4 +-
 common/lib/pom.xml                              |   5 +
 .../syncope/common/lib/AbstractBaseBean.java    |   4 +-
 .../common/lib/patch/AbstractPatchItem.java     |   4 +
 .../common/lib/patch/AnyObjectPatch.java        |   8 ++
 .../syncope/common/lib/patch/AnyPatch.java      |  22 ++++
 .../syncope/common/lib/patch/GroupPatch.java    |   8 ++
 .../syncope/common/lib/patch/UserPatch.java     |   8 ++
 .../common/lib/policy/AbstractPolicyTO.java     |  83 -------------
 .../common/lib/policy/AccountPolicyTO.java      |  12 +-
 .../common/lib/policy/PasswordPolicyTO.java     |  12 +-
 .../syncope/common/lib/policy/PolicyTO.java     | 106 ++++++++++++++++
 .../syncope/common/lib/policy/PullPolicyTO.java |  12 +-
 .../common/lib/to/AbstractAnnotatedBean.java    |   5 +
 .../lib/to/AbstractProvisioningTaskTO.java      | 117 ------------------
 .../syncope/common/lib/to/AbstractSchemaTO.java |  59 ---------
 .../common/lib/to/AbstractStartEndBean.java     |   3 +
 .../syncope/common/lib/to/AbstractTaskTO.java   |  72 -----------
 .../syncope/common/lib/to/AnyObjectTO.java      |  11 ++
 .../org/apache/syncope/common/lib/to/AnyTO.java |  22 +++-
 .../apache/syncope/common/lib/to/AttrTO.java    |  18 +--
 .../syncope/common/lib/to/DerSchemaTO.java      |  15 ++-
 .../apache/syncope/common/lib/to/GroupTO.java   |  14 +++
 .../common/lib/to/NotificationTaskTO.java       |  22 +++-
 .../syncope/common/lib/to/PlainSchemaTO.java    |  15 ++-
 .../common/lib/to/PropagationTaskTO.java        |  30 ++++-
 .../common/lib/to/ProvisioningTaskTO.java       | 122 +++++++++++++++++++
 .../syncope/common/lib/to/PullTaskTO.java       |  17 ++-
 .../syncope/common/lib/to/PushTaskTO.java       |  15 ++-
 .../syncope/common/lib/to/SchedTaskTO.java      |  23 +++-
 .../apache/syncope/common/lib/to/SchemaTO.java  |  76 ++++++++++++
 .../apache/syncope/common/lib/to/TaskTO.java    |  92 ++++++++++++++
 .../apache/syncope/common/lib/to/UserTO.java    |  19 +++
 .../syncope/common/lib/to/VirSchemaTO.java      |  15 ++-
 .../syncope/common/lib/types/SchemaType.java    |  10 +-
 common/rest-api/pom.xml                         |   5 -
 .../common/rest/api/service/PolicyService.java  |  10 +-
 .../common/rest/api/service/SchemaService.java  |  10 +-
 .../common/rest/api/service/TaskService.java    |   8 +-
 .../apache/syncope/core/logic/PolicyLogic.java  |  20 +--
 .../apache/syncope/core/logic/SchemaLogic.java  |  20 +--
 .../apache/syncope/core/logic/TaskLogic.java    |  16 +--
 .../persistence/api/entity/task/TaskUtils.java  |   6 +-
 .../api/entity/task/TaskUtilsFactory.java       |   6 +-
 .../jpa/entity/task/JPATaskUtils.java           |   6 +-
 .../jpa/entity/task/JPATaskUtilsFactory.java    |   6 +-
 .../provisioning/api/data/PolicyDataBinder.java |   8 +-
 .../provisioning/api/data/TaskDataBinder.java   |   4 +-
 .../java/data/PolicyDataBinderImpl.java         |  10 +-
 .../java/data/TaskDataBinderImpl.java           |  18 +--
 .../rest/cxf/service/PolicyServiceImpl.java     |  12 +-
 .../rest/cxf/service/SchemaServiceImpl.java     |  12 +-
 .../core/rest/cxf/service/TaskServiceImpl.java  |   8 +-
 .../src/main/resources/restCXFContext.xml       |   2 +-
 .../src/main/resources/jboss/restCXFContext.xml |   2 +-
 .../org/apache/syncope/fit/AbstractITCase.java  |   8 +-
 .../syncope/fit/core/AbstractTaskITCase.java    |   4 +-
 .../syncope/fit/core/PropagationTaskITCase.java |  12 +-
 .../apache/syncope/fit/core/PullTaskITCase.java |   4 +-
 94 files changed, 992 insertions(+), 658 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
index c33cba8..5b50a69 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
@@ -23,7 +23,7 @@ import java.util.List;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,7 +41,7 @@ public class PolicyRead extends AbstractPolicyCommand {
 
     public void read() {
         if (input.parameterNumber() >= 1) {
-            final List<AbstractPolicyTO> policyTOs = new ArrayList<>();
+            final List<PolicyTO> policyTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
                     policyTOs.add(policySyncopeOperations.read(parameter));

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
index 4bdba0d..70d373d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.cli.commands.policy;
 import java.util.List;
 import java.util.Map;
 import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.policy.AccountPolicyTO;
 import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
@@ -29,7 +29,7 @@ import org.apache.syncope.common.lib.types.PolicyType;
 
 public class PolicyResultManager extends CommonsResultManager {
 
-    public void printPolicies(final List<AbstractPolicyTO> policyTOs) {
+    public void printPolicies(final List<PolicyTO> policyTOs) {
         System.out.println("");
         policyTOs.forEach(policyTO -> {
             if (policyTO instanceof AccountPolicyTO) {
@@ -42,7 +42,7 @@ public class PolicyResultManager extends CommonsResultManager {
         });
     }
 
-    public void printPoliciesByType(final String policyTypeString, final List<AbstractPolicyTO> policyTOs) {
+    public void printPoliciesByType(final String policyTypeString, final List<PolicyTO> policyTOs) {
         System.out.println("");
         final PolicyType policyType = PolicyType.valueOf(policyTypeString);
         switch (policyType) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
index 127818b..9bfad75 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.cli.commands.policy;
 
 import java.util.List;
 import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.service.PolicyService;
 
@@ -28,11 +28,11 @@ public class PolicySyncopeOperations {
 
     private final PolicyService policyService = SyncopeServices.get(PolicyService.class);
 
-    public <T extends AbstractPolicyTO> T read(final String policyKey) {
+    public <T extends PolicyTO> T read(final String policyKey) {
         return policyService.read(policyKey);
     }
 
-    public <T extends AbstractPolicyTO> List<T> list(final String policyType) {
+    public <T extends PolicyTO> List<T> list(final String policyType) {
         return policyService.list(PolicyType.valueOf(policyType));
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
index 0f99ed7..96cd5cc 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
@@ -25,7 +25,7 @@ import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@ public class SchemaRead extends AbstractSchemaCommand {
         if (input.parameterNumber() >= 2) {
             final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
             try {
-                final List<AbstractSchemaTO> schemaTOs = new ArrayList<>();
+                final List<SchemaTO> schemaTOs = new ArrayList<>();
                 for (final String parameter : parameters) {
                     schemaTOs.add(schemaSyncopeOperations.read(input.firstParameter(), parameter));
                 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
index 4da9446..546e673 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
@@ -23,7 +23,7 @@ import java.util.List;
 import java.util.Map;
 import org.apache.syncope.client.cli.commands.CommonsResultManager;
 import org.apache.syncope.client.cli.view.Table;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.VirSchemaTO;
@@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.types.SchemaType;
 
 public class SchemaResultManager extends CommonsResultManager {
 
-    public void toView(final String schemaTypeString, final List<? extends AbstractSchemaTO> schemaTOs) {
+    public void toView(final String schemaTypeString, final List<? extends SchemaTO> schemaTOs) {
         switch (SchemaType.valueOf(schemaTypeString)) {
             case PLAIN:
                 printPlainSchemasDetailed(schemaTOs);
@@ -47,7 +47,7 @@ public class SchemaResultManager extends CommonsResultManager {
         }
     }
 
-    private void printPlainSchemasDetailed(final List<? extends AbstractSchemaTO> schemaTOs) {
+    private void printPlainSchemasDetailed(final List<? extends SchemaTO> schemaTOs) {
         System.out.println("");
         schemaTOs.forEach(schemaTO -> {
             printPlanSchemaDetailed((PlainSchemaTO) schemaTO);
@@ -67,7 +67,7 @@ public class SchemaResultManager extends CommonsResultManager {
         System.out.println("");
     }
 
-    public void printPlainSchemas(final List<? extends AbstractSchemaTO> schemaTOs) {
+    public void printPlainSchemas(final List<? extends SchemaTO> schemaTOs) {
         final Table.TableBuilder tableBuilder =
                 new Table.TableBuilder("plain schemas").header("schema key").header("type").header("mandatory");
         schemaTOs.forEach(schemaTO -> {
@@ -79,7 +79,7 @@ public class SchemaResultManager extends CommonsResultManager {
         tableBuilder.build().print();
     }
 
-    public void fromListDerived(final List<? extends AbstractSchemaTO> schemaTOs) {
+    public void fromListDerived(final List<? extends SchemaTO> schemaTOs) {
         final Table.TableBuilder tableBuilder =
                 new Table.TableBuilder("derived schemas").header("schema key").header("expression");
         schemaTOs.forEach(schemaTO -> {
@@ -90,7 +90,7 @@ public class SchemaResultManager extends CommonsResultManager {
         tableBuilder.build().print();
     }
 
-    public void fromListVirtual(final List<? extends AbstractSchemaTO> schemaTOs) {
+    public void fromListVirtual(final List<? extends SchemaTO> schemaTOs) {
         final Table.TableBuilder tableBuilder =
                 new Table.TableBuilder("virtual schemas").header("schema key").header("readonly");
         schemaTOs.forEach(schemaTO -> {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
index 92f9bf3..79cb89a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.cli.commands.schema;
 
 import java.util.List;
 import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.rest.api.beans.SchemaQuery;
 import org.apache.syncope.common.rest.api.service.SchemaService;
@@ -29,23 +29,23 @@ public class SchemaSyncopeOperations {
 
     private final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
 
-    public <T extends AbstractSchemaTO> T read(final String schemaTypeString, final String schemaName) {
+    public <T extends SchemaTO> T read(final String schemaTypeString, final String schemaName) {
         return schemaService.read(SchemaType.valueOf(schemaTypeString), schemaName);
     }
 
-    public <T extends AbstractSchemaTO> List<T> list(final String schemaTypeString) {
+    public <T extends SchemaTO> List<T> list(final String schemaTypeString) {
         return schemaService.list(new SchemaQuery.Builder().type(SchemaType.valueOf(schemaTypeString)).build());
     }
 
-    public <T extends AbstractSchemaTO> List<T> listPlain() {
+    public <T extends SchemaTO> List<T> listPlain() {
         return schemaService.list(new SchemaQuery.Builder().type(SchemaType.PLAIN).build());
     }
 
-    public <T extends AbstractSchemaTO> List<T> listDerived() {
+    public <T extends SchemaTO> List<T> listDerived() {
         return schemaService.list(new SchemaQuery.Builder().type(SchemaType.DERIVED).build());
     }
 
-    public <T extends AbstractSchemaTO> List<T> listVirtual() {
+    public <T extends SchemaTO> List<T> listVirtual() {
         return schemaService.list(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).build());
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDeleteAllProp.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDeleteAllProp.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDeleteAllProp.java
index 4f41428..7d1660b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDeleteAllProp.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDeleteAllProp.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.cli.commands.task;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,7 +40,7 @@ public class TaskDeleteAllProp extends AbstractTaskCommand {
     public void delete() {
 
         if (input.parameterNumber() == 0) {
-            for (final AbstractTaskTO taskTO : taskSyncopeOperations.listPropagationTask()) {
+            for (final TaskTO taskTO : taskSyncopeOperations.listPropagationTask()) {
                 final String taskId = String.valueOf(taskTO.getKey());
                 try {
                     taskSyncopeOperations.delete(taskId);

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
index 4e87566..03bebdd 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
@@ -24,13 +24,13 @@ import java.util.Map;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.client.cli.util.CommandUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.types.PullMode;
 import org.apache.syncope.common.lib.types.TaskType;
 import org.slf4j.Logger;
@@ -52,12 +52,12 @@ public class TaskDetails extends AbstractTaskCommand {
         if (input.parameterNumber() == 0) {
             try {
                 final Map<String, String> details = new LinkedHashMap<>();
-                final List<AbstractTaskTO> notificationTaskTOs =
+                final List<TaskTO> notificationTaskTOs =
                         taskSyncopeOperations.list(TaskType.NOTIFICATION.name());
-                final List<AbstractTaskTO> propagationTaskTOs = taskSyncopeOperations.list(TaskType.PROPAGATION.name());
-                final List<AbstractTaskTO> pushTaskTOs = taskSyncopeOperations.list(TaskType.PUSH.name());
-                final List<AbstractTaskTO> scheduledTaskTOs = taskSyncopeOperations.list(TaskType.SCHEDULED.name());
-                final List<AbstractTaskTO> pullTaskTOs = taskSyncopeOperations.list(TaskType.PULL.name());
+                final List<TaskTO> propagationTaskTOs = taskSyncopeOperations.list(TaskType.PROPAGATION.name());
+                final List<TaskTO> pushTaskTOs = taskSyncopeOperations.list(TaskType.PUSH.name());
+                final List<TaskTO> scheduledTaskTOs = taskSyncopeOperations.list(TaskType.SCHEDULED.name());
+                final List<TaskTO> pullTaskTOs = taskSyncopeOperations.list(TaskType.PULL.name());
                 final List<JobTO> jobTOs = taskSyncopeOperations.listJobs();
                 final int notificationTaskSize = notificationTaskTOs.size();
                 final int propagationTaskSize = propagationTaskTOs.size();
@@ -84,7 +84,7 @@ public class TaskDetails extends AbstractTaskCommand {
 
                 int pullNotExecuted = 0;
                 int pullFull = 0;
-                for (final AbstractTaskTO pullTaskTO : pullTaskTOs) {
+                for (final TaskTO pullTaskTO : pullTaskTOs) {
                     if (((PullTaskTO) pullTaskTO).getExecutions().isEmpty()) {
                         pullNotExecuted++;
                     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
index 14ebc30..0c05681 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
@@ -23,7 +23,7 @@ import java.util.List;
 import javax.xml.ws.WebServiceException;
 import org.apache.syncope.client.cli.Input;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,7 +41,7 @@ public class TaskRead extends AbstractTaskCommand {
 
     public void read() {
         if (input.parameterNumber() >= 1) {
-            final List<AbstractTaskTO> taskTOs = new ArrayList<>();
+            final List<TaskTO> taskTOs = new ArrayList<>();
             for (final String parameter : input.getParameters()) {
                 try {
                     taskTOs.add(taskSyncopeOperations.read(parameter));

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
index d811edc..6794a18 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
@@ -21,20 +21,21 @@ package org.apache.syncope.client.cli.commands.task;
 import java.util.List;
 import java.util.Map;
 import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
 
 public class TaskResultManager extends CommonsResultManager {
 
-    public void printTasks(final List<AbstractTaskTO> taskTOs) {
+    public void printTasks(final List<TaskTO> taskTOs) {
         System.out.println("");
         taskTOs.forEach(taskTO -> {
             if (taskTO instanceof NotificationTaskTO) {
@@ -43,15 +44,15 @@ public class TaskResultManager extends CommonsResultManager {
                 printPropagationTask((PropagationTaskTO) taskTO);
             } else if (taskTO instanceof PushTaskTO) {
                 printPushTask((PushTaskTO) taskTO);
-            } else if (taskTO instanceof SchedTaskTO) {
-                printScheduledTask((SchedTaskTO) taskTO);
+            } else if (taskTO instanceof ProvisioningTaskTO) {
+                printScheduledTask((ProvisioningTaskTO) taskTO);
             } else if (taskTO instanceof PullTaskTO) {
                 printPullTask((PullTaskTO) taskTO);
             }
         });
     }
 
-    public void printTasksType(final String taskTypeString, final List<AbstractTaskTO> taskTOs) {
+    public void printTasksType(final String taskTypeString, final List<TaskTO> taskTOs) {
         System.out.println("");
         switch (TaskType.valueOf(taskTypeString)) {
             case NOTIFICATION:

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
index 7ac8593..ad94a4f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.cli.commands.task;
 
 import java.util.List;
 import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.types.TaskType;
@@ -36,7 +36,7 @@ public class TaskSyncopeOperations {
         return taskService.listJobs();
     }
 
-    public <T extends AbstractTaskTO> T read(final String taskKey) {
+    public <T extends TaskTO> T read(final String taskKey) {
         return taskService.read(taskKey, true);
     }
 
@@ -44,11 +44,11 @@ public class TaskSyncopeOperations {
         taskService.delete(taskKey);
     }
 
-    public List<AbstractTaskTO> list(final String type) {
+    public List<TaskTO> list(final String type) {
         return taskService.list(new TaskQuery.Builder(TaskType.valueOf(type)).build()).getResult();
     }
 
-    public List<AbstractTaskTO> listPropagationTask() {
+    public List<TaskTO> listPropagationTask() {
         return taskService.list(new TaskQuery.Builder(TaskType.PROPAGATION).build()).getResult();
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/commons/TaskDataProvider.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/TaskDataProvider.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/TaskDataProvider.java
index 46312cb..50f6fe7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/TaskDataProvider.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/TaskDataProvider.java
@@ -18,13 +18,13 @@
  */
 package org.apache.syncope.client.console.commons;
 
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.IModel;
 
-public abstract class TaskDataProvider<T extends AbstractTaskTO> extends DirectoryDataProvider<T> {
+public abstract class TaskDataProvider<T extends TaskTO> extends DirectoryDataProvider<T> {
 
     private static final long serialVersionUID = -20112718133295756L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
index 36fb95a..ff39d88 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.client.console.panels;
 
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.panel.Panel;
@@ -36,14 +36,14 @@ public abstract class AbstractSchemaDetailsPanel extends Panel {
 
     protected static final String FORM = "form";
 
-    protected final Form<AbstractSchemaTO> schemaForm;
+    protected final Form<SchemaTO> schemaForm;
 
-    protected final AbstractSchemaTO schemaTO;
+    protected final SchemaTO schemaTO;
 
     public AbstractSchemaDetailsPanel(
             final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final SchemaTO schemaTO) {
         super(id);
 
         this.schemaTO = schemaTO;

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
index cc8d75d..e38bfc6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
@@ -48,8 +48,8 @@ import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.Schema;
 import org.apache.syncope.common.lib.report.SearchCondition;
 import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.EntityTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.list.ListItem;
@@ -66,8 +66,6 @@ import org.springframework.beans.BeanWrapper;
 import org.springframework.beans.PropertyAccessorFactory;
 import org.springframework.util.ClassUtils;
 import org.springframework.util.ReflectionUtils;
-import org.springframework.util.ReflectionUtils.FieldCallback;
-import org.springframework.util.ReflectionUtils.FieldFilter;
 
 public class BeanPanel<T extends Serializable> extends Panel {
 
@@ -106,19 +104,9 @@ public class BeanPanel<T extends Serializable> extends Panel {
                 final List<String> result = new ArrayList<>();
 
                 if (BeanPanel.this.getDefaultModelObject() != null) {
-                    ReflectionUtils.doWithFields(BeanPanel.this.getDefaultModelObject().getClass(),
-                            new FieldCallback() {
-
-                        public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException {
-                            result.add(field.getName());
-                        }
-
-                    }, new FieldFilter() {
-
-                        public boolean matches(final Field field) {
-                            return !BeanPanel.this.excluded.contains(field.getName());
-                        }
-                    });
+                    ReflectionUtils.doWithFields(BeanPanel.this.getDefaultModelObject().getClass(), field -> {
+                        result.add(field.getName());
+                    }, field -> !BeanPanel.this.excluded.contains(field.getName()));
                 }
                 return result;
             }
@@ -191,7 +179,7 @@ public class BeanPanel<T extends Serializable> extends Panel {
                     if (listItemType.equals(String.class) && schemaAnnot != null) {
                         SchemaRestClient schemaRestClient = new SchemaRestClient();
 
-                        final List<AbstractSchemaTO> choices = new ArrayList<>();
+                        final List<SchemaTO> choices = new ArrayList<>();
 
                         for (SchemaType type : schemaAnnot.type()) {
                             switch (type) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
index c249397..aefc565 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
@@ -37,8 +37,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPan
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.EntityTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
@@ -300,7 +300,7 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
 
     }
 
-    private void showHide(final AbstractSchemaTO schema, final AjaxDropDownChoicePanel<AttrSchemaType> type,
+    private void showHide(final SchemaTO schema, final AjaxDropDownChoicePanel<AttrSchemaType> type,
             final WebMarkupContainer conversionParams, final AjaxTextFieldPanel conversionPattern,
             final WebMarkupContainer enumParams, final AjaxTextFieldPanel enumerationValuesPanel,
             final MultiFieldPanel<String> enumerationValues, final MultiFieldPanel<String> enumerationKeys,

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
index 9c00fd2..8cb1817 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.console.panels;
 import java.util.Arrays;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.VirSchemaTO;
@@ -30,17 +30,17 @@ import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.Model;
 
-public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
+public class SchemaModalPanel extends AbstractModalPanel<SchemaTO> {
 
     private static final long serialVersionUID = -4681998932778822125L;
 
     private final AbstractSchemaDetailsPanel schemaPanel;
 
-    private final AbstractSchemaTO schemaTO;
+    private final SchemaTO schemaTO;
 
     public SchemaModalPanel(
-            final BaseModal<AbstractSchemaTO> modal,
-            final AbstractSchemaTO schemaTO,
+            final BaseModal<SchemaTO> modal,
+            final SchemaTO schemaTO,
             final PageReference pageRef) {
         super(modal, pageRef);
 
@@ -64,13 +64,13 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
     }
 
     private AbstractSchemaDetailsPanel getSchemaPanel(final String id,
-            final SchemaType schemaType, final BaseModal<AbstractSchemaTO> modal) {
+            final SchemaType schemaType, final BaseModal<SchemaTO> modal) {
         final AbstractSchemaDetailsPanel panel;
 
         if (schemaTO.getKey() != null) {
             try {
-                final Class<? extends AbstractSchemaTO> schemaTOClass = schemaType.getToClass();
-                modal.setFormModel((AbstractSchemaTO) schemaTOClass.newInstance());
+                final Class<? extends SchemaTO> schemaTOClass = schemaType.getToClass();
+                modal.setFormModel((SchemaTO) schemaTOClass.newInstance());
             } catch (InstantiationException | IllegalAccessException ex) {
                 LOG.error("SchemaType not found", ex);
             }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
index c4596e6..862c761 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -42,7 +42,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
 import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
@@ -59,7 +59,7 @@ import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
 import org.springframework.util.ReflectionUtils;
 
-public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, SchemaProvider, SchemaRestClient> {
+public class SchemaTypePanel extends TypesDirectoryPanel<SchemaTO, SchemaProvider, SchemaRestClient> {
 
     private static final long serialVersionUID = 3905038169553185171L;
 
@@ -88,15 +88,15 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
 
         try {
             this.addNewItemPanelBuilder(
-                    new AbstractModalPanelBuilder<AbstractSchemaTO>(schemaType.getToClass().newInstance(), pageRef) {
+                    new AbstractModalPanelBuilder<SchemaTO>(schemaType.getToClass().newInstance(), pageRef) {
 
                 private static final long serialVersionUID = -6388405037134399367L;
 
                 @Override
-                public WizardModalPanel<AbstractSchemaTO> build(
+                public WizardModalPanel<SchemaTO> build(
                         final String id, final int index, final AjaxWizard.Mode mode) {
 
-                    final AbstractSchemaTO modelObject = newModelObject();
+                    final SchemaTO modelObject = newModelObject();
                     return new SchemaModalPanel(modal, modelObject, pageRef) {
 
                         private static final long serialVersionUID = -6227956682141146095L;
@@ -147,8 +147,8 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
     }
 
     @Override
-    protected List<IColumn<AbstractSchemaTO, String>> getColumns() {
-        final List<IColumn<AbstractSchemaTO, String>> columns = new ArrayList<>();
+    protected List<IColumn<SchemaTO, String>> getColumns() {
+        final List<IColumn<SchemaTO, String>> columns = new ArrayList<>();
 
         for (final String field : COL_NAMES.get(schemaType)) {
             final Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field);
@@ -157,7 +157,7 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
                 if (clazzField.getType().equals(Boolean.class) || clazzField.getType().equals(boolean.class)) {
                     columns.add(new BooleanPropertyColumn<>(new ResourceModel(field), field, field));
                 } else {
-                    final IColumn<AbstractSchemaTO, String> column = new PropertyColumn<AbstractSchemaTO, String>(
+                    final IColumn<SchemaTO, String> column = new PropertyColumn<SchemaTO, String>(
                             new ResourceModel(field), field, field) {
 
                         private static final long serialVersionUID = 3282547854226892169L;
@@ -182,24 +182,24 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
     }
 
     @Override
-    public ActionsPanel<AbstractSchemaTO> getActions(final IModel<AbstractSchemaTO> model) {
-        final ActionsPanel<AbstractSchemaTO> panel = super.getActions(model);
-        panel.add(new ActionLink<AbstractSchemaTO>() {
+    public ActionsPanel<SchemaTO> getActions(final IModel<SchemaTO> model) {
+        final ActionsPanel<SchemaTO> panel = super.getActions(model);
+        panel.add(new ActionLink<SchemaTO>() {
 
             private static final long serialVersionUID = -3722207913631435501L;
 
             @Override
-            public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
+            public void onClick(final AjaxRequestTarget target, final SchemaTO ignore) {
                 send(SchemaTypePanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
             }
         }, ActionLink.ActionType.EDIT, StandardEntitlement.SCHEMA_UPDATE);
-        panel.add(new ActionLink<AbstractSchemaTO>() {
+        panel.add(new ActionLink<SchemaTO>() {
 
             private static final long serialVersionUID = -3722207913631435501L;
 
             @Override
-            public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
+            public void onClick(final AjaxRequestTarget target, final SchemaTO ignore) {
                 try {
                     switch (schemaType) {
                         case DERIVED:
@@ -229,11 +229,11 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
         return panel;
     }
 
-    protected final class SchemaProvider extends DirectoryDataProvider<AbstractSchemaTO> {
+    protected final class SchemaProvider extends DirectoryDataProvider<SchemaTO> {
 
         private static final long serialVersionUID = -185944053385660794L;
 
-        private final SortableDataProviderComparator<AbstractSchemaTO> comparator;
+        private final SortableDataProviderComparator<SchemaTO> comparator;
 
         private final SchemaType schemaType;
 
@@ -248,15 +248,15 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
         }
 
         @Override
-        public Iterator<AbstractSchemaTO> iterator(final long first, final long count) {
-            final List<AbstractSchemaTO> list = restClient.getSchemas(this.schemaType);
+        public Iterator<SchemaTO> iterator(final long first, final long count) {
+            final List<SchemaTO> list = restClient.getSchemas(this.schemaType);
             Collections.sort(list, comparator);
 
             if (SchemaType.PLAIN == this.schemaType) {
                 final List<String> configurations = confRestClient.list().stream().
                         map(AttrTO::getSchema).collect(Collectors.toList());
 
-                final List<AbstractSchemaTO> res = new ArrayList<>();
+                final List<SchemaTO> res = new ArrayList<>();
                 list.stream().
                         filter(item -> !configurations.contains(item.getKey())).
                         forEachOrdered(item -> {
@@ -277,7 +277,7 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
         }
 
         @Override
-        public IModel<AbstractSchemaTO> model(final AbstractSchemaTO object) {
+        public IModel<SchemaTO> model(final SchemaTO object) {
             return new CompoundPropertyModel<>(object);
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
index 2d7199a..862747a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
@@ -30,7 +30,7 @@ import org.apache.syncope.client.console.wizards.any.AnyWrapper;
 import org.apache.syncope.client.console.wizards.any.GroupWrapper;
 import org.apache.syncope.client.console.wizards.any.UserWrapper;
 import org.apache.syncope.client.console.wizards.resources.ResourceProvision;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AttrTO;
@@ -39,7 +39,7 @@ import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.ReportTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.SecurityQuestionTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.to.WorkflowDefinitionTO;
@@ -194,8 +194,8 @@ public abstract class TogglePanel<T extends Serializable> extends WizardMgtPanel
             key = ((ReportTO) modelObject).getKey();
         } else if (modelObject instanceof AttrTO) {
             key = ((AttrTO) modelObject).getSchemaInfo().getKey();
-        } else if (modelObject instanceof AbstractPolicyTO) {
-            key = ((AbstractPolicyTO) modelObject).getKey();
+        } else if (modelObject instanceof PolicyTO) {
+            key = ((PolicyTO) modelObject).getKey();
         } else if (modelObject instanceof SecurityQuestionTO) {
             key = ((SecurityQuestionTO) modelObject).getKey();
         } else if (modelObject instanceof AccessTokenTO) {
@@ -204,8 +204,8 @@ public abstract class TogglePanel<T extends Serializable> extends WizardMgtPanel
             key = ((ExecTO) modelObject).getKey();
         } else if (modelObject instanceof WorkflowDefinitionTO) {
             key = ((WorkflowDefinitionTO) modelObject).getKey();
-        } else if (modelObject instanceof SchedTaskTO) {
-            key = ((SchedTaskTO) modelObject).getKey();
+        } else if (modelObject instanceof ProvisioningTaskTO) {
+            key = ((ProvisioningTaskTO) modelObject).getKey();
         } else if (modelObject instanceof WorkflowFormTO) {
             key = ((WorkflowFormTO) modelObject).getKey();
         } else if (modelObject instanceof EntityTO) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
index 22fccf7..d4b41f6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.java
@@ -42,7 +42,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -60,7 +60,7 @@ import org.apache.wicket.model.StringResourceModel;
  *
  * @param <T> policy type.
  */
-public abstract class PolicyDirectoryPanel<T extends AbstractPolicyTO>
+public abstract class PolicyDirectoryPanel<T extends PolicyTO>
         extends DirectoryPanel<T, T, DirectoryDataProvider<T>, PolicyRestClient> {
 
     private static final long serialVersionUID = 4984337552918213290L;
@@ -140,7 +140,7 @@ public abstract class PolicyDirectoryPanel<T extends AbstractPolicyTO>
             private static final long serialVersionUID = -3722207913631435501L;
 
             @Override
-            public void onClick(final AjaxRequestTarget target, final AbstractPolicyTO ignore) {
+            public void onClick(final AjaxRequestTarget target, final PolicyTO ignore) {
                 send(PolicyDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(
                                 restClient.getPolicy(model.getObject().getKey()), target));
@@ -152,8 +152,8 @@ public abstract class PolicyDirectoryPanel<T extends AbstractPolicyTO>
             private static final long serialVersionUID = -3722207913631435501L;
 
             @Override
-            public void onClick(final AjaxRequestTarget target, final AbstractPolicyTO ignore) {
-                final AbstractPolicyTO clone = SerializationUtils.clone(model.getObject());
+            public void onClick(final AjaxRequestTarget target, final PolicyTO ignore) {
+                final PolicyTO clone = SerializationUtils.clone(model.getObject());
                 clone.setKey(null);
                 send(PolicyDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(clone, target));
@@ -167,7 +167,7 @@ public abstract class PolicyDirectoryPanel<T extends AbstractPolicyTO>
             private static final long serialVersionUID = -3722207913631435501L;
 
             @Override
-            public void onClick(final AjaxRequestTarget target, final AbstractPolicyTO ignore) {
+            public void onClick(final AjaxRequestTarget target, final PolicyTO ignore) {
                 final T policyTO = model.getObject();
                 try {
                     restClient.delete(policyTO.getKey());

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
index 3fcb08e..75ddd09 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
@@ -40,7 +40,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPa
 import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
 import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.policy.AccountPolicyTO;
 import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
@@ -56,7 +56,7 @@ import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.util.ListModel;
 
-public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends AbstractModalPanelBuilder<T> {
+public class PolicyModalPanelBuilder<T extends PolicyTO> extends AbstractModalPanelBuilder<T> {
 
     private static final long serialVersionUID = 5945391813567245081L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
index 1cddad3..6d0bfd5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
@@ -43,8 +43,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.policy.ComposablePolicy;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.policy.RuleConf;
 import org.apache.syncope.common.lib.to.ImplementationTO;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
@@ -70,7 +70,7 @@ import org.apache.wicket.model.StringResourceModel;
  *
  * @param <T> policy type.
  */
-public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends DirectoryPanel<
+public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel<
         PolicyRuleWrapper, PolicyRuleWrapper, DirectoryDataProvider<PolicyRuleWrapper>, PolicyRestClient>
         implements ModalPanel {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
index 9142881..baf2c51 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
@@ -29,7 +29,7 @@ import org.apache.syncope.client.console.rest.ImplementationRestClient;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.policy.ComposablePolicy;
 import org.apache.syncope.common.lib.policy.RuleConf;
 import org.apache.syncope.common.lib.to.EntityTO;
@@ -73,7 +73,7 @@ public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper
 
     @Override
     protected Serializable onApplyInternal(final PolicyRuleWrapper modelObject) {
-        AbstractPolicyTO policyTO = restClient.getPolicy(policy);
+        PolicyTO policyTO = restClient.getPolicy(policy);
 
         ComposablePolicy composable;
         if (policyTO instanceof ComposablePolicy) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
index 759600e..6b0619e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.service.PolicyService;
 
@@ -34,7 +34,7 @@ public class PolicyRestClient extends BaseRestClient {
 
     private static final long serialVersionUID = -1392090291817187902L;
 
-    public <T extends AbstractPolicyTO> T getPolicy(final String key) {
+    public <T extends PolicyTO> T getPolicy(final String key) {
         T policy = null;
         try {
             policy = getService(PolicyService.class).read(key);
@@ -45,7 +45,7 @@ public class PolicyRestClient extends BaseRestClient {
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends AbstractPolicyTO> List<T> getPolicies(final PolicyType type) {
+    public <T extends PolicyTO> List<T> getPolicies(final PolicyType type) {
         final List<T> res = new ArrayList<>();
 
         try {
@@ -58,11 +58,11 @@ public class PolicyRestClient extends BaseRestClient {
         return res;
     }
 
-    public <T extends AbstractPolicyTO> void createPolicy(final T policy) {
+    public <T extends PolicyTO> void createPolicy(final T policy) {
         getService(PolicyService.class).create(policy);
     }
 
-    public <T extends AbstractPolicyTO> void updatePolicy(final T policy) {
+    public <T extends PolicyTO> void updatePolicy(final T policy) {
         getService(PolicyService.class).update(policy);
     }
 
@@ -70,12 +70,12 @@ public class PolicyRestClient extends BaseRestClient {
         getService(PolicyService.class).delete(key);
     }
 
-    private class PolicyComparator implements Comparator<AbstractPolicyTO>, Serializable {
+    private class PolicyComparator implements Comparator<PolicyTO>, Serializable {
 
         private static final long serialVersionUID = -4921433085213223115L;
 
         @Override
-        public int compare(final AbstractPolicyTO left, final AbstractPolicyTO right) {
+        public int compare(final PolicyTO left, final PolicyTO right) {
             return left == null ? -1 : right == null ? 1 : left.getDescription().compareTo(right.getDescription());
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
index c64846d..b82403f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
@@ -23,7 +23,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
 import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.syncope.common.lib.to.EntityTO;
@@ -42,7 +42,7 @@ public class SchemaRestClient extends BaseRestClient {
 
     private static final long serialVersionUID = -2479730152700312373L;
 
-    public <T extends AbstractSchemaTO> List<T> getSchemas(final SchemaType schemaType, final AnyTypeKind kind) {
+    public <T extends SchemaTO> List<T> getSchemas(final SchemaType schemaType, final AnyTypeKind kind) {
         final AnyTypeService client = getService(AnyTypeService.class);
 
         final List<String> classes = new ArrayList<>();
@@ -66,7 +66,7 @@ public class SchemaRestClient extends BaseRestClient {
         return getSchemas(schemaType, classes.toArray(new String[] {}));
     }
 
-    public <T extends AbstractSchemaTO> List<T> getSchemas(final SchemaType schemaType, final String typeName) {
+    public <T extends SchemaTO> List<T> getSchemas(final SchemaType schemaType, final String typeName) {
         AnyTypeTO type = null;
 
         try {
@@ -82,7 +82,7 @@ public class SchemaRestClient extends BaseRestClient {
         }
     }
 
-    public <T extends AbstractSchemaTO> List<T> getSchemas(final SchemaType schemaType, final String... kind) {
+    public <T extends SchemaTO> List<T> getSchemas(final SchemaType schemaType, final String... kind) {
         List<T> schemas = new ArrayList<>();
 
         try {
@@ -128,11 +128,11 @@ public class SchemaRestClient extends BaseRestClient {
 
     }
 
-    public void create(final SchemaType schemaType, final AbstractSchemaTO modelObject) {
+    public void create(final SchemaType schemaType, final SchemaTO modelObject) {
         getService(SchemaService.class).create(schemaType, modelObject);
     }
 
-    public void update(final SchemaType schemaType, final AbstractSchemaTO modelObject) {
+    public void update(final SchemaType schemaType, final SchemaTO modelObject) {
         getService(SchemaService.class).update(schemaType, modelObject);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
index be0929b..ced4689 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.rest;
 
 import java.util.Date;
 import java.util.List;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.to.BulkAction;
 import org.apache.syncope.common.lib.to.BulkActionResult;
 import org.apache.syncope.common.lib.to.NotificationTaskTO;
@@ -134,7 +134,7 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends AbstractTaskTO> List<T> list(
+    public <T extends TaskTO> List<T> list(
             final Class<T> reference, final int page, final int size, final SortParam<String> sort) {
 
         return (List<T>) getService(TaskService.class).
@@ -144,7 +144,7 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends AbstractTaskTO> List<T> list(
+    public <T extends TaskTO> List<T> list(
             final String resource,
             final Class<T> reference,
             final int page,
@@ -194,7 +194,7 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien
         return getService(TaskService.class).read(taskKey, false);
     }
 
-    public void delete(final String taskKey, final Class<? extends AbstractTaskTO> taskToClass) {
+    public void delete(final String taskKey, final Class<? extends TaskTO> taskToClass) {
         getService(TaskService.class).delete(taskKey);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
index 2ce9887..2ae10aa 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/ProvisioningTaskDirectoryPanel.java
@@ -27,7 +27,7 @@ import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.
 import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
 import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.common.lib.to.AbstractProvisioningTaskTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
@@ -41,7 +41,7 @@ import org.apache.wicket.model.StringResourceModel;
  *
  * @param <T> Sched task type.
  */
-public abstract class ProvisioningTaskDirectoryPanel<T extends AbstractProvisioningTaskTO>
+public abstract class ProvisioningTaskDirectoryPanel<T extends ProvisioningTaskTO>
         extends SchedTaskDirectoryPanel<T> {
 
     private static final long serialVersionUID = 4984337552918213290L;
@@ -104,7 +104,7 @@ public abstract class ProvisioningTaskDirectoryPanel<T extends AbstractProvision
         return columns;
     }
 
-    protected class ProvisioningTasksProvider<T extends AbstractProvisioningTaskTO> extends SchedTasksProvider<T> {
+    protected class ProvisioningTasksProvider<T extends ProvisioningTaskTO> extends SchedTasksProvider<T> {
 
         private static final long serialVersionUID = 4725679400450513556L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
index 03e4338..ef58d82 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
@@ -33,8 +33,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
-import org.apache.syncope.common.lib.to.AbstractProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.EntityTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.PushTaskTO;
@@ -262,7 +262,7 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
             WebMarkupContainer provisioningTaskSpecifics = new WebMarkupContainer("provisioningTaskSpecifics");
             add(provisioningTaskSpecifics.setRenderBodyOnly(true));
 
-            if (taskTO instanceof AbstractProvisioningTaskTO) {
+            if (taskTO instanceof ProvisioningTaskTO) {
                 jobDelegate.setEnabled(false).setVisible(false);
             } else {
                 provisioningTaskSpecifics.setEnabled(false).setVisible(false);

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java
index 956afd6..56a17a9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java
@@ -27,7 +27,7 @@ import org.apache.syncope.client.console.panels.ModalPanel;
 import org.apache.syncope.client.console.panels.MultilevelPanel;
 import org.apache.syncope.client.console.rest.TaskRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -41,7 +41,7 @@ import org.apache.wicket.model.IModel;
  *
  * @param <T> task type.
  */
-public abstract class TaskDirectoryPanel<T extends AbstractTaskTO>
+public abstract class TaskDirectoryPanel<T extends TaskTO>
         extends DirectoryPanel<T, T, TaskDataProvider<T>, TaskRestClient> implements ModalPanel {
 
     private static final long serialVersionUID = 4984337552918213290L;
@@ -66,7 +66,7 @@ public abstract class TaskDirectoryPanel<T extends AbstractTaskTO>
 
     protected abstract void viewTask(T taskTO, AjaxRequestTarget target);
 
-    protected abstract class TasksProvider<T extends AbstractTaskTO> extends DirectoryDataProvider<T> {
+    protected abstract class TasksProvider<T extends TaskTO> extends DirectoryDataProvider<T> {
 
         private static final long serialVersionUID = -20112718133295756L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskExecutionDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskExecutionDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskExecutionDetails.java
index 263eca3..ef243f3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskExecutionDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TaskExecutionDetails.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.console.tasks;
 import org.apache.syncope.client.console.panels.MultilevelPanel;
 import org.apache.syncope.client.console.rest.TaskRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.TaskTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 
@@ -30,7 +30,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
  *
  * @param <T> actual type of task
  */
-public class TaskExecutionDetails<T extends AbstractTaskTO> extends MultilevelPanel.SecondLevel {
+public class TaskExecutionDetails<T extends TaskTO> extends MultilevelPanel.SecondLevel {
 
     private static final long serialVersionUID = -4110576026663173545L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
index 1ebfc25..4d63c3e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
@@ -37,11 +37,11 @@ import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
-import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.WorkflowDefinitionTO;
 import org.apache.syncope.common.lib.to.WorkflowFormTO;
 import org.apache.wicket.PageReference;
@@ -93,8 +93,8 @@ public class ActionLinksTogglePanel<T extends Serializable> extends TogglePanel<
             header = ((ReportTO) modelObject).getName();
         } else if (modelObject instanceof AttrTO) {
             header = ((AttrTO) modelObject).getSchema();
-        } else if (modelObject instanceof AbstractPolicyTO) {
-            header = ((AbstractPolicyTO) modelObject).getDescription();
+        } else if (modelObject instanceof PolicyTO) {
+            header = ((PolicyTO) modelObject).getDescription();
         } else if (modelObject instanceof SecurityQuestionTO) {
             header = ((SecurityQuestionTO) modelObject).getContent();
         } else if (modelObject instanceof AccessTokenTO) {
@@ -103,8 +103,8 @@ public class ActionLinksTogglePanel<T extends Serializable> extends TogglePanel<
             header = ((ExecTO) modelObject).getKey();
         } else if (modelObject instanceof WorkflowDefinitionTO) {
             header = ((WorkflowDefinitionTO) modelObject).getName();
-        } else if (modelObject instanceof SchedTaskTO) {
-            header = ((SchedTaskTO) modelObject).getName();
+        } else if (modelObject instanceof ProvisioningTaskTO) {
+            header = ((ProvisioningTaskTO) modelObject).getName();
         } else if (modelObject instanceof WorkflowFormTO) {
             header = ((WorkflowFormTO) modelObject).getKey();
         } else if (modelObject instanceof EntityTO) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
index 99d0cd2..ba77916 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
@@ -52,6 +52,7 @@ import org.apache.syncope.client.console.wizards.WizardMgtPanel;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
 import org.apache.syncope.common.lib.types.JobType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
@@ -404,8 +405,8 @@ public class JobWidget extends BaseWidget {
                             break;
 
                         case TASK:
-                            SchedTaskTO schedTaskTO = new TaskRestClient().
-                                    readSchedTask(SchedTaskTO.class, jobTO.getRefKey());
+                            ProvisioningTaskTO schedTaskTO = new TaskRestClient().
+                                    readSchedTask(ProvisioningTaskTO.class, jobTO.getRefKey());
 
                             SchedTaskWizardBuilder<SchedTaskTO> swb =
                                     new SchedTaskWizardBuilder<>(schedTaskTO, pageRef);

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrs.java
index 1ee8f8f..eb7645b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrs.java
@@ -30,7 +30,7 @@ import org.apache.cxf.common.util.StringUtils;
 import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
 import org.apache.syncope.client.console.rest.GroupRestClient;
 import org.apache.syncope.client.console.rest.SchemaRestClient;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.EntityTO;
@@ -48,7 +48,7 @@ import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.util.ListModel;
 
-public abstract class AbstractAttrs<S extends AbstractSchemaTO> extends WizardStep implements ICondition {
+public abstract class AbstractAttrs<S extends SchemaTO> extends WizardStep implements ICondition {
 
     private static final long serialVersionUID = -5387344116983102292L;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
index aeace2d..72ba53d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
@@ -21,9 +21,11 @@ package org.apache.syncope.client.console.wizards.resources;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer;
+import org.apache.syncope.common.lib.policy.PolicyTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.extensions.wizard.WizardStep;
@@ -74,11 +76,8 @@ public class ResourceSecurityPanel extends WizardStep {
 
         @Override
         protected Map<String, String> load() {
-            Map<String, String> res = new HashMap<>();
-            policyRestClient.getPolicies(PolicyType.PULL).forEach(policyTO -> {
-                res.put(policyTO.getKey(), policyTO.getDescription());
-            });
-            return res;
+            return policyRestClient.getPolicies(PolicyType.PULL).stream().
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getDescription));
         }
     };
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0e93bec6/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
index 38efba2..e59374e 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
@@ -21,56 +21,56 @@ package org.apache.syncope.client.enduser.model;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
 
 public class SchemaResponse implements Serializable {
 
     private static final long serialVersionUID = -8896862106241712829L;
 
-    private List<AbstractSchemaTO> plainSchemas = new ArrayList<>();
+    private List<SchemaTO> plainSchemas = new ArrayList<>();
 
-    private List<AbstractSchemaTO> derSchemas = new ArrayList<>();
+    private List<SchemaTO> derSchemas = new ArrayList<>();
 
-    private List<AbstractSchemaTO> virSchemas = new ArrayList<>();
+    private List<SchemaTO> virSchemas = new ArrayList<>();
 
     public SchemaResponse() {
     }
 
-    public List<AbstractSchemaTO> getPlainSchemas() {
+    public List<SchemaTO> getPlainSchemas() {
         return plainSchemas;
     }
 
-    public void setPlainSchemas(final List<AbstractSchemaTO> plainSchemas) {
+    public void setPlainSchemas(final List<SchemaTO> plainSchemas) {
         this.plainSchemas = plainSchemas;
     }
 
-    public List<AbstractSchemaTO> getDerSchemas() {
+    public List<SchemaTO> getDerSchemas() {
         return derSchemas;
     }
 
-    public void setDerSchemas(final List<AbstractSchemaTO> derSchemas) {
+    public void setDerSchemas(final List<SchemaTO> derSchemas) {
         this.derSchemas = derSchemas;
     }
 
-    public List<AbstractSchemaTO> getVirSchemas() {
+    public List<SchemaTO> getVirSchemas() {
         return virSchemas;
     }
 
-    public void setVirSchemas(final List<AbstractSchemaTO> virSchemas) {
+    public void setVirSchemas(final List<SchemaTO> virSchemas) {
         this.virSchemas = virSchemas;
     }
 
-    public SchemaResponse plainSchemas(final List<AbstractSchemaTO> value) {
+    public SchemaResponse plainSchemas(final List<SchemaTO> value) {
         this.plainSchemas = value;
         return this;
     }
 
-    public SchemaResponse derSchemas(final List<AbstractSchemaTO> value) {
+    public SchemaResponse derSchemas(final List<SchemaTO> value) {
         this.derSchemas = value;
         return this;
     }
 
-    public SchemaResponse virSchemas(final List<AbstractSchemaTO> value) {
+    public SchemaResponse virSchemas(final List<SchemaTO> value) {
         this.virSchemas = value;
         return this;
     }


[4/7] syncope git commit: [SYNCOPE-1262] Adapting test to OpenAPI

Posted by il...@apache.org.
[SYNCOPE-1262] Adapting test to OpenAPI


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

Branch: refs/heads/master
Commit: b0b0e3294dd893d44845295f6a0f570d33fcc607
Parents: 0e93bec
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 13 16:20:10 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 13 16:20:10 2018 +0100

----------------------------------------------------------------------
 .../apache/syncope/fit/core/OpenAPIITCase.java  | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b0b0e329/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
new file mode 100644
index 0000000..d2141f7
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OpenAPIITCase.java
@@ -0,0 +1,58 @@
+/*
+ * 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.fit.core;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.syncope.fit.AbstractITCase;
+import org.junit.jupiter.api.Test;
+
+public class OpenAPIITCase extends AbstractITCase {
+
+    @Test
+    public void openapi() throws IOException {
+        WebClient webClient = WebClient.create(ADDRESS + "/openapi.json").accept(MediaType.APPLICATION_JSON_TYPE);
+        Response response = webClient.get();
+        assumeTrue(response.getStatus() == 200);
+
+        JsonNode tree = new ObjectMapper().readTree((InputStream) response.getEntity());
+        assertNotNull(tree);
+
+        JsonNode info = tree.get("info");
+        assertEquals("Apache Syncope", info.get("title").asText());
+
+        JsonNode paths = tree.get("paths");
+        assertNotNull(paths);
+        assertTrue(paths.isContainerNode());
+
+        JsonNode components = tree.get("components");
+        assertNotNull(components);
+        assertTrue(components.isContainerNode());
+    }
+}


[5/7] syncope git commit: [SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
index c46c445..7255ac5 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java
@@ -79,7 +79,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
     @Test
     public void read() {
         PushTaskTO pushTaskTO = taskService.<PushTaskTO>read(
-                "0bc11a19-6454-45c2-a4e3-ceef84e5d79b", true);
+                TaskType.PUSH, "0bc11a19-6454-45c2-a4e3-ceef84e5d79b", true);
         assertEquals(UnmatchingRule.ASSIGN, pushTaskTO.getUnmatchingRule());
         assertEquals(MatchingRule.UPDATE, pushTaskTO.getMatchingRule());
     }
@@ -105,11 +105,11 @@ public class PushTaskITCase extends AbstractTaskITCase {
                 SyncopeClient.getGroupSearchConditionBuilder().isNotNull("cool").query());
         task.setMatchingRule(MatchingRule.LINK);
 
-        final Response response = taskService.create(task);
+        final Response response = taskService.create(TaskType.PUSH, task);
         final PushTaskTO actual = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
         assertNotNull(actual);
 
-        task = taskService.read(actual.getKey(), true);
+        task = taskService.read(TaskType.PUSH, actual.getKey(), true);
         assertNotNull(task);
         assertEquals(task.getKey(), actual.getKey());
         assertEquals(task.getJobDelegate(), actual.getJobDelegate());
@@ -126,7 +126,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         assertFalse(groupService.read("29f96485-729e-4d31-88a1-6fc60e4677f3").
                 getResources().contains(RESOURCE_NAME_LDAP));
 
-        execProvisioningTask(taskService, "fd905ba5-9d56-4f51-83e2-859096a67b75", 50, false);
+        execProvisioningTask(taskService, TaskType.PUSH, "fd905ba5-9d56-4f51-83e2-859096a67b75", 50, false);
 
         assertNotNull(resourceService.readConnObject(
                 RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), "29f96485-729e-4d31-88a1-6fc60e4677f3"));
@@ -151,7 +151,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         // ------------------------------------------
         // Unmatching --> Assign --> dryRuyn
         // ------------------------------------------
-        execProvisioningTask(taskService, "af558be4-9d2f-4359-bf85-a554e6e90be1", 50, true);
+        execProvisioningTask(taskService, TaskType.PUSH, "af558be4-9d2f-4359-bf85-a554e6e90be1", 50, true);
         assertEquals(0, jdbcTemplate.queryForList("SELECT ID FROM test2 WHERE ID='vivaldi'").size());
         assertFalse(userService.read("b3cbc78d-32e6-4bd4-92e0-bbe07566a2ee").
                 getResources().contains(RESOURCE_NAME_TESTDB2));
@@ -162,7 +162,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         pushTaskKeys.add("97f327b6-2eff-4d35-85e8-d581baaab855");
         pushTaskKeys.add("03aa2a04-4881-4573-9117-753f81b04865");
         pushTaskKeys.add("5e5f7c7e-9de7-4c6a-99f1-4df1af959807");
-        execProvisioningTasks(taskService, pushTaskKeys, 50, false);
+        execProvisioningTasks(taskService, TaskType.PUSH, pushTaskKeys, 50, false);
 
         // ------------------------------------------
         // Unatching --> Ignore
@@ -213,7 +213,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         // ------------------------------------------
         // Matching --> Deprovision --> dryRuyn
         // ------------------------------------------
-        execProvisioningTask(taskService, "c46edc3a-a18b-4af2-b707-f4a415507496", 50, true);
+        execProvisioningTask(taskService, TaskType.PUSH, "c46edc3a-a18b-4af2-b707-f4a415507496", 50, true);
         assertTrue(userService.read("1417acbe-cbf6-4277-9372-e75e04f97000").
                 getResources().contains(RESOURCE_NAME_TESTDB2));
         assertEquals(1, jdbcTemplate.queryForList("SELECT ID FROM test2 WHERE ID='rossini'").size());
@@ -224,7 +224,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         pushTaskKeys.add("c46edc3a-a18b-4af2-b707-f4a415507496");
         pushTaskKeys.add("5e5f7c7e-9de7-4c6a-99f1-4df1af959807");
 
-        execProvisioningTasks(taskService, pushTaskKeys, 50, false);
+        execProvisioningTasks(taskService, TaskType.PUSH, pushTaskKeys, 50, false);
 
         // ------------------------------------------
         // Matching --> Deprovision && Ignore
@@ -247,7 +247,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         // ------------------------------------------
         // Matching --> Link
         // ------------------------------------------
-        execProvisioningTask(taskService, "51318433-cce4-4f71-8f45-9534b6c9c819", 50, false);
+        execProvisioningTask(taskService, TaskType.PUSH, "51318433-cce4-4f71-8f45-9534b6c9c819", 50, false);
         assertTrue(userService.read("74cd8ece-715a-44a4-a736-e17b46c4e7e6").
                 getResources().contains(RESOURCE_NAME_TESTDB2));
         assertEquals(1, jdbcTemplate.queryForList("SELECT ID FROM test2 WHERE ID='verdi'").size());
@@ -257,7 +257,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         pushTaskKeys.add("24b1be9c-7e3b-443a-86c9-798ebce5eaf2");
         pushTaskKeys.add("375c7b7f-9e3a-4833-88c9-b7787b0a69f2");
 
-        execProvisioningTasks(taskService, pushTaskKeys, 50, false);
+        execProvisioningTasks(taskService, TaskType.PUSH, pushTaskKeys, 50, false);
 
         // ------------------------------------------
         // Matching --> Unlink && Update
@@ -284,11 +284,11 @@ public class PushTaskITCase extends AbstractTaskITCase {
         task.setPerformDelete(true);
         task.setPerformUpdate(true);
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.PUSH, task);
         PushTaskTO pushTask = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
         assertNotNull(pushTask);
 
-        ExecTO exec = execProvisioningTask(taskService, pushTask.getKey(), 50, false);
+        ExecTO exec = execProvisioningTask(taskService, TaskType.PUSH, pushTask.getKey(), 50, false);
         assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
 
         // 2. check
@@ -371,12 +371,12 @@ public class PushTaskITCase extends AbstractTaskITCase {
             task.getFilters().put(AnyTypeKind.GROUP.name(),
                     SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupTO.getName()).query());
 
-            response = taskService.create(task);
+            response = taskService.create(TaskType.PUSH, task);
             PushTaskTO push = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
             assertNotNull(push);
 
             // execute the new task
-            ExecTO exec = execProvisioningTask(taskService, push.getKey(), 50, false);
+            ExecTO exec = execProvisioningTask(taskService, TaskType.PUSH, push.getKey(), 50, false);
             assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(exec.getStatus()));
         } finally {
             groupService.delete(groupTO.getKey());
@@ -401,7 +401,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         task.setMatchingRule(MatchingRule.IGNORE);
         task.setUnmatchingRule(UnmatchingRule.IGNORE);
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.PUSH, task);
         PushTaskTO actual = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
         assertNotNull(actual);
 
@@ -425,7 +425,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
         notification = getObject(responseNotification.getLocation(), NotificationService.class, NotificationTO.class);
         assertNotNull(notification);
 
-        execProvisioningTask(taskService, actual.getKey(), 50, false);
+        execProvisioningTask(taskService, TaskType.PUSH, actual.getKey(), 50, false);
 
         NotificationTaskTO taskTO = findNotificationTask(notification.getKey(), 50);
         assertNotNull(taskTO);

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
index 7f2a9cc..1799e88 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java
@@ -40,6 +40,7 @@ import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.service.RealmService;
@@ -144,7 +145,7 @@ public class RealmITCase extends AbstractITCase {
         policy.setDescription("deletingAccountPolicy");
         policy.getRules().add(rule.getKey());
 
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.ACCOUNT, policy);
         assertNotNull(policy);
 
         // 2. create realm with policy assigned
@@ -169,7 +170,7 @@ public class RealmITCase extends AbstractITCase {
         assertEquals(policy.getKey(), actual.getAccountPolicy());
 
         // 3. remove policy
-        policyService.delete(policy.getKey());
+        policyService.delete(PolicyType.ACCOUNT, policy.getKey());
 
         // 4. verify
         actual = getRealm(actual.getFullPath()).get();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
index a88327f..358506a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java
@@ -72,7 +72,7 @@ public class SchedTaskITCase extends AbstractTaskITCase {
 
     @Test
     public void update() {
-        SchedTaskTO task = taskService.read(SCHED_TASK_KEY, true);
+        SchedTaskTO task = taskService.read(TaskType.SCHEDULED, SCHED_TASK_KEY, true);
         assertNotNull(task);
 
         SchedTaskTO taskMod = new SchedTaskTO();
@@ -80,8 +80,8 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         taskMod.setName(task.getName());
         taskMod.setCronExpression(null);
 
-        taskService.update(taskMod);
-        SchedTaskTO actual = taskService.read(taskMod.getKey(), true);
+        taskService.update(TaskType.SCHEDULED, taskMod);
+        SchedTaskTO actual = taskService.read(TaskType.SCHEDULED, taskMod.getKey(), true);
         assertNotNull(actual);
         assertEquals(task.getKey(), actual.getKey());
         assertNull(actual.getCronExpression());
@@ -97,7 +97,7 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         task.setName("deferred");
         task.setJobDelegate(taskJobDelegate.getKey());
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.SCHEDULED, task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
         assertNotNull(task);
 
@@ -116,7 +116,7 @@ public class SchedTaskITCase extends AbstractTaskITCase {
             } catch (InterruptedException e) {
             }
 
-            task = taskService.read(task.getKey(), true);
+            task = taskService.read(TaskType.SCHEDULED, task.getKey(), true);
 
             assertNotNull(task);
             assertNotNull(task.getExecutions());
@@ -142,13 +142,13 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         task.setDescription("issueSYNCOPE144 Description");
         task.setJobDelegate(taskJobDelegate.getKey());
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.SCHEDULED, task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
         assertNotNull(task);
         assertEquals("issueSYNCOPE144", task.getName());
         assertEquals("issueSYNCOPE144 Description", task.getDescription());
 
-        task = taskService.read(task.getKey(), true);
+        task = taskService.read(TaskType.SCHEDULED, task.getKey(), true);
         assertNotNull(task);
         assertEquals("issueSYNCOPE144", task.getName());
         assertEquals("issueSYNCOPE144 Description", task.getDescription());
@@ -156,7 +156,7 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         task.setName("issueSYNCOPE144_2");
         task.setDescription("issueSYNCOPE144 Description_2");
 
-        response = taskService.create(task);
+        response = taskService.create(TaskType.SCHEDULED, task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
         assertNotNull(task);
         assertEquals("issueSYNCOPE144_2", task.getName());
@@ -176,7 +176,7 @@ public class SchedTaskITCase extends AbstractTaskITCase {
         task.setDescription("issueSYNCOPE660 Description");
         task.setJobDelegate(taskJobDelegate.getKey());
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.SCHEDULED, task);
         task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
 
         jobs = taskService.listJobs();

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java
deleted file mode 100644
index d928e3c..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.fit.core;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import java.io.InputStream;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.syncope.fit.AbstractITCase;
-import org.junit.jupiter.api.Test;
-
-public class SwaggerITCase extends AbstractITCase {
-
-    @Test
-    public void swagger() throws IOException {
-        WebClient webClient = WebClient.create(ADDRESS + "/swagger.json").accept(MediaType.APPLICATION_JSON_TYPE);
-        Response response = webClient.get();
-        assumeTrue(response.getStatus() == 200);
-
-        JsonNode tree = new ObjectMapper().readTree((InputStream) response.getEntity());
-        assertNotNull(tree);
-
-        JsonNode info = tree.get("info");
-        assertEquals("Apache Syncope", info.get("title").asText());
-
-        assertEquals("/syncope/rest", tree.get("basePath").asText());
-
-        JsonNode tags = tree.get("tags");
-        assertNotNull(tags);
-        assertTrue(tags.isContainerNode());
-
-        JsonNode paths = tree.get("paths");
-        assertNotNull(paths);
-        assertTrue(paths.isContainerNode());
-
-        JsonNode definitions = tree.get("definitions");
-        assertNotNull(definitions);
-        assertTrue(definitions.isContainerNode());
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
index 83d41c1..f962361 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
@@ -73,6 +73,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.PatchOperation;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
@@ -276,7 +277,7 @@ public class UserITCase extends AbstractITCase {
         assertFalse(tasks.getResult().isEmpty());
 
         String maxKey = tasks.getResult().iterator().next().getKey();
-        PropagationTaskTO taskTO = taskService.read(maxKey, true);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, maxKey, true);
 
         assertNotNull(taskTO);
         int maxTaskExecutions = taskTO.getExecutions().size();
@@ -324,7 +325,7 @@ public class UserITCase extends AbstractITCase {
         assertEquals(newMaxKey, maxKey);
 
         // get last task
-        taskTO = taskService.read(newMaxKey, true);
+        taskTO = taskService.read(TaskType.PROPAGATION, newMaxKey, true);
 
         assertNotNull(taskTO);
         assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
@@ -680,7 +681,7 @@ public class UserITCase extends AbstractITCase {
         // all update executions have to be registered
         newMaxKey = tasks.getResult().iterator().next().getKey();
 
-        PropagationTaskTO taskTO = taskService.read(newMaxKey, true);
+        PropagationTaskTO taskTO = taskService.read(TaskType.PROPAGATION, newMaxKey, true);
 
         assertNotNull(taskTO);
         assertEquals(1, taskTO.getExecutions().size());
@@ -950,7 +951,7 @@ public class UserITCase extends AbstractITCase {
         AccountPolicyTO accountPolicy = new AccountPolicyTO();
         accountPolicy.setDescription("Account Policy with custom rules");
         accountPolicy.getRules().add(implementationTO.getKey());
-        accountPolicy = createPolicy(accountPolicy);
+        accountPolicy = createPolicy(PolicyType.ACCOUNT, accountPolicy);
         assertNotNull(accountPolicy);
 
         implementationTO = new ImplementationTO();
@@ -964,7 +965,7 @@ public class UserITCase extends AbstractITCase {
         PasswordPolicyTO passwordPolicy = new PasswordPolicyTO();
         passwordPolicy.setDescription("Password Policy with custom rules");
         passwordPolicy.getRules().add(implementationTO.getKey());
-        passwordPolicy = createPolicy(passwordPolicy);
+        passwordPolicy = createPolicy(PolicyType.PASSWORD, passwordPolicy);
         assertNotNull(passwordPolicy);
 
         RealmTO realm = realmService.list("/even/two").get(0);
@@ -1002,8 +1003,8 @@ public class UserITCase extends AbstractITCase {
             realm.setPasswordPolicy(oldPasswordPolicy);
             realmService.update(realm);
 
-            policyService.delete(passwordPolicy.getKey());
-            policyService.delete(accountPolicy.getKey());
+            policyService.delete(PolicyType.PASSWORD, passwordPolicy.getKey());
+            policyService.delete(PolicyType.ACCOUNT, accountPolicy.getKey());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb1cd3ff/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
index 2a1e944..8ff08a0 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
@@ -71,6 +71,7 @@ import org.apache.syncope.common.lib.types.ImplementationEngine;
 import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.PatchOperation;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.service.ImplementationService;
@@ -1228,7 +1229,7 @@ public class UserIssuesITCase extends AbstractITCase {
         passwordPolicy.setDescription("Password Policy for SYNCOPE-626");
         passwordPolicy.getRules().add(rule.getKey());
 
-        passwordPolicy = createPolicy(passwordPolicy);
+        passwordPolicy = createPolicy(PolicyType.PASSWORD, passwordPolicy);
         assertNotNull(passwordPolicy);
 
         RealmTO realm = realmService.list("/even/two").get(0);
@@ -1255,7 +1256,7 @@ public class UserIssuesITCase extends AbstractITCase {
             realm.setPasswordPolicy(oldPasswordPolicy);
             realmService.update(realm);
 
-            policyService.delete(passwordPolicy.getKey());
+            policyService.delete(PolicyType.PASSWORD, passwordPolicy.getKey());
         }
 
     }