You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/06/05 17:11:56 UTC

[21/21] syncope git commit: [SYNCOPE-666] All tests are green, time to add more

[SYNCOPE-666] All tests are green, time to add more


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

Branch: refs/heads/SYNCOPE-666
Commit: dd88efbd0ec6fabb98728a84a6fe103f285433d7
Parents: d8c9479
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Jun 5 17:11:22 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Jun 5 17:11:22 2015 +0200

----------------------------------------------------------------------
 .travis.yml                                     |   3 +-
 .../console/rest/ConnectorRestClient.java       |   2 +-
 .../syncope/common/lib/AnyOperations.java       |  91 ++++
 .../lib/SyncopeClientCompositeException.java    |  14 +-
 .../common/lib/SyncopeClientException.java      |   8 +-
 .../common/lib/jaxb/GenericMapEntryType.java    |  59 +++
 .../syncope/common/lib/jaxb/GenericMapType.java |  49 +++
 .../common/lib/jaxb/XmlGenericMapAdapter.java   |  52 +++
 .../apache/syncope/common/lib/mod/AnyMod.java   |  18 +
 .../common/lib/report/UserReportletConf.java    |   1 +
 .../common/lib/search/SearchableFields.java     |   9 +-
 .../lib/to/AbstractProvisioningTaskTO.java      |   8 +-
 .../syncope/common/lib/to/AnyObjectTO.java      |  57 +++
 .../org/apache/syncope/common/lib/to/AnyTO.java |  59 +--
 .../syncope/common/lib/to/AnyTypeClassTO.java   |  73 ++++
 .../apache/syncope/common/lib/to/AnyTypeTO.java |  66 +++
 .../apache/syncope/common/lib/to/AttrTO.java    |  13 +-
 .../syncope/common/lib/to/BulkActionResult.java |  88 +---
 .../apache/syncope/common/lib/to/GroupTO.java   |  43 +-
 .../syncope/common/lib/to/MembershipTO.java     |  10 +-
 .../syncope/common/lib/to/NotificationTO.java   |   9 +
 .../syncope/common/lib/to/PushTaskTO.java       |  11 +-
 .../syncope/common/lib/to/RelationshipTO.java   |  10 -
 .../syncope/common/lib/to/ResourceTO.java       |  14 +-
 .../syncope/common/lib/to/SyncTaskTO.java       |  10 +
 .../apache/syncope/common/lib/to/UserTO.java    |  64 +++
 .../common/lib/to/WorkflowFormPropertyTO.java   |   7 +
 .../syncope/common/lib/types/AnyTypeKind.java   |  20 +-
 .../common/lib/types/ClientExceptionType.java   |   4 +-
 .../syncope/common/lib/types/Entitlement.java   |  20 +
 .../rest/api/service/AnyTypeClassService.java   |  97 +++++
 .../common/rest/api/service/AnyTypeService.java |  97 +++++
 .../common/rest/api/service/RoleService.java    |  26 +-
 .../common/rest/api/service/SchemaService.java  |   2 +-
 .../common/rest/api/service/UserService.java    |   2 +-
 .../rest/api/service/WorkflowService.java       |   2 +-
 .../syncope/core/logic/AnyTypeClassLogic.java   | 131 ++++++
 .../apache/syncope/core/logic/AnyTypeLogic.java | 131 ++++++
 .../core/logic/LogicInvocationHandler.java      |  13 +-
 .../syncope/core/logic/ResourceLogic.java       |   2 +-
 .../apache/syncope/core/logic/UserLogic.java    |   4 +-
 .../core/logic/init/JobInstanceLoaderImpl.java  |  36 +-
 .../core/logic/report/UserReportlet.java        |  39 +-
 .../syncope/core/misc/ConnObjectUtils.java      | 269 +++---------
 .../apache/syncope/core/misc/MappingUtils.java  |  25 +-
 .../syncope/core/misc/jexl/JexlUtils.java       |  12 +-
 .../api/dao/UnallowedSchemaException.java       |  29 ++
 .../api/entity/anyobject/AnyObject.java         |   4 +-
 .../api/entity/task/ProvisioningTask.java       |   4 +-
 .../core/persistence/api/entity/user/User.java  |   3 +-
 .../persistence/jpa/dao/AbstractAnyDAO.java     |   3 +-
 .../persistence/jpa/dao/JPADerSchemaDAO.java    |   4 +-
 .../persistence/jpa/dao/JPAPlainSchemaDAO.java  |   4 +-
 .../persistence/jpa/dao/JPAVirSchemaDAO.java    |   4 +-
 .../persistence/jpa/entity/AbstractAttr.java    |   3 +-
 .../persistence/jpa/entity/AbstractDerAttr.java |  12 -
 .../persistence/jpa/entity/AbstractVirAttr.java |  12 -
 .../jpa/entity/anyobject/JPAADerAttr.java       |   9 +
 .../jpa/entity/anyobject/JPAAVirAttr.java       |   9 +
 .../jpa/entity/anyobject/JPAAnyObject.java      |   4 +-
 .../jpa/entity/group/JPAGDerAttr.java           |   9 +
 .../jpa/entity/group/JPAGVirAttr.java           |   9 +
 .../jpa/entity/task/JPAAnyTemplate.java         |   4 +-
 .../jpa/entity/task/JPAPushTask.java            |   6 +-
 .../jpa/entity/task/JPASyncTask.java            |   6 +-
 .../jpa/entity/user/JPAUDerAttr.java            |   9 +
 .../jpa/entity/user/JPAUPlainAttr.java          |   3 -
 .../jpa/entity/user/JPAUVirAttr.java            |   9 +
 .../persistence/jpa/entity/user/JPAUser.java    |   5 +-
 .../resources/META-INF/spring-orm-oracle.xml    |  50 +++
 .../resources/META-INF/spring-orm-sqlserver.xml |  50 +++
 .../src/main/resources/META-INF/spring-orm.xml  |  50 +++
 .../persistence/jpa/entity/VirAttrTest.java     |   4 +-
 .../jpa/relationship/AnyTypeTest.java           |   7 +-
 .../src/test/resources/content.xml              |  49 ++-
 .../core/provisioning/api/VirAttrHandler.java   |  71 ++++
 .../api/data/AnyTypeClassDataBinder.java        |  31 ++
 .../api/data/AnyTypeDataBinder.java             |  31 ++
 .../DefaultAnyObjectProvisioningManager.java    |  15 +
 .../java/DefaultGroupProvisioningManager.java   |  17 +
 .../java/DefaultUserProvisioningManager.java    |   3 +
 .../core/provisioning/java/VirAttrHandler.java  | 238 -----------
 .../provisioning/java/VirAttrHandlerImpl.java   | 411 +++++++++++++++++++
 .../java/data/AbstractAnyDataBinder.java        | 262 +++++++-----
 .../java/data/AnyObjectDataBinderImpl.java      |  99 ++++-
 .../java/data/AnyTypeClassDataBinderImpl.java   | 115 ++++++
 .../java/data/AnyTypeDataBinderImpl.java        |  90 ++++
 .../java/data/ConfigurationDataBinderImpl.java  |   4 +-
 .../java/data/GroupDataBinderImpl.java          |   6 +-
 .../java/data/NotificationDataBinderImpl.java   |  30 +-
 .../java/data/ResourceDataBinderImpl.java       |  40 +-
 .../java/data/RoleDataBinderImpl.java           |   2 +-
 .../java/data/SchemaDataBinderImpl.java         |   2 +-
 .../java/data/TaskDataBinderImpl.java           | 177 ++++----
 .../java/data/UserDataBinderImpl.java           | 122 ++++--
 .../notification/NotificationManagerImpl.java   |  18 +-
 .../AbstractPropagationTaskExecutor.java        |  20 +-
 .../LDAPMembershipPropagationActions.java       |   4 +-
 .../propagation/PropagationManagerImpl.java     |  24 +-
 .../java/sync/AbstractProvisioningJob.java      |   3 +-
 .../java/sync/AbstractPushResultHandler.java    |   6 +-
 .../java/sync/AbstractSyncResultHandler.java    |  29 +-
 .../java/sync/AbstractSyncopeResultHandler.java |   5 +-
 .../java/sync/GroupSyncResultHandlerImpl.java   |   6 +-
 .../java/sync/LDAPMembershipSyncActions.java    |   8 +-
 .../provisioning/java/sync/PushJobImpl.java     |  36 +-
 .../provisioning/java/sync/SyncJobImpl.java     |  12 +-
 .../core/provisioning/java/sync/SyncUtils.java  |  62 ++-
 .../java/data/ResourceDataBinderTest.java       |   2 +-
 .../rest/cxf/RestServiceExceptionMapper.java    |   3 +
 .../cxf/service/AnyTypeClassServiceImpl.java    |  67 +++
 .../rest/cxf/service/AnyTypeServiceImpl.java    |  67 +++
 .../rest/cxf/service/ConnectorServiceImpl.java  |   9 +-
 .../core/rest/cxf/service/GroupServiceImpl.java |  34 +-
 .../rest/cxf/service/ResourceServiceImpl.java   |  12 +-
 .../core/rest/cxf/service/TaskServiceImpl.java  |  14 +-
 .../core/rest/cxf/service/UserServiceImpl.java  |  46 ++-
 .../activiti/ActivitiUserWorkflowAdapter.java   |  12 +-
 .../core/workflow/activiti/ActivitiUtils.java   |  39 ++
 .../workflow/activiti/SyncopeUserManager.java   |   4 +-
 .../main/resources/workflowActivitiContext.xml  |   2 +
 .../camel/processor/GroupUpdateProcessor.java   |  23 +-
 .../camel/processor/UserUpdateProcessor.java    |  12 +-
 .../main/resources/all/provisioning.properties  |   2 +-
 .../src/main/resources/userWorkflow.bpmn20.xml  |  12 +-
 .../fit/core/reference/AbstractITCase.java      |  12 +-
 .../fit/core/reference/AbstractTaskITCase.java  |  16 +-
 .../fit/core/reference/CamelRouteITCase.java    |   8 +
 .../fit/core/reference/ConfigurationITCase.java |  92 -----
 .../fit/core/reference/ConnectorITCase.java     |   6 +-
 .../core/reference/ExceptionMapperITCase.java   |   9 +
 .../syncope/fit/core/reference/GroupITCase.java |  51 ++-
 .../fit/core/reference/PlainSchemaITCase.java   |  30 +-
 .../fit/core/reference/PushTaskITCase.java      |  70 ++--
 .../fit/core/reference/ResourceITCase.java      |  20 +-
 .../fit/core/reference/SyncTaskITCase.java      |  55 ++-
 .../syncope/fit/core/reference/UserITCase.java  |  51 ++-
 .../fit/core/reference/UserWorkflowITCase.java  |  29 +-
 .../fit/core/reference/VirAttrITCase.java       |   7 +-
 139 files changed, 3540 insertions(+), 1429 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e17fd2c..0e6f5c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,6 @@ jdk:
 # default install is mvn install --quiet -DskipTests=true
 install: mvn --show-version --quiet -P all,skipTests
 #invoker.streamLogs: we cannot access to log files through Travis web ui, so display everything in the console
-#script: mvn --show-version --quiet clean install -Dinvoker.streamLogs=true
-script: mvn --show-version --quiet -PskipTests -Dinvoker.streamLogs=true
+script: mvn --show-version --quiet clean install -Dinvoker.streamLogs=true
 notifications:
   webhooks: http://rovere.tirasa.net/cgi-bin/travis.cgi

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
index a093dbd..e6f8488 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
@@ -172,7 +172,7 @@ public class ConnectorRestClient extends BaseRestClient {
         try {
             check = getService(ResourceService.class).check(resourceTO);
         } catch (Exception e) {
-            LOG.error("Connector not found {}", resourceTO.getConnectorId(), e);
+            LOG.error("Connector not found {}", resourceTO.getConnector(), e);
         }
 
         return check;

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
index cab3239..e8bcedb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
@@ -29,13 +29,17 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.mod.AnyMod;
+import org.apache.syncope.common.lib.mod.AnyObjectMod;
 import org.apache.syncope.common.lib.mod.AttrMod;
 import org.apache.syncope.common.lib.mod.ReferenceMod;
 import org.apache.syncope.common.lib.mod.GroupMod;
 import org.apache.syncope.common.lib.mod.UserMod;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.RelationshipTO;
 import org.apache.syncope.common.lib.to.UserTO;
 
 /**
@@ -193,6 +197,63 @@ public final class AnyOperations {
     /**
      * Calculate modifications needed by first in order to be equal to second.
      *
+     * @param updated updated AnyObjectTO
+     * @param original original AnyObjectTO
+     * @return AnyObjectMod containing differences
+     */
+    public static AnyObjectMod diff(final AnyObjectTO updated, final AnyObjectTO original) {
+        return diff(updated, original, false);
+    }
+
+    /**
+     * Calculate modifications needed by first in order to be equal to second.
+     *
+     * @param updated updated AnyObjectTO
+     * @param original original AnyObjectTO
+     * @param incremental perform incremental diff (without removing existing info)
+     * @return AnyObjectMod containing differences
+     */
+    public static AnyObjectMod diff(final AnyObjectTO updated, final AnyObjectTO original, final boolean incremental) {
+        AnyObjectMod result = new AnyObjectMod();
+
+        diff(updated, original, result, incremental);
+
+        // 1. relationships
+        Map<Long, RelationshipTO> updatedRels = updated.getRelationshipMap();
+        Map<Long, RelationshipTO> originalRels = original.getRelationshipMap();
+
+        for (Map.Entry<Long, RelationshipTO> entry : updatedRels.entrySet()) {
+            if (!originalRels.containsKey(entry.getKey())) {
+                result.getRelationshipsToAdd().add(entry.getKey());
+            }
+        }
+        if (!incremental) {
+            Set<Long> originalGroups = new HashSet<>(originalRels.keySet());
+            originalGroups.removeAll(updatedRels.keySet());
+            result.getRelationshipsToRemove().addAll(originalGroups);
+        }
+
+        // 2. memberships
+        Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
+        Map<Long, MembershipTO> originalMembs = original.getMembershipMap();
+
+        for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
+            if (!originalMembs.containsKey(entry.getKey())) {
+                result.getMembershipsToAdd().add(entry.getKey());
+            }
+        }
+        if (!incremental) {
+            Set<Long> originalGroups = new HashSet<>(originalMembs.keySet());
+            originalGroups.removeAll(updatedMembs.keySet());
+            result.getMembershipsToRemove().addAll(originalGroups);
+        }
+
+        return result;
+    }
+
+    /**
+     * Calculate modifications needed by first in order to be equal to second.
+     *
      * @param updated updated UserTO
      * @param original original UserTO
      * @return UserMod containing differences
@@ -248,6 +309,36 @@ public final class AnyOperations {
         result.getRolesToRemove().addAll(CollectionUtils.subtract(original.getRoles(), updated.getRoles()));
         result.getRolesToAdd().addAll(CollectionUtils.subtract(updated.getRoles(), original.getRoles()));
 
+        // 5. relationships
+        Map<Long, RelationshipTO> updatedRels = updated.getRelationshipMap();
+        Map<Long, RelationshipTO> originalRels = original.getRelationshipMap();
+
+        for (Map.Entry<Long, RelationshipTO> entry : updatedRels.entrySet()) {
+            if (!originalRels.containsKey(entry.getKey())) {
+                result.getRelationshipsToAdd().add(entry.getKey());
+            }
+        }
+        if (!incremental) {
+            Set<Long> originalGroups = new HashSet<>(originalRels.keySet());
+            originalGroups.removeAll(updatedRels.keySet());
+            result.getRelationshipsToRemove().addAll(originalGroups);
+        }
+
+        // 6. memberships
+        Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
+        Map<Long, MembershipTO> originalMembs = original.getMembershipMap();
+
+        for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
+            if (!originalMembs.containsKey(entry.getKey())) {
+                result.getMembershipsToAdd().add(entry.getKey());
+            }
+        }
+        if (!incremental) {
+            Set<Long> originalGroups = new HashSet<>(originalMembs.keySet());
+            originalGroups.removeAll(updatedMembs.keySet());
+            result.getMembershipsToRemove().addAll(originalGroups);
+        }
+
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
index d139bda..ebdc5ae 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientCompositeException.java
@@ -21,6 +21,8 @@ package org.apache.syncope.common.lib;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 
 public class SyncopeClientCompositeException extends SyncopeClientException {
@@ -66,7 +68,17 @@ public class SyncopeClientCompositeException extends SyncopeClientException {
                     + ClientExceptionType.class.getName() + " set");
         }
 
-        return exceptions.add(exception);
+        SyncopeClientException alreadyAdded = CollectionUtils.find(exceptions, new Predicate<SyncopeClientException>() {
+
+            @Override
+            public boolean evaluate(final SyncopeClientException ex) {
+                return ex.getType() == exception.getType();
+            }
+        });
+
+        return alreadyAdded == null
+                ? exceptions.add(exception)
+                : alreadyAdded.getElements().addAll(exception.getElements());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
index 8d015f2..f17d5e5 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/SyncopeClientException.java
@@ -18,8 +18,8 @@
  */
 package org.apache.syncope.common.lib;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 
 public class SyncopeClientException extends RuntimeException {
@@ -28,7 +28,7 @@ public class SyncopeClientException extends RuntimeException {
 
     private ClientExceptionType type;
 
-    private final List<String> elements = new ArrayList<>();
+    private final Set<String> elements = new HashSet<>();
 
     public static SyncopeClientException build(final ClientExceptionType type) {
         if (type == ClientExceptionType.Composite) {
@@ -66,7 +66,7 @@ public class SyncopeClientException extends RuntimeException {
         this.type = type;
     }
 
-    public List<String> getElements() {
+    public Set<String> getElements() {
         return elements;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapEntryType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapEntryType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapEntryType.java
new file mode 100644
index 0000000..2d30612
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapEntryType.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2011 John Yeary <jy...@bluelotussoftware.com>.
+ * Copyright 2011 Bluelotus Software, LLC.
+ *
+ * Licensed 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.
+ */
+/*
+ * $Id: MapEntryType.java 399 2011-12-03 04:22:50Z jyeary $
+ */
+package org.apache.syncope.common.lib.jaxb;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class GenericMapEntryType<K, V> {
+
+    private K key;
+
+    private V value;
+
+    public GenericMapEntryType() {
+    }
+
+    public GenericMapEntryType(final Map.Entry<K, V> e) {
+        key = e.getKey();
+        value = e.getValue();
+    }
+
+    @XmlElement
+    public K getKey() {
+        return key;
+    }
+
+    public void setKey(final K key) {
+        this.key = key;
+    }
+
+    @XmlElement
+    public V getValue() {
+        return value;
+    }
+
+    public void setValue(final V value) {
+        this.value = value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapType.java
new file mode 100644
index 0000000..491a860
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/GenericMapType.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2011 John Yeary <jy...@bluelotussoftware.com>.
+ * Copyright 2011 Bluelotus Software, LLC.
+ *
+ * Licensed 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.
+ */
+/*
+ * $Id: MapType.java 399 2011-12-03 04:22:50Z jyeary $
+ */
+package org.apache.syncope.common.lib.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class GenericMapType<K, V> {
+
+    private final List<GenericMapEntryType<K, V>> entry = new ArrayList<>();
+
+    public GenericMapType() {
+    }
+
+    public GenericMapType(final Map<K, V> map) {
+        for (Map.Entry<K, V> e : map.entrySet()) {
+            entry.add(new GenericMapEntryType<>(e));
+        }
+    }
+
+    public List<GenericMapEntryType<K, V>> getEntry() {
+        return entry;
+    }
+
+    public void setEntry(final List<GenericMapEntryType<K, V>> entry) {
+        this.entry.clear();
+        if (entry != null) {
+            this.entry.addAll(entry);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlGenericMapAdapter.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlGenericMapAdapter.java b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlGenericMapAdapter.java
new file mode 100644
index 0000000..1b10d5f
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlGenericMapAdapter.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 John Yeary <jy...@bluelotussoftware.com>.
+ * Copyright 2011 Bluelotus Software, LLC.
+ *
+ * Licensed 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.
+ */
+/*
+ * $Id: XmlGenericMapAdapter.java 399 2011-12-03 04:22:50Z jyeary $
+ */
+package org.apache.syncope.common.lib.jaxb;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class XmlGenericMapAdapter<K, V> extends XmlAdapter<GenericMapType<K, V>, Map<K, V>> {
+
+    @Override
+    public Map<K, V> unmarshal(final GenericMapType<K, V> v) throws Exception {
+        Map<K, V> map = new HashMap<>();
+
+        for (GenericMapEntryType<K, V> mapEntryType : v.getEntry()) {
+            map.put(mapEntryType.getKey(), mapEntryType.getValue());
+        }
+
+        return map;
+    }
+
+    @Override
+    public GenericMapType<K, V> marshal(final Map<K, V> v) throws Exception {
+        GenericMapType<K, V> mapType = new GenericMapType<>();
+
+        for (Map.Entry<K, V> entry : v.entrySet()) {
+            GenericMapEntryType<K, V> mapEntryType = new GenericMapEntryType<>();
+            mapEntryType.setKey(entry.getKey());
+            mapEntryType.setValue(entry.getValue());
+            mapType.getEntry().add(mapEntryType);
+        }
+
+        return mapType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java
index ec508c9..e5fcb85 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java
@@ -35,6 +35,10 @@ public abstract class AnyMod extends AbstractBaseBean {
 
     private String realm;
 
+    protected final Set<String> auxClassesToAdd = new HashSet<>();
+
+    protected final Set<String> auxClassesToRemove = new HashSet<>();
+
     protected final Set<AttrMod> plainAttrsToUpdate = new HashSet<>();
 
     protected final Set<String> plainAttrsToRemove = new HashSet<>();
@@ -67,6 +71,20 @@ public abstract class AnyMod extends AbstractBaseBean {
         this.realm = realm;
     }
 
+    @XmlElementWrapper(name = "auxClassesToAdd")
+    @XmlElement(name = "class")
+    @JsonProperty("auxClassesToAdd")
+    public Set<String> getAuxClassesToAdd() {
+        return auxClassesToAdd;
+    }
+
+    @XmlElementWrapper(name = "auxClassesToRemove")
+    @XmlElement(name = "class")
+    @JsonProperty("auxClassesToRemove")
+    public Set<String> getAuxClassesToRemove() {
+        return auxClassesToRemove;
+    }
+
     @XmlElementWrapper(name = "plainAttrsToRemove")
     @XmlElement(name = "attribute")
     @JsonProperty("plainAttrsToRemove")

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
index 72daf7b..afc459e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/UserReportletConf.java
@@ -44,6 +44,7 @@ public class UserReportletConf extends AbstractAnyReportletConf {
         changePwdDate,
         passwordHistorySize,
         failedLoginCount,
+        relationships,
         memberships,
         resources
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
index 9a68a8d..6443eea 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java
@@ -25,10 +25,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 
 public final class SearchableFields {
@@ -38,11 +35,7 @@ public final class SearchableFields {
     };
 
     public static List<String> get(final AnyTypeKind anyTypeKind) {
-        return get(anyTypeKind == AnyTypeKind.USER
-                ? UserTO.class
-                : anyTypeKind == AnyTypeKind.GROUP
-                        ? GroupTO.class
-                        : AnyObjectTO.class);
+        return get(anyTypeKind.getToClass());
     }
 
     public static List<String> get(final Class<? extends AnyTO> anyRef) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
index c1dcf1c..cd63bcd 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java
@@ -19,8 +19,8 @@
 package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -50,7 +50,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
 
     private MatchingRule matchingRule;
 
-    private final List<String> actionsClassNames = new ArrayList<>();
+    private final Set<String> actionsClassNames = new HashSet<>();
 
     public String getResource() {
         return resource;
@@ -95,7 +95,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO {
     @XmlElementWrapper(name = "actionsClassNames")
     @XmlElement(name = "actionsClassName")
     @JsonProperty("actionsClassNames")
-    public List<String> getActionsClassNames() {
+    public Set<String> getActionsClassNames() {
         return actionsClassNames;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
index 6d2eb1b..f5599de 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java
@@ -18,6 +18,15 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
@@ -27,4 +36,52 @@ public class AnyObjectTO extends AnyTO {
 
     private static final long serialVersionUID = 8841697496476959639L;
 
+    private final List<RelationshipTO> relationships = new ArrayList<>();
+
+    private final List<MembershipTO> memberships = new ArrayList<>();
+
+    private final List<Long> dynGroups = new ArrayList<>();
+
+    @XmlElementWrapper(name = "relationships")
+    @XmlElement(name = "relationship")
+    @JsonProperty("relationships")
+    public List<RelationshipTO> getRelationships() {
+        return relationships;
+    }
+
+    @JsonIgnore
+    public Map<Long, RelationshipTO> getRelationshipMap() {
+        Map<Long, RelationshipTO> result = new HashMap<>(getRelationships().size());
+        for (RelationshipTO membership : getRelationships()) {
+            result.put(membership.getRightKey(), membership);
+        }
+        result = Collections.unmodifiableMap(result);
+
+        return result;
+    }
+
+    @XmlElementWrapper(name = "memberships")
+    @XmlElement(name = "membership")
+    @JsonProperty("memberships")
+    public List<MembershipTO> getMemberships() {
+        return memberships;
+    }
+
+    @JsonIgnore
+    public Map<Long, MembershipTO> getMembershipMap() {
+        Map<Long, MembershipTO> result = new HashMap<>(getMemberships().size());
+        for (MembershipTO membership : getMemberships()) {
+            result.put(membership.getRightKey(), membership);
+        }
+        result = Collections.unmodifiableMap(result);
+
+        return result;
+    }
+
+    @XmlElementWrapper(name = "dynGroups")
+    @XmlElement(name = "role")
+    @JsonProperty("dynGroups")
+    public List<Long> getDynGroups() {
+        return dynGroups;
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
index bac9947..56b1c44 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -30,9 +31,14 @@ import java.util.Map;
 import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
 
+@XmlRootElement(name = "any")
 @XmlType
+@XmlSeeAlso({ UserTO.class, GroupTO.class, AnyObjectTO.class })
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
 public abstract class AnyTO extends ConnObjectTO {
 
     private static final long serialVersionUID = -754311920679872084L;
@@ -45,6 +51,8 @@ public abstract class AnyTO extends ConnObjectTO {
 
     private String status;
 
+    private final List<String> auxClasses = new ArrayList<>();
+
     private final Set<AttrTO> derAttrs = new LinkedHashSet<>();
 
     private final Set<AttrTO> virAttrs = new LinkedHashSet<>();
@@ -53,12 +61,6 @@ public abstract class AnyTO extends ConnObjectTO {
 
     private final List<PropagationStatus> propagationStatusTOs = new ArrayList<>();
 
-    private final List<RelationshipTO> relationships = new ArrayList<>();
-
-    private final List<MembershipTO> memberships = new ArrayList<>();
-
-    private final List<Long> dynGroups = new ArrayList<>();
-
     public long getKey() {
         return key;
     }
@@ -91,6 +93,13 @@ public abstract class AnyTO extends ConnObjectTO {
         this.status = status;
     }
 
+    @XmlElementWrapper(name = "auxClasses")
+    @XmlElement(name = "class")
+    @JsonProperty("auxClasses")
+    public List<String> getAuxClasses() {
+        return auxClasses;
+    }
+
     @XmlElementWrapper(name = "derAttrs")
     @XmlElement(name = "attribute")
     @JsonProperty("derAttrs")
@@ -139,42 +148,4 @@ public abstract class AnyTO extends ConnObjectTO {
         return propagationStatusTOs;
     }
 
-    @XmlElementWrapper(name = "relationships")
-    @XmlElement(name = "relationship")
-    @JsonProperty("relationships")
-    public List<RelationshipTO> getRelationships() {
-        return relationships;
-    }
-
-    @XmlElementWrapper(name = "memberships")
-    @XmlElement(name = "membership")
-    @JsonProperty("memberships")
-    public List<MembershipTO> getMemberships() {
-        return memberships;
-    }
-
-    @JsonIgnore
-    public Map<Long, MembershipTO> getMembershipMap() {
-        Map<Long, MembershipTO> result;
-
-        if (getMemberships() == null) {
-            result = Collections.emptyMap();
-        } else {
-            result = new HashMap<>(getMemberships().size());
-            for (MembershipTO membership : getMemberships()) {
-                result.put(membership.getRightKey(), membership);
-            }
-            result = Collections.unmodifiableMap(result);
-        }
-
-        return result;
-    }
-
-    @XmlElementWrapper(name = "dynGroups")
-    @XmlElement(name = "role")
-    @JsonProperty("dynGroups")
-    public List<Long> getDynGroups() {
-        return dynGroups;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeClassTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeClassTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeClassTO.java
new file mode 100644
index 0000000..1afbe4d
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeClassTO.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlRootElement(name = "anyTypeClass")
+@XmlType
+public class AnyTypeClassTO extends AbstractBaseBean {
+
+    private static final long serialVersionUID = -591757688607551266L;
+
+    private String name;
+
+    private final List<String> plainSchemas = new ArrayList<>();
+
+    private final List<String> derSchemas = new ArrayList<>();
+
+    private final List<String> virSchemas = new ArrayList<>();
+
+    public String getKey() {
+        return name;
+    }
+
+    public void setKey(final String key) {
+        this.name = key;
+    }
+
+    @XmlElementWrapper(name = "plainSchemas")
+    @XmlElement(name = "schema")
+    @JsonProperty("plainSchemas")
+    public List<String> getPlainSchemas() {
+        return plainSchemas;
+    }
+
+    @XmlElementWrapper(name = "derSchemas")
+    @XmlElement(name = "schema")
+    @JsonProperty("derSchemas")
+    public List<String> getDerSchemas() {
+        return derSchemas;
+    }
+
+    @XmlElementWrapper(name = "virSchemas")
+    @XmlElement(name = "schema")
+    @JsonProperty("virSchemas")
+    public List<String> getVirSchemas() {
+        return virSchemas;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeTO.java
new file mode 100644
index 0000000..9618bf5
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTypeTO.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+
+@XmlRootElement(name = "anyType")
+@XmlType
+public class AnyTypeTO extends AbstractBaseBean {
+
+    private static final long serialVersionUID = 6771657557616874373L;
+
+    private String name;
+
+    private AnyTypeKind kind;
+
+    private final List<String> classes = new ArrayList<>();
+
+    public String getKey() {
+        return name;
+    }
+
+    public void setKey(final String key) {
+        this.name = key;
+    }
+
+    public AnyTypeKind getKind() {
+        return kind;
+    }
+
+    public void setKind(final AnyTypeKind kind) {
+        this.kind = kind;
+    }
+
+    @XmlElementWrapper(name = "classes")
+    @XmlElement(name = "class")
+    @JsonProperty("classes")
+    public List<String> getClasses() {
+        return classes;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
index 829f309..cf385b4 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
@@ -41,21 +41,12 @@ public class AttrTO extends AbstractBaseBean {
     /**
      * Set of (string) values of this attribute.
      */
-    private final List<String> values;
+    private final List<String> values = new ArrayList<>();
 
     /**
      * Whether this attribute is read-only or not.
      */
-    private boolean readonly;
-
-    /**
-     * Default constructor.
-     */
-    public AttrTO() {
-        super();
-        values = new ArrayList<String>();
-        readonly = false;
-    }
+    private boolean readonly = false;
 
     /**
      * @return the name of the schema that this attribute is referring to

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
index 9726a25..9b44b3f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/BulkActionResult.java
@@ -25,15 +25,18 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 
 @XmlRootElement(name = "bulkActionResult")
 @XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
 public class BulkActionResult extends AbstractBaseBean {
 
     private static final long serialVersionUID = 2868894178821778133L;
@@ -52,86 +55,25 @@ public class BulkActionResult extends AbstractBaseBean {
 
     }
 
-    private final List<Result> results = new ArrayList<>();
-
-    @XmlElementWrapper(name = "result")
-    @XmlElement(name = "item")
-    @JsonProperty("result")
-    public List<Result> getResult() {
-        return results;
-    }
-
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
     @JsonIgnore
-    public void add(final Object id, final Status status) {
-        if (id != null) {
-            results.add(new Result(id.toString(), status));
-        }
-    }
+    private final Map<String, Status> results = new HashMap<>();
 
-    @JsonIgnore
-    public void add(final Object id, final String status) {
-        if (id != null) {
-            results.add(new Result(id.toString(), Status.valueOf(status.toUpperCase())));
-        }
-    }
-
-    @JsonIgnore
-    public Map<String, Status> getResultMap() {
-        final Map<String, Status> res = new HashMap<>();
-
-        for (Result result : results) {
-            res.put(result.getKey(), result.getValue());
-        }
-
-        return Collections.unmodifiableMap(res);
+    @JsonProperty
+    public Map<String, Status> getResults() {
+        return results;
     }
 
     @JsonIgnore
     public List<String> getResultByStatus(final Status status) {
-        final List<String> res = new ArrayList<>();
+        final List<String> result = new ArrayList<>();
 
-        for (Result result : results) {
-            if (result.getValue() == status) {
-                res.add(result.getKey());
+        for (Map.Entry<String, Status> entry : results.entrySet()) {
+            if (entry.getValue() == status) {
+                result.add(entry.getKey());
             }
         }
 
-        return Collections.unmodifiableList(res);
-    }
-
-    public static class Result extends AbstractBaseBean {
-
-        private static final long serialVersionUID = -1149681964161193232L;
-
-        private String key;
-
-        private Status value;
-
-        public Result() {
-            super();
-        }
-
-        public Result(final String key, final Status value) {
-            super();
-
-            this.key = key;
-            this.value = value;
-        }
-
-        public String getKey() {
-            return key;
-        }
-
-        public Status getValue() {
-            return value;
-        }
-
-        public void setKey(final String key) {
-            this.key = key;
-        }
-
-        public void setValue(final Status value) {
-            this.value = value;
-        }
+        return Collections.unmodifiableList(result);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
index 873b15d..a5a33ca 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java
@@ -18,13 +18,13 @@
  */
 package org.apache.syncope.common.lib.to;
 
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
 
 @XmlRootElement(name = "group")
 @XmlType
-@JsonIgnoreProperties({ "displayName" })
 public class GroupTO extends AnyTO {
 
     private static final long serialVersionUID = -7785920258290147542L;
@@ -35,9 +35,19 @@ public class GroupTO extends AnyTO {
 
     private Long groupOwner;
 
-    private String aDynMembershipCond;
+    private String adynMembershipCond;
 
-    private String uDynMembershipCond;
+    private String udynMembershipCond;
+
+    @Override
+    public String getType() {
+        return AnyTypeKind.GROUP.name();
+    }
+
+    @Override
+    public void setType(final String type) {
+        // fixed
+    }
 
     public String getName() {
         return name;
@@ -64,19 +74,36 @@ public class GroupTO extends AnyTO {
     }
 
     public String getADynMembershipCond() {
-        return aDynMembershipCond;
+        return adynMembershipCond;
     }
 
     public void setADynMembershipCond(final String aDynMembershipCond) {
-        this.aDynMembershipCond = aDynMembershipCond;
+        this.adynMembershipCond = aDynMembershipCond;
     }
 
     public String getUDynMembershipCond() {
-        return uDynMembershipCond;
+        return udynMembershipCond;
     }
 
     public void setUDynMembershipCond(final String uDynMembershipCond) {
-        this.uDynMembershipCond = uDynMembershipCond;
+        this.udynMembershipCond = uDynMembershipCond;
     }
 
+    @JsonIgnore
+    public String getDisplayName() {
+        return getKey() + " " + getName();
+    }
+
+    public static long fromDisplayName(final String displayName) {
+        long result = 0;
+        if (displayName != null && !displayName.isEmpty() && displayName.indexOf(' ') != -1) {
+            try {
+                result = Long.valueOf(displayName.split(" ")[0]);
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+        }
+
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
index 5c435e4..ef70589 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
@@ -20,6 +20,7 @@ package org.apache.syncope.common.lib.to;
 
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
 
 @XmlRootElement(name = "membership")
 @XmlType
@@ -29,9 +30,14 @@ public class MembershipTO extends RelationshipTO {
 
     private String groupName;
 
+    public MembershipTO() {
+        super();
+        super.setRightType(AnyTypeKind.GROUP.name());
+    }
+
     @Override
-    public String getRightType() {
-        return "group";
+    public void setRightType(final String rightType) {
+        // ignore
     }
 
     public String getGroupName() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
index 662a465..7cb6556 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java
@@ -18,21 +18,27 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 import org.apache.syncope.common.lib.types.IntMappingType;
 import org.apache.syncope.common.lib.types.TraceLevel;
 
 @XmlRootElement(name = "notification")
 @XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
 public class NotificationTO extends AbstractBaseBean {
 
     private static final long serialVersionUID = -6145117115632592612L;
@@ -41,6 +47,8 @@ public class NotificationTO extends AbstractBaseBean {
 
     private final List<String> events = new ArrayList<>();
 
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
+    @JsonIgnore
     private final Map<String, String> abouts = new HashMap<>();
 
     private String recipients;
@@ -63,6 +71,7 @@ public class NotificationTO extends AbstractBaseBean {
 
     private boolean active;
 
+    @JsonProperty
     public Map<String, String> getAbouts() {
         return abouts;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
index e1839af..dd3347a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java
@@ -18,21 +18,30 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import java.util.HashMap;
 import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 
 @XmlRootElement(name = "pushTask")
 @XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
 public class PushTaskTO extends AbstractProvisioningTaskTO {
 
     private static final long serialVersionUID = -2143537546915809018L;
 
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
+    @JsonIgnore
     private final Map<String, String> filters = new HashMap<>();
 
+    @JsonProperty
     public Map<String, String> getFilters() {
         return filters;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java
index 2585b2b..d769719 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java
@@ -28,8 +28,6 @@ public class RelationshipTO extends AbstractBaseBean {
 
     private static final long serialVersionUID = 360672942026613929L;
 
-    private long key;
-
     private String leftType;
 
     private long leftKey;
@@ -38,14 +36,6 @@ public class RelationshipTO extends AbstractBaseBean {
 
     private long rightKey;
 
-    public long getKey() {
-        return key;
-    }
-
-    public void setKey(final long key) {
-        this.key = key;
-    }
-
     public String getLeftType() {
         return leftType;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
index fb97113..dcec457 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
@@ -48,7 +48,7 @@ public class ResourceTO extends AbstractAnnotatedBean {
     /**
      * The resource type is identified by the associated connector.
      */
-    private Long connectorId;
+    private Long connector;
 
     /**
      * Convenience information: display name for the connector id.
@@ -83,10 +83,6 @@ public class ResourceTO extends AbstractAnnotatedBean {
 
     private final Set<ConnConfProperty> connConfProperties = new HashSet<>();
 
-    private String usyncToken;
-
-    private String rsyncToken;
-
     private final List<String> propagationActionsClassNames = new ArrayList<>();
 
     public ResourceTO() {
@@ -117,12 +113,12 @@ public class ResourceTO extends AbstractAnnotatedBean {
         this.enforceMandatoryCondition = enforceMandatoryCondition;
     }
 
-    public Long getConnectorId() {
-        return connectorId;
+    public Long getConnector() {
+        return connector;
     }
 
-    public void setConnectorId(final Long connectorId) {
-        this.connectorId = connectorId;
+    public void setConnector(final Long connector) {
+        this.connector = connector;
     }
 
     public String getConnectorDisplayName() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
index 4974505..a6a7a8a 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java
@@ -18,19 +18,28 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import java.util.HashMap;
 import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 
 @XmlRootElement(name = "syncTask")
 @XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
 public class SyncTaskTO extends AbstractProvisioningTaskTO {
 
     private static final long serialVersionUID = -2143537546915809017L;
 
     private String destinationRealm;
 
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
+    @JsonIgnore
     private final Map<String, AnyTO> templates = new HashMap<>();
 
     private boolean fullReconciliation;
@@ -43,6 +52,7 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO {
         this.destinationRealm = destinationRealm;
     }
 
+    @JsonProperty
     public Map<String, AnyTO> getTemplates() {
         return templates;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 5de7b01..dd5ebee 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -18,17 +18,22 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
 
 @XmlRootElement(name = "user")
 @XmlType
@@ -58,6 +63,22 @@ public class UserTO extends AnyTO {
 
     private String securityAnswer;
 
+    private final List<RelationshipTO> relationships = new ArrayList<>();
+
+    private final List<MembershipTO> memberships = new ArrayList<>();
+
+    private final List<Long> dynGroups = new ArrayList<>();
+
+    @Override
+    public String getType() {
+        return AnyTypeKind.USER.name();
+    }
+
+    @Override
+    public void setType(final String type) {
+        // fixed
+    }
+
     public String getPassword() {
         return password;
     }
@@ -148,6 +169,49 @@ public class UserTO extends AnyTO {
         this.securityAnswer = securityAnswer;
     }
 
+    @XmlElementWrapper(name = "relationships")
+    @XmlElement(name = "relationship")
+    @JsonProperty("relationships")
+    public List<RelationshipTO> getRelationships() {
+        return relationships;
+    }
+
+    @JsonIgnore
+    public Map<Long, RelationshipTO> getRelationshipMap() {
+        Map<Long, RelationshipTO> result = new HashMap<>(getRelationships().size());
+        for (RelationshipTO membership : getRelationships()) {
+            result.put(membership.getRightKey(), membership);
+        }
+        result = Collections.unmodifiableMap(result);
+
+        return result;
+    }
+
+    @XmlElementWrapper(name = "memberships")
+    @XmlElement(name = "membership")
+    @JsonProperty("memberships")
+    public List<MembershipTO> getMemberships() {
+        return memberships;
+    }
+
+    @JsonIgnore
+    public Map<Long, MembershipTO> getMembershipMap() {
+        Map<Long, MembershipTO> result = new HashMap<>(getMemberships().size());
+        for (MembershipTO membership : getMemberships()) {
+            result.put(membership.getRightKey(), membership);
+        }
+        result = Collections.unmodifiableMap(result);
+
+        return result;
+    }
+
+    @XmlElementWrapper(name = "dynGroups")
+    @XmlElement(name = "role")
+    @JsonProperty("dynGroups")
+    public List<Long> getDynGroups() {
+        return dynGroups;
+    }
+
     @Override
     public String toString() {
         return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java
index 5b67c92..9fa5928 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java
@@ -18,11 +18,15 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
 import org.apache.syncope.common.lib.types.WorkflowFormPropertyType;
 
 @XmlRootElement(name = "workflowFormProperty")
@@ -47,6 +51,8 @@ public class WorkflowFormPropertyTO extends AbstractBaseBean {
 
     private String datePattern;
 
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
+    @JsonIgnore
     private final Map<String, String> enumValues = new HashMap<>();
 
     public String getId() {
@@ -113,6 +119,7 @@ public class WorkflowFormPropertyTO extends AbstractBaseBean {
         this.datePattern = datePattern;
     }
 
+    @JsonProperty
     public Map<String, String> getEnumValues() {
         return enumValues;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
index c7b4e47..ee35e28 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
@@ -19,12 +19,26 @@
 package org.apache.syncope.common.lib.types;
 
 import javax.xml.bind.annotation.XmlEnum;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
 
 @XmlEnum
 public enum AnyTypeKind {
 
-    USER,
-    GROUP,
-    ANY_OBJECT;
+    USER(UserTO.class),
+    GROUP(GroupTO.class),
+    ANY_OBJECT(AnyObjectTO.class);
+
+    private final Class<? extends AnyTO> toClass;
+
+    private AnyTypeKind(final Class<? extends AnyTO> toClass) {
+        this.toClass = toClass;
+    }
+
+    public Class<? extends AnyTO> getToClass() {
+        return toClass;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index 498f603..8e96942 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -40,6 +40,7 @@ public enum ClientExceptionType {
     InvalidProvision(Response.Status.BAD_REQUEST),
     InvalidReport(Response.Status.BAD_REQUEST),
     InvalidReportExec(Response.Status.BAD_REQUEST),
+    InvalidAnyType(Response.Status.BAD_REQUEST),
     InvalidAnyObject(Response.Status.BAD_REQUEST),
     InvalidGroup(Response.Status.BAD_REQUEST),
     InvalidSchemaDefinition(Response.Status.BAD_REQUEST),
@@ -49,7 +50,7 @@ public enum ClientExceptionType {
     InvalidPlainSchema(Response.Status.BAD_REQUEST),
     InvalidDerSchema(Response.Status.BAD_REQUEST),
     InvalidVirSchema(Response.Status.BAD_REQUEST),
-    InvalidSchemaMapping(Response.Status.BAD_REQUEST),
+    InvalidMapping(Response.Status.BAD_REQUEST),
     InvalidRealm(Response.Status.BAD_REQUEST),
     InvalidUser(Response.Status.BAD_REQUEST),
     InvalidExternalResource(Response.Status.BAD_REQUEST),
@@ -65,6 +66,7 @@ public enum ClientExceptionType {
     GroupOwnership(Response.Status.BAD_REQUEST),
     Scheduling(Response.Status.BAD_REQUEST),
     Unauthorized(Response.Status.UNAUTHORIZED),
+    UnallowedSchemas(Response.Status.BAD_REQUEST),
     Unknown(Response.Status.BAD_REQUEST),
     Workflow(Response.Status.BAD_REQUEST);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
index 81caa77..6ffe318 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -36,6 +36,26 @@ public final class Entitlement {
 
     public static final String REALM_DELETE = "REALM_DELETE";
 
+    public static final String ANYTYPECLASS_LIST = "ANYTYPECLASS_LIST";
+
+    public static final String ANYTYPECLASS_CREATE = "ANYTYPECLASS_CREATE";
+
+    public static final String ANYTYPECLASS_READ = "ANYTYPECLASS_READ";
+
+    public static final String ANYTYPECLASS_UPDATE = "ANYTYPECLASS_UPDATE";
+
+    public static final String ANYTYPECLASS_DELETE = "ANYTYPECLASS_DELETE";
+
+    public static final String ANYTYPE_LIST = "ANYTYPE_LIST";
+
+    public static final String ANYTYPE_CREATE = "ANYTYPE_CREATE";
+
+    public static final String ANYTYPE_READ = "ANYTYPE_READ";
+
+    public static final String ANYTYPE_UPDATE = "ANYTYPE_UPDATE";
+
+    public static final String ANYTYPE_DELETE = "ANYTYPE_DELETE";
+
     public static final String ROLE_LIST = "ROLE_LIST";
 
     public static final String ROLE_CREATE = "ROLE_CREATE";

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
new file mode 100644
index 0000000..21831cf
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.Descriptions;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.to.AnyTypeClassTO;
+
+/**
+ * REST operations for any type classes.
+ */
+@Path("anyTypeClassClasses")
+public interface AnyTypeClassService extends JAXRSService {
+
+    /**
+     * Returns a list of all anyTypeClasss.
+     *
+     * @return list of all anyTypeClasss.
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<AnyTypeClassTO> list();
+
+    /**
+     * Returns anyTypeClass with matching key.
+     *
+     * @param key anyTypeClass key to be read
+     * @return anyTypeClass with matching key
+     */
+    @GET
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    AnyTypeClassTO read(@NotNull @PathParam("key") String key);
+
+    /**
+     * Creates a new anyTypeClass.
+     *
+     * @param anyTypeClassTO anyTypeClass to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created anyTypeClass
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created anyTypeClass")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull AnyTypeClassTO anyTypeClassTO);
+
+    /**
+     * Updates the anyTypeClass matching the provided key.
+     *
+     * @param key anyTypeClass key to be updated
+     * @param anyTypeClassTO anyTypeClass to be stored
+     */
+    @PUT
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("key") String key, @NotNull AnyTypeClassTO anyTypeClassTO);
+
+    /**
+     * Deletes the anyTypeClass matching the provided key.
+     *
+     * @param key anyTypeClass key to be deleted
+     */
+    @DELETE
+    @Path("{key}")
+    void delete(@NotNull @PathParam("key") String key);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
new file mode 100644
index 0000000..ddedd25
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.apache.cxf.jaxrs.model.wadl.Descriptions;
+import org.apache.cxf.jaxrs.model.wadl.DocTarget;
+import org.apache.syncope.common.lib.to.AnyTypeTO;
+
+/**
+ * REST operations for any types.
+ */
+@Path("anyTypes")
+public interface AnyTypeService extends JAXRSService {
+
+    /**
+     * Returns a list of all anyTypes.
+     *
+     * @return list of all anyTypes.
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<AnyTypeTO> list();
+
+    /**
+     * Returns anyType with matching key.
+     *
+     * @param key anyType key to be read
+     * @return anyType with matching key
+     */
+    @GET
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    AnyTypeTO read(@NotNull @PathParam("key") String key);
+
+    /**
+     * Creates a new anyType.
+     *
+     * @param anyTypeTO anyType to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created anyType
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created anyType")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull AnyTypeTO anyTypeTO);
+
+    /**
+     * Updates the anyType matching the provided key.
+     *
+     * @param key anyType key to be updated
+     * @param anyTypeTO anyType to be stored
+     */
+    @PUT
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("key") String key, @NotNull AnyTypeTO anyTypeTO);
+
+    /**
+     * Deletes the anyType matching the provided key.
+     *
+     * @param key anyType key to be deleted
+     */
+    @DELETE
+    @Path("{key}")
+    void delete(@NotNull @PathParam("key") String key);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
index 172af5f..881e1bc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
@@ -51,15 +51,15 @@ public interface RoleService extends JAXRSService {
     List<RoleTO> list();
 
     /**
-     * Returns role with matching id.
+     * Returns role with matching key.
      *
-     * @param roleKey role id to be read
-     * @return role with matching id
+     * @param key role key to be read
+     * @return role with matching key
      */
     @GET
-    @Path("{roleKey}")
+    @Path("{key}")
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    RoleTO read(@NotNull @PathParam("roleKey") Long roleKey);
+    RoleTO read(@NotNull @PathParam("key") Long key);
 
     /**
      * Creates a new role.
@@ -76,22 +76,22 @@ public interface RoleService extends JAXRSService {
     Response create(@NotNull RoleTO roleTO);
 
     /**
-     * Updates the role matching the provided id.
+     * Updates the role matching the provided key.
      *
-     * @param roleKey role id to be updated
+     * @param key role key to be updated
      * @param roleTO role to be stored
      */
     @PUT
-    @Path("{roleKey}")
+    @Path("{key}")
     @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    void update(@NotNull @PathParam("roleKey") Long roleKey, @NotNull RoleTO roleTO);
+    void update(@NotNull @PathParam("key") Long key, @NotNull RoleTO roleTO);
 
     /**
-     * Deletes the role matching the provided id.
+     * Deletes the role matching the provided key.
      *
-     * @param roleKey role id to be deleted
+     * @param key role key to be deleted
      */
     @DELETE
-    @Path("{roleKey}")
-    void delete(@NotNull @PathParam("roleKey") Long roleKey);
+    @Path("{key}")
+    void delete(@NotNull @PathParam("key") Long key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
index 4ffb3f6..352e310 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -39,7 +39,7 @@ import org.apache.syncope.common.lib.types.SchemaType;
 /**
  * REST operations for attribute schemas.
  */
-@Path("schemas/{kind}/{type}")
+@Path("schemas/{type}")
 public interface SchemaService extends JAXRSService {
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
index 9e280a5..8f9363cb 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
@@ -81,7 +81,7 @@ public interface UserService extends JAXRSService {
     })
     @OPTIONS
     @Path("{username}/userKey")
-    Response getUserId(@NotNull @PathParam("username") String username);
+    Response getUserKey(@NotNull @PathParam("username") String username);
 
     /**
      * Reads the user matching the provided userKey.

http://git-wip-us.apache.org/repos/asf/syncope/blob/dd88efbd/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
index fc48429..68858c7 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
@@ -33,7 +33,7 @@ import org.apache.syncope.common.rest.api.RESTHeaders;
 /**
  * REST operations for workflow definition management.
  */
-@Path("workflows/{kind}")
+@Path("workflows/{anyTypeKind}")
 public interface WorkflowService extends JAXRSService {
 
     /**