http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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/6bc2cac1/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/6bc2cac1/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 da82cb7..903c9d7 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
@@ -19,7 +19,6 @@
 package org.apache.syncope.core.persistence.api.entity.policy;
 
 import org.apache.syncope.common.lib.policy.PullPolicySpec;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PullPolicy extends Policy {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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/6bc2cac1/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 f63eff0..21d968f 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
@@ -44,12 +44,12 @@ import 
org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
 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.Realm;
 import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
 import org.apache.syncope.core.persistence.api.entity.group.Group;
 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.api.entity.user.User;

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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 4c76f44..1ff9c38 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
@@ -25,8 +25,8 @@ import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 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/6bc2cac1/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 0f4cb62..64a004f 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,10 +31,10 @@ import 
org.apache.syncope.core.persistence.api.dao.MalformedPathException;
 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.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.Role;
 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/6bc2cac1/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/6bc2cac1/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/6bc2cac1/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/6bc2cac1/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/6bc2cac1/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 1086d3e..dc96683 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
@@ -33,7 +33,7 @@ import 
org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
 import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
 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.Policy;
 import org.apache.syncope.core.persistence.jpa.AbstractTest;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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/6bc2cac1/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 b5b074f..81e604a 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
@@ -29,17 +29,17 @@ import 
org.apache.syncope.common.lib.policy.PasswordRuleConf;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
-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.Realm;
 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.AccountPolicy;
 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/6bc2cac1/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 a07ef06..a92ae41 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
@@ -37,9 +37,9 @@ import 
org.apache.syncope.core.persistence.api.entity.AnyTemplateRealm;
 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.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/6bc2cac1/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/6bc2cac1/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/6bc2cac1/ext/swagger-ui/pom.xml
----------------------------------------------------------------------
diff --git a/ext/swagger-ui/pom.xml b/ext/swagger-ui/pom.xml
index 90524f5..cf9b7a0 100644
--- a/ext/swagger-ui/pom.xml
+++ b/ext/swagger-ui/pom.xml
@@ -119,29 +119,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/6bc2cac1/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 6f552da..b5aa249 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
@@ -34,6 +34,7 @@ import org.apache.syncope.common.lib.report.ReportletConf;
 import org.apache.syncope.common.lib.report.StaticReportletConf;
 import org.apache.syncope.common.lib.report.UserReportletConf;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.core.logic.TaskLogic;
 import org.apache.syncope.core.provisioning.java.job.report.AuditReportlet;
 import org.apache.syncope.core.provisioning.java.job.report.GroupReportlet;
@@ -219,7 +220,7 @@ public class ITImplementationLookup implements 
ImplementationLookup {
                         task.setJobDelegateClassName(
                                 
"org.apache.syncope.core.provisioning.java.job.ElasticsearchReindex");
                         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/6bc2cac1/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 c0d600d..1a19ffd 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;
@@ -486,8 +487,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/6bc2cac1/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 a18982d..27c2aaf 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
@@ -40,7 +40,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;
@@ -287,26 +286,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/6bc2cac1/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 4247eda..c2ec86b 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/6bc2cac1/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 1dd55d9..04b141e 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
@@ -89,6 +89,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;
@@ -976,7 +977,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/6bc2cac1/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 3a9ee36..1a036a6 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
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
 import java.util.List;
 import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
 import org.apache.syncope.common.lib.to.WorkflowFormTO;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -33,7 +34,7 @@ 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/6bc2cac1/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 6a4abd1..5a67601 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
@@ -53,6 +53,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;
@@ -292,15 +293,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
@@ -317,7 +319,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/6bc2cac1/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
----------------------------------------------------------------------
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
index a7e66be..c5e5cb9 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
@@ -416,7 +416,7 @@ public class MigrationITCase extends AbstractTaskITCase {
         user.getPlainAttrs().add(new 
AttrTO.Builder().schema("fullname").value("username").build());
         task.getTemplates().put(AnyTypeKind.USER.name(), user);
 
-        Response response = taskService.create(task);
+        Response response = taskService.create(TaskType.PULL, task);
         task = getObject(response.getLocation(), TaskService.class, 
PullTaskTO.class);
 
         return task.getKey();
@@ -430,7 +430,7 @@ public class MigrationITCase extends AbstractTaskITCase {
                     new 
TaskQuery.Builder(TaskType.PULL).resource(RESOURCE_KEY).build()).getResult()) {
 
                 if 
(PULL_TASK_NAME.equals(PullTaskTO.class.cast(task).getName())) {
-                    taskService.delete(task.getKey());
+                    taskService.delete(TaskType.PULL, task.getKey());
                 }
             }
         } catch (Exception e) {
@@ -479,7 +479,7 @@ public class MigrationITCase extends AbstractTaskITCase {
         String pullTaskKey = setupPullTask();
 
         // 3. execute pull task
-        execProvisioningTask(taskService, pullTaskKey, 50, false);
+        execProvisioningTask(taskService, TaskType.PULL, pullTaskKey, 50, 
false);
 
         // 4. verify
         UserTO user = null;

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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 5002fdf..4ad582a 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/6bc2cac1/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 a4ca1f4..bab038e 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
@@ -60,7 +60,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());
@@ -106,9 +106,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());
@@ -135,11 +137,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
@@ -159,7 +161,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());
@@ -189,7 +191,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());
@@ -212,7 +214,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/6bc2cac1/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 7b8d6d9..5ddbbb9 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
@@ -66,7 +66,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());
@@ -75,7 +75,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));
@@ -84,7 +84,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());
@@ -96,7 +96,7 @@ public class PolicyITCase extends AbstractITCase {
         policy.setSpecification(new PullPolicySpec());
 
         try {
-            createPolicy(policy);
+            createPolicy(PolicyType.PULL, policy);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.InvalidPolicy, e.getType());
@@ -107,7 +107,7 @@ public class PolicyITCase extends AbstractITCase {
     public void create() {
         PullPolicyTO policy = buildPullPolicyTO();
 
-        PullPolicyTO policyTO = createPolicy(policy);
+        PullPolicyTO policyTO = createPolicy(PolicyType.PULL, policy);
 
         assertNotNull(policyTO);
         assertEquals(TestPullRule.class.getName(),
@@ -116,21 +116,21 @@ public class PolicyITCase extends AbstractITCase {
 
     @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());
 
         ((DefaultPasswordRuleConf) 
policy.getRuleConfs().get(0)).setMaxLength(22);
 
         // 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);
         assertEquals(22, ((DefaultPasswordRuleConf) 
policy.getRuleConfs().get(0)).getMaxLength());
@@ -141,13 +141,13 @@ public class PolicyITCase extends AbstractITCase {
     public void delete() {
         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();
         } catch (SyncopeClientException e) {
             assertNotNull(e);
@@ -169,7 +169,7 @@ public class PolicyITCase extends AbstractITCase {
         ruleConf.setMaxLength(8);
         policy.getRuleConfs().add(ruleConf);
 
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.ACCOUNT, policy);
         assertNotNull(policy);
     }
 
@@ -184,7 +184,7 @@ public class PolicyITCase extends AbstractITCase {
         ruleConf.setMaxLength(8);
         policy.getRuleConfs().add(ruleConf);
 
-        policy = createPolicy(policy);
+        policy = createPolicy(PolicyType.ACCOUNT, policy);
         assertNotNull(policy);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/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 d0daa6a..4134b6f 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
@@ -77,7 +77,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());
@@ -180,12 +180,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/6bc2cac1/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 82e71a0..17d00e9 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
@@ -71,6 +71,7 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ConnConfProperty;
 import org.apache.syncope.common.lib.types.ConnectorCapability;
+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;
@@ -105,9 +106,9 @@ public class PullTaskITCase extends AbstractTaskITCase {
 
     @BeforeClass
     public static void testPullActionsSetup() {
-        PullTaskTO pullTask = taskService.read(PULL_TASK_KEY, true);
+        PullTaskTO pullTask = taskService.read(TaskType.PULL, PULL_TASK_KEY, 
true);
         pullTask.getActionsClassNames().add(TestPullActions.class.getName());
-        taskService.update(pullTask);
+        taskService.update(TaskType.PULL, pullTask);
     }
 
     @Test
@@ -147,11 +148,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.getJobDelegateClassName(), 
task.getJobDelegateClassName());
@@ -216,7 +217,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);
@@ -289,7 +290,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));
@@ -301,7 +302,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(
                 "Execution of " + execution.getRefDesc() + " failed with 
message " + execution.getMessage(),
                 "SUCCESS", execution.getStatus());
@@ -313,7 +314,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");
@@ -326,7 +327,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");
@@ -346,7 +347,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()));
@@ -359,7 +361,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());
 
@@ -390,7 +392,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;
@@ -475,12 +477,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)
@@ -513,10 +515,10 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     + "'" + user2OnTestPull + "', 'user2', 'Rossi', false, 
'ma...@apache.org', NULL)");
 
             // 2. create new pull task for test-db, with reconciliation filter 
(surname 'Rossi') 
-            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.setReconciliationFilterBuilderClassName(TestReconciliationFilterBuilder.class.getName());
-            Response response = taskService.create(task);
+            Response response = taskService.create(TaskType.PULL, task);
             task = getObject(response.getLocation(), TaskService.class, 
PullTaskTO.class);
             assertNotNull(task);
             assertEquals(
@@ -524,7 +526,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
                     task.getReconciliationFilterBuilderClassName());
 
             // 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
@@ -541,7 +543,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());
@@ -591,7 +593,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);
             }
@@ -606,7 +608,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());
@@ -616,7 +618,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());
@@ -675,19 +677,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");
@@ -712,7 +714,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");
@@ -724,7 +726,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");
@@ -739,9 +741,9 @@ public class PullTaskITCase extends AbstractTaskITCase {
         // -----------------------------
         // Add a custom correlation rule
         // -----------------------------
-        PullPolicyTO policyTO = 
policyService.read("9454b0d7-2610-400a-be82-fc23cf553dd6");
+        PullPolicyTO policyTO = policyService.read(PolicyType.PULL, 
"9454b0d7-2610-400a-be82-fc23cf553dd6");
         
policyTO.getSpecification().getCorrelationRules().put(AnyTypeKind.USER.name(), 
TestPullRule.class.getName());
-        policyService.update(policyTO);
+        policyService.update(PolicyType.PULL, policyTO);
         // -----------------------------
 
         PullTaskTO task = new PullTaskTO();
@@ -754,7 +756,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");
@@ -776,9 +778,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
@@ -802,7 +804,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()));
@@ -833,7 +835,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();
@@ -843,10 +845,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());
@@ -890,17 +892,17 @@ public class PullTaskITCase extends AbstractTaskITCase {
         pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
         pullTask.setResource(RESOURCE_NAME_TESTDB);
         
pullTask.getActionsClassNames().add(DBPasswordPullActions.class.getName());
-        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.getJobDelegateClassName(), 
pullTask.getJobDelegateClassName());
 
-        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
@@ -908,7 +910,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());
     }
 
@@ -970,12 +972,12 @@ public class PullTaskITCase extends AbstractTaskITCase {
             pullTask.setPullMode(PullMode.FULL_RECONCILIATION);
             pullTask.setResource(RESOURCE_NAME_LDAP);
             
pullTask.getActionsClassNames().add(LDAPPasswordPullActions.class.getName());
-            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
@@ -986,7 +988,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) {
@@ -1029,13 +1031,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...
@@ -1071,7 +1073,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             assertEquals("pullfromld...@syncope.apache.org", 
connObject.getAttr("mail").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...
@@ -1089,7 +1091,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