syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [09/10] syncope git commit: [SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(
Date Tue, 13 Feb 2018 13:29:11 GMT
[SYNCOPE-1262] Remove matrix parameters - OpenApi wins :-(


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

Branch: refs/heads/2_0_X
Commit: 6bc2cac1683aea747dcf02ca6ed31340088f9a33
Parents: e93047e
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Feb 13 14:26:33 2018 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Feb 13 14:26:33 2018 +0100

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


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

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

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

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

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

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

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

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

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
index aa98ea5..3469451 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
@@ -78,6 +78,8 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
     private final BaseModal<T> baseModal;
 
+    private final PolicyType type;
+
     private final String policy;
 
     protected PolicyRuleDirectoryPanel(
@@ -87,6 +89,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
         disableCheckBoxes();
 
         this.baseModal = baseModal;
+        this.type = type;
         this.policy = policy;
         this.restClient = new PolicyRestClient();
 
@@ -159,7 +162,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
             public void onClick(final AjaxRequestTarget target, final PolicyRuleWrapper ignore) {
                 final RuleConf rule = model.getObject().getConf();
                 try {
-                    final T actual = restClient.getPolicy(policy);
+                    final T actual = restClient.getPolicy(type, policy);
                     CollectionUtils.filter(getRuleConf(actual), new Predicate<RuleConf>() {
 
                         @Override
@@ -167,7 +170,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
                             return !object.getName().equals(rule.getName());
                         }
                     });
-                    restClient.updatePolicy(actual);
+                    restClient.updatePolicy(type, actual);
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     customActionOnFinishCallback(target);
                 } catch (SyncopeClientException e) {
@@ -233,7 +236,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
         @Override
         public Iterator<PolicyRuleWrapper> iterator(final long first, final long count) {
-            final T actual = restClient.getPolicy(policy);
+            final T actual = restClient.getPolicy(type, policy);
 
             final ArrayList<PolicyRuleWrapper> rules = CollectionUtils.collect(getRuleConf(actual),
                     new Transformer<RuleConf, PolicyRuleWrapper>() {
@@ -250,7 +253,7 @@ public class PolicyRuleDirectoryPanel<T extends PolicyTO> extends DirectoryPanel
 
         @Override
         public long size() {
-            final T actual = restClient.getPolicy(policy);
+            final T actual = restClient.getPolicy(type, policy);
             return getRuleConf(actual).size();
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
index 6148994..6b6d443 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
@@ -68,7 +68,7 @@ public class PolicyRuleWizardBuilder
         BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(modelObject.getConf());
         wrapper.setPropertyValue("name", modelObject.getName());
 
-        PolicyTO policyTO = restClient.getPolicy(policy);
+        PolicyTO policyTO = restClient.getPolicy(type, policy);
 
         final ComposablePolicy<RuleConf> composable;
         if (policyTO instanceof ComposablePolicy) {
@@ -90,7 +90,7 @@ public class PolicyRuleWizardBuilder
             composable.getRuleConfs().add(modelObject.getConf());
         }
 
-        restClient.updatePolicy(policyTO);
+        restClient.updatePolicy(type, policyTO);
         return modelObject;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
index 6cdf72c..97848c5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
@@ -45,6 +45,7 @@ import org.apache.syncope.common.lib.policy.PullPolicyTO;
 import org.apache.syncope.common.lib.to.SchemaTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -132,7 +133,7 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
             for (CorrelationRule rule : model.getObject()) {
                 getItem().getSpecification().getCorrelationRules().put(rule.getAny(), rule.getRule());
             }
-            restClient.updatePolicy(getItem());
+            restClient.updatePolicy(PolicyType.PULL, getItem());
             SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
             this.modal.close(target);
         } catch (Exception e) {
@@ -278,18 +279,18 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
             final List<String> choices = StringUtils.isEmpty(rule.getAny())
                     ? new ArrayList<String>()
                     : CollectionUtils.collect(new SchemaRestClient().getSchemas(SchemaType.PLAIN,
-                                    rule.getAny().equals(AnyTypeKind.USER.name())
-                                    ? AnyTypeKind.USER
-                                    : rule.getAny().equals(AnyTypeKind.GROUP.name())
-                                    ? AnyTypeKind.GROUP
-                                    : AnyTypeKind.ANY_OBJECT), new Transformer<SchemaTO, String>() {
+                            rule.getAny().equals(AnyTypeKind.USER.name())
+                            ? AnyTypeKind.USER
+                            : rule.getAny().equals(AnyTypeKind.GROUP.name())
+                            ? AnyTypeKind.GROUP
+                            : AnyTypeKind.ANY_OBJECT), new Transformer<SchemaTO, String>() {
 
                         @Override
                         public String transform(final SchemaTO input) {
                             return input.getKey();
                         }
                     }, new ArrayList<String>());
-            
+
             choices.add("key");
             choices.add(rule.getAny().equals(AnyTypeKind.USER.name()) ? "username" : "name");
             Collections.sort(choices);

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
index 32b81b7..0193eaa 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PullPolicyDirectoryPanel.java
@@ -45,7 +45,7 @@ public class PullPolicyDirectoryPanel extends PolicyDirectoryPanel<PullPolicyTO>
         defaultItem.setSpecification(new PullPolicySpec());
 
         this.addNewItemPanelBuilder(
-                new PolicyModalPanelBuilder<>(defaultItem, modal, pageRef), true);
+                new PolicyModalPanelBuilder<>(PolicyType.PULL, defaultItem, modal, pageRef), true);
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.POLICY_CREATE);
 
         initResultTable();

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

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

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

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

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

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

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
index c19940e..a4b2d51 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java
@@ -75,6 +75,8 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
     private static final String GROUP_MEMBER_PROVISION_TASKJOB =
             "org.apache.syncope.core.provisioning.java.job.GroupMemberProvisionTaskJobDelegate";
 
+    protected TaskType taskType;
+
     protected final Class<T> reference;
 
     protected T schedTaskTO;
@@ -86,9 +88,12 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
     protected SchedTaskDirectoryPanel(
             final BaseModal<?> baseModal,
             final MultilevelPanel multiLevelPanelRef,
+            final TaskType taskType,
             final Class<T> reference,
             final PageReference pageRef) {
+
         super(baseModal, multiLevelPanelRef, pageRef);
+        this.taskType = taskType;
         this.reference = reference;
 
         try {
@@ -97,7 +102,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
             LOG.error("Falure instantiating task", e);
         }
 
-        this.addNewItemPanelBuilder(new SchedTaskWizardBuilder<>(schedTaskTO, pageRef), true);
+        this.addNewItemPanelBuilder(new SchedTaskWizardBuilder<>(taskType, schedTaskTO, pageRef), true);
 
         MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.TASK_CREATE);
 
@@ -118,7 +123,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
                     final TemplatableTO targetObject, final String type, final AnyTO anyTO) {
 
                 targetObject.getTemplates().put(type, anyTO);
-                new TaskRestClient().update(SchedTaskTO.class.cast(targetObject));
+                new TaskRestClient().update(taskType, SchedTaskTO.class.cast(targetObject));
                 return targetObject;
             }
         };
@@ -206,7 +211,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
                 SchedTaskDirectoryPanel.this.getTogglePanel().close(target);
                 send(SchedTaskDirectoryPanel.this, Broadcast.EXACT,
                         new AjaxWizard.EditItemActionEvent<>(
-                                restClient.readSchedTask(reference, model.getObject().getKey()),
+                                restClient.readTask(taskType, model.getObject().getKey()),
                                 target).setResourceModel(
                                 new StringResourceModel("inner.task.edit",
                                         SchedTaskDirectoryPanel.this,
@@ -265,7 +270,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
             @Override
             public void onClick(final AjaxRequestTarget target, final T ignore) {
                 try {
-                    restClient.delete(taskTO.getKey(), reference);
+                    restClient.delete(taskType, taskTO.getKey());
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     target.add(container);
                     SchedTaskDirectoryPanel.this.getTogglePanel().close(target);
@@ -300,7 +305,7 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO>
 
     @Override
     protected SchedTasksProvider<T> dataProvider() {
-        return new SchedTasksProvider<>(reference, TaskType.SCHEDULED, rows);
+        return new SchedTasksProvider<>(reference, taskType, rows);
     }
 
     protected class SchedTasksProvider<T extends SchedTaskTO> extends TaskDataProvider<T> {

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
index 9075ac5..1a78c2d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java
@@ -42,6 +42,7 @@ import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.types.MatchingRule;
 import org.apache.syncope.common.lib.types.PullMode;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.common.lib.types.UnmatchingRule;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -59,6 +60,8 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
 
     private final TaskRestClient taskRestClient = new TaskRestClient();
 
+    private final TaskType type;
+
     private PushTaskWrapper wrapper;
 
     private CrontabPanel crontabPanel;
@@ -84,8 +87,9 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
         }
     };
 
-    public SchedTaskWizardBuilder(final T taskTO, final PageReference pageRef) {
+    public SchedTaskWizardBuilder(final TaskType type, final T taskTO, final PageReference pageRef) {
         super(taskTO, pageRef);
+        this.type = type;
     }
 
     @Override
@@ -96,9 +100,9 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui
 
         modelObject.setCronExpression(crontabPanel.getCronExpression());
         if (modelObject.getKey() == null) {
-            taskRestClient.create(modelObject);
+            taskRestClient.create(type, modelObject);
         } else {
-            taskRestClient.update(modelObject);
+            taskRestClient.update(type, modelObject);
         }
         return modelObject;
     }

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

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

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

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

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

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

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

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
index b48fd79..361ad1d 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.persistence.api.dao;
 
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
-import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
index 245758b..9402073 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
@@ -20,8 +20,8 @@ package org.apache.syncope.core.persistence.api.dao;
 
 import java.util.List;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 
 public interface PolicyDAO extends DAO<Policy> {
 

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
deleted file mode 100644
index 85fc90e..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Policy.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.api.entity;
-
-public interface Policy extends Entity {
-
-    String getDescription();
-
-    void setDescription(String description);
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/6bc2cac1/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
index 6aed282..5cc4192 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/AccountPolicy.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.api.entity.policy;
 import java.util.List;
 import java.util.Set;
 import org.apache.syncope.common.lib.policy.AccountRuleConf;
-import org.apache.syncope.core.persistence.api.entity.Policy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
 public interface AccountPolicy extends Policy {

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


Mime
View raw message