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("syncope...@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, 'synctokenwitherro...@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='synctokenwitherro...@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, 
'syncope...@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='updatedsyncope...@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("s25...@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("pullfromld...@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) {

Reply via email to