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/01/12 17:32:18 UTC

[39/52] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Unit tests all in

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectSearchDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectSearchDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectSearchDAO.java
new file mode 100644
index 0000000..c7f61c0
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectSearchDAO.java
@@ -0,0 +1,86 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.dao.search.SearchCond;
+import org.apache.syncope.server.persistence.api.entity.DerAttr;
+import org.apache.syncope.server.persistence.api.entity.PlainAttr;
+import org.apache.syncope.server.persistence.api.entity.Subject;
+import org.apache.syncope.server.persistence.api.entity.VirAttr;
+
+public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> {
+
+    /**
+     * @param adminRoles the set of admin roles owned by the caller
+     * @param searchCondition the search condition
+     * @param type user or role
+     * @return size of search result
+     */
+    int count(Set<Long> adminRoles, SearchCond searchCondition, SubjectType type);
+
+    /**
+     * @param adminRoles the set of admin roles owned by the caller
+     * @param searchCondition the search condition
+     * @param type user or role
+     * @param <T> user/role
+     * @return the list of users/roles matching the given search condition
+     */
+    <T extends Subject<?, ?, ?>> List<T> search(
+            Set<Long> adminRoles, SearchCond searchCondition, SubjectType type);
+
+    /**
+     * @param adminRoles the set of admin roles owned by the caller
+     * @param searchCondition the search condition
+     * @param orderBy list of ordering clauses
+     * @param type user or role
+     * @param <T> user/role
+     * @return the list of users/roles matching the given search condition
+     */
+    <T extends Subject<?, ?, ?>> List<T> search(
+            Set<Long> adminRoles, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type);
+
+    /**
+     * @param adminRoles the set of admin roles owned by the caller
+     * @param searchCondition the search condition
+     * @param page position of the first result, start from 1
+     * @param itemsPerPage number of results per page
+     * @param orderBy list of ordering clauses
+     * @param type user or role
+     * @param <T> user/role
+     * @return the list of users/roles matching the given search condition (in the given page)
+     */
+    <T extends Subject<?, ?, ?>> List<T> search(
+            Set<Long> adminRoles, SearchCond searchCondition, int page, int itemsPerPage,
+            List<OrderByClause> orderBy, SubjectType type);
+
+    /**
+     * Verify if user/role matches the given search condition.
+     *
+     * @param subject to be checked
+     * @param searchCondition to be verified
+     * @param type user or role
+     * @param <T> user/role
+     * @return true if user/role matches searchCondition
+     */
+    <T extends Subject<?, ?, ?>> boolean matches(T subject, SearchCond searchCondition, SubjectType type);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskDAO.java
new file mode 100644
index 0000000..332c1cc
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskDAO.java
@@ -0,0 +1,52 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.task.Task;
+
+public interface TaskDAO extends DAO<Task, Long> {
+
+    Class<? extends Task> getEntityReference(TaskType type);
+
+    <T extends Task> T find(Long key);
+
+    <T extends Task> List<T> findToExec(TaskType type);
+
+    <T extends Task> List<T> findAll(ExternalResource resource, TaskType type);
+
+    <T extends Task> List<T> findAll(TaskType type);
+
+    <T extends Task> List<T> findAll(
+            int page, int itemsPerPage, List<OrderByClause> orderByClauses, TaskType type);
+
+    int count(TaskType type);
+
+    <T extends Task> T save(T task) throws InvalidEntityException;
+
+    void delete(Long key);
+
+    void delete(Task task);
+
+    void deleteAll(ExternalResource resource, TaskType type);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskExecDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskExecDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskExecDAO.java
new file mode 100644
index 0000000..fc69280
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/TaskExecDAO.java
@@ -0,0 +1,44 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.server.persistence.api.entity.task.Task;
+import org.apache.syncope.server.persistence.api.entity.task.TaskExec;
+
+public interface TaskExecDAO extends DAO<TaskExec, Long> {
+
+    TaskExec find(Long key);
+
+    <T extends Task> TaskExec findLatestStarted(T task);
+
+    <T extends Task> TaskExec findLatestEnded(T task);
+
+    List<TaskExec> findAll(TaskType type);
+
+    TaskExec save(TaskExec execution) throws InvalidEntityException;
+
+    void saveAndAdd(Long taskId, TaskExec execution) throws InvalidEntityException;
+
+    void delete(Long key);
+
+    void delete(TaskExec execution);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/UserDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/UserDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/UserDAO.java
new file mode 100644
index 0000000..25000f7
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/UserDAO.java
@@ -0,0 +1,68 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.user.SecurityQuestion;
+import org.apache.syncope.server.persistence.api.entity.user.UDerAttr;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.server.persistence.api.entity.user.UVirAttr;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+
+public interface UserDAO extends SubjectDAO<UPlainAttr, UDerAttr, UVirAttr> {
+
+    User find(Long key);
+
+    User find(String username);
+
+    User findByWorkflowId(String workflowId);
+
+    User findByToken(String token);
+
+    List<User> findBySecurityQuestion(SecurityQuestion securityQuestion);
+
+    List<User> findByDerAttrValue(String schemaName, String value);
+
+    List<User> findByAttrValue(String schemaName, UPlainAttrValue attrValue);
+
+    User findByAttrUniqueValue(String schemaName, UPlainAttrValue attrUniqueValue);
+
+    List<User> findByResource(ExternalResource resource);
+
+    List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage);
+
+    List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage, List<OrderByClause> orderBy);
+
+    int count(Set<Long> adminRoles);
+
+    User save(User user) throws InvalidEntityException;
+
+    void delete(Long key);
+
+    void delete(User user);
+
+    User authFetch(Long key);
+
+    User authFetch(String username);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirAttrDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirAttrDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirAttrDAO.java
new file mode 100644
index 0000000..35cf2b5
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirAttrDAO.java
@@ -0,0 +1,36 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.server.persistence.api.entity.VirAttr;
+
+public interface VirAttrDAO extends DAO<VirAttr, Long> {
+
+    <T extends VirAttr> T find(Long key, Class<T> reference);
+
+    <T extends VirAttr> List<T> findAll(Class<T> reference);
+
+    <T extends VirAttr> T save(T virtualAttribute) throws InvalidEntityException;
+
+    <T extends VirAttr> void delete(Long key, Class<T> reference);
+
+    <T extends VirAttr> void delete(T virAttr);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirSchemaDAO.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirSchemaDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirSchemaDAO.java
new file mode 100644
index 0000000..04953f2
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/VirSchemaDAO.java
@@ -0,0 +1,38 @@
+/*
+ * 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.server.persistence.api.dao;
+
+import java.util.List;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.server.persistence.api.entity.VirAttr;
+import org.apache.syncope.server.persistence.api.entity.VirSchema;
+
+public interface VirSchemaDAO extends DAO<VirSchema, String> {
+
+    <T extends VirSchema> T find(String key, Class<T> reference);
+
+    <T extends VirSchema> List<T> findAll(Class<T> reference);
+
+    <T extends VirAttr> List<T> findAttrs(VirSchema virSchema, Class<T> reference);
+
+    <T extends VirSchema> T save(T virSchema) throws InvalidEntityException;
+
+    void delete(String key, AttributableUtil attributableUtil);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AbstractSearchCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AbstractSearchCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AbstractSearchCond.java
new file mode 100644
index 0000000..9a2343f
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AbstractSearchCond.java
@@ -0,0 +1,48 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public abstract class AbstractSearchCond implements Serializable {
+
+    private static final long serialVersionUID = 5376869884544910804L;
+
+    @Override
+    public boolean equals(final Object obj) {
+        return EqualsBuilder.reflectionEquals(this, obj);
+    }
+
+    @Override
+    public int hashCode() {
+        return HashCodeBuilder.reflectionHashCode(this);
+    }
+
+    @Override
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+    }
+
+    public abstract boolean isValid();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AttributeCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AttributeCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AttributeCond.java
new file mode 100644
index 0000000..b2e1ce2
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/AttributeCond.java
@@ -0,0 +1,84 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+/**
+ * Search condition to be applied when comparing attribute values.
+ */
+public class AttributeCond extends AbstractSearchCond {
+
+    private static final long serialVersionUID = 3275277728404021417L;
+
+    public enum Type {
+
+        LIKE,
+        EQ,
+        GT,
+        LT,
+        GE,
+        LE,
+        ISNULL,
+        ISNOTNULL
+
+    }
+
+    private Type type;
+
+    private String schema;
+
+    private String expression;
+
+    public AttributeCond() {
+        super();
+    }
+
+    public AttributeCond(final Type conditionType) {
+        super();
+        this.type = conditionType;
+    }
+
+    public final String getExpression() {
+        return expression;
+    }
+
+    public final void setExpression(final String conditionExpression) {
+        this.expression = conditionExpression;
+    }
+
+    public final String getSchema() {
+        return schema;
+    }
+
+    public final void setSchema(final String conditionSchema) {
+        this.schema = conditionSchema;
+    }
+
+    public final Type getType() {
+        return type;
+    }
+
+    public final void setType(final Type conditionType) {
+        this.type = conditionType;
+    }
+
+    @Override
+    public final boolean isValid() {
+        return type != null && schema != null && (type == Type.ISNULL || type == Type.ISNOTNULL || expression != null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/EntitlementCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/EntitlementCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/EntitlementCond.java
new file mode 100644
index 0000000..d912b8d
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/EntitlementCond.java
@@ -0,0 +1,39 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+public class EntitlementCond extends AbstractSearchCond {
+
+    private static final long serialVersionUID = -4077781080368377428L;
+
+    private String expression;
+
+    public String getExpression() {
+        return expression;
+    }
+
+    public void setExpression(final String expression) {
+        this.expression = expression;
+    }
+
+    @Override
+    public boolean isValid() {
+        return expression != null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/MembershipCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/MembershipCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/MembershipCond.java
new file mode 100644
index 0000000..035ed03
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/MembershipCond.java
@@ -0,0 +1,46 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+/**
+ * Search condition to be applied when searching for memberships.
+ */
+public class MembershipCond extends AbstractSearchCond {
+
+    private static final long serialVersionUID = -728155256293925989L;
+
+    private Long roleId;
+
+    public MembershipCond() {
+        super();
+    }
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(final Long roleId) {
+        this.roleId = roleId;
+    }
+
+    @Override
+    public final boolean isValid() {
+        return roleId != null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/OrderByClause.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/OrderByClause.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/OrderByClause.java
new file mode 100644
index 0000000..3576649
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/OrderByClause.java
@@ -0,0 +1,69 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class OrderByClause {
+
+    public enum Direction {
+
+        ASC,
+        DESC
+
+    }
+
+    private String field;
+
+    private Direction direction;
+
+    public String getField() {
+        return field;
+    }
+
+    public void setField(final String field) {
+        this.field = field;
+    }
+
+    public Direction getDirection() {
+        return direction == null ? Direction.ASC : direction;
+    }
+
+    public void setDirection(final Direction direction) {
+        this.direction = direction;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return EqualsBuilder.reflectionEquals(this, obj);
+    }
+
+    @Override
+    public int hashCode() {
+        return HashCodeBuilder.reflectionHashCode(this);
+    }
+
+    @Override
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/ResourceCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/ResourceCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/ResourceCond.java
new file mode 100644
index 0000000..16a4381
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/ResourceCond.java
@@ -0,0 +1,42 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+/**
+ * Search condition to be applied when searching for associated resources.
+ */
+public class ResourceCond extends AbstractSearchCond {
+
+    private static final long serialVersionUID = 466054166309460002L;
+
+    private String resourceName;
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    public void setResourceName(final String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    @Override
+    public final boolean isValid() {
+        return resourceName != null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SearchCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SearchCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SearchCond.java
new file mode 100644
index 0000000..19e60da
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SearchCond.java
@@ -0,0 +1,254 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+import java.util.List;
+
+public class SearchCond extends AbstractSearchCond {
+
+    private static final long serialVersionUID = 661560782247499526L;
+
+    public enum Type {
+
+        LEAF,
+        NOT_LEAF,
+        AND,
+        OR
+
+    }
+
+    private Type type;
+
+    private SubjectCond subjectCond;
+
+    private AttributeCond attributeCond;
+
+    private MembershipCond membershipCond;
+
+    private ResourceCond resourceCond;
+
+    private EntitlementCond entitlementCond;
+
+    private SearchCond leftNodeCond;
+
+    private SearchCond rightNodeCond;
+
+    public static SearchCond getLeafCond(final AttributeCond attributeCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.LEAF;
+        if (attributeCond instanceof SubjectCond) {
+            nodeCond.subjectCond = (SubjectCond) attributeCond;
+        } else {
+            nodeCond.attributeCond = attributeCond;
+        }
+
+        return nodeCond;
+    }
+
+    public static SearchCond getLeafCond(final MembershipCond membershipCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.LEAF;
+        nodeCond.membershipCond = membershipCond;
+
+        return nodeCond;
+    }
+
+    public static SearchCond getLeafCond(final ResourceCond resourceCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.LEAF;
+        nodeCond.resourceCond = resourceCond;
+
+        return nodeCond;
+    }
+
+    public static SearchCond getLeafCond(final EntitlementCond entitlementCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.LEAF;
+        nodeCond.entitlementCond = entitlementCond;
+
+        return nodeCond;
+    }
+
+    public static SearchCond getNotLeafCond(final AttributeCond attributeCond) {
+        SearchCond nodeCond = getLeafCond(attributeCond);
+        nodeCond.type = Type.NOT_LEAF;
+        return nodeCond;
+    }
+
+    public static SearchCond getNotLeafCond(final MembershipCond membershipCond) {
+        SearchCond nodeCond = getLeafCond(membershipCond);
+        nodeCond.type = Type.NOT_LEAF;
+        return nodeCond;
+    }
+
+    public static SearchCond getNotLeafCond(final ResourceCond resourceCond) {
+        SearchCond nodeCond = getLeafCond(resourceCond);
+        nodeCond.type = Type.NOT_LEAF;
+        return nodeCond;
+    }
+
+    public static SearchCond getNotLeafCond(final EntitlementCond entitlementCond) {
+        SearchCond nodeCond = getLeafCond(entitlementCond);
+        nodeCond.type = Type.NOT_LEAF;
+        return nodeCond;
+    }
+
+    public static SearchCond getNotLeafCond(final SearchCond nodeCond) {
+        nodeCond.type = Type.NOT_LEAF;
+        return nodeCond;
+    }
+
+    public static SearchCond getAndCond(final SearchCond leftCond, final SearchCond rightCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.AND;
+        nodeCond.leftNodeCond = leftCond;
+        nodeCond.rightNodeCond = rightCond;
+
+        return nodeCond;
+    }
+
+    public static SearchCond getAndCond(final List<SearchCond> conditions) {
+        if (conditions.size() > 2) {
+            SearchCond removed = conditions.remove(0);
+            return getAndCond(removed, getAndCond(conditions));
+        } else {
+            return getAndCond(conditions.get(0), conditions.get(1));
+        }
+    }
+
+    public static SearchCond getOrCond(final SearchCond leftCond, final SearchCond rightCond) {
+        SearchCond nodeCond = new SearchCond();
+
+        nodeCond.type = Type.OR;
+        nodeCond.leftNodeCond = leftCond;
+        nodeCond.rightNodeCond = rightCond;
+
+        return nodeCond;
+    }
+
+    public static SearchCond getOrCond(final List<SearchCond> conditions) {
+        if (conditions.size() > 2) {
+            SearchCond removed = conditions.remove(0);
+            return getOrCond(removed, getOrCond(conditions));
+        } else {
+            return getOrCond(conditions.get(0), conditions.get(1));
+        }
+    }
+
+    public SubjectCond getSubjectCond() {
+        return subjectCond;
+    }
+
+    public void setSubjectCond(final SubjectCond subjectCond) {
+        this.subjectCond = subjectCond;
+    }
+
+    public AttributeCond getAttributeCond() {
+        return attributeCond;
+    }
+
+    public void setAttributeCond(final AttributeCond attributeCond) {
+        this.attributeCond = attributeCond;
+    }
+
+    public MembershipCond getMembershipCond() {
+        return membershipCond;
+    }
+
+    public void setMembershipCond(final MembershipCond membershipCond) {
+        this.membershipCond = membershipCond;
+    }
+
+    public ResourceCond getResourceCond() {
+        return resourceCond;
+    }
+
+    public void setResourceCond(final ResourceCond resourceCond) {
+        this.resourceCond = resourceCond;
+    }
+
+    public EntitlementCond getEntitlementCond() {
+        return entitlementCond;
+    }
+
+    public void setEntitlementCond(final EntitlementCond entitlementCond) {
+        this.entitlementCond = entitlementCond;
+    }
+
+    public SearchCond getLeftNodeCond() {
+        return leftNodeCond;
+    }
+
+    public void setLeftNodeCond(final SearchCond leftNodeCond) {
+        this.leftNodeCond = leftNodeCond;
+    }
+
+    public SearchCond getRightNodeCond() {
+        return rightNodeCond;
+    }
+
+    public void setRightNodeCond(final SearchCond rightNodeCond) {
+        this.rightNodeCond = rightNodeCond;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setType(final Type type) {
+        this.type = type;
+    }
+
+    public boolean isValid() {
+        boolean isValid = false;
+
+        if (type == null) {
+            return isValid;
+        }
+
+        switch (type) {
+            case LEAF:
+            case NOT_LEAF:
+                isValid = (subjectCond != null || attributeCond != null || membershipCond != null
+                        || resourceCond != null || entitlementCond != null)
+                        && (subjectCond == null || subjectCond.isValid())
+                        && (attributeCond == null || attributeCond.isValid())
+                        && (membershipCond == null || membershipCond.isValid())
+                        && (resourceCond == null || resourceCond.isValid())
+                        && (entitlementCond == null || entitlementCond.isValid());
+                break;
+
+            case AND:
+            case OR:
+                isValid = (leftNodeCond == null || rightNodeCond == null)
+                        ? false
+                        : leftNodeCond.isValid() && rightNodeCond.isValid();
+                break;
+
+            default:
+        }
+
+        return isValid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SubjectCond.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SubjectCond.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SubjectCond.java
new file mode 100644
index 0000000..333603e
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/search/SubjectCond.java
@@ -0,0 +1,34 @@
+/*
+ * 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.server.persistence.api.dao.search;
+
+/**
+ * Search condition to be applied when comparing bean field values.
+ */
+public class SubjectCond extends AttributeCond {
+
+    private static final long serialVersionUID = -1880319220462653955L;
+
+    public SubjectCond() {
+    }
+
+    public SubjectCond(final Type conditionType) {
+        super(conditionType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AccountPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AccountPolicy.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AccountPolicy.java
new file mode 100644
index 0000000..d962755
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AccountPolicy.java
@@ -0,0 +1,32 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.Set;
+
+public interface AccountPolicy extends Policy {
+
+    boolean addResource(ExternalResource resource);
+
+    boolean removeResource(ExternalResource resource);
+
+    Set<String> getResourceNames();
+
+    Set<? extends ExternalResource> getResources();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AnnotatedEntity.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AnnotatedEntity.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AnnotatedEntity.java
new file mode 100644
index 0000000..61afef1
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AnnotatedEntity.java
@@ -0,0 +1,40 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.Date;
+
+public interface AnnotatedEntity<KEY> extends Entity<KEY> {
+
+    Date getCreationDate();
+
+    String getCreator();
+
+    Date getLastChangeDate();
+
+    String getLastModifier();
+
+    void setCreationDate(Date creationDate);
+
+    void setCreator(String creator);
+
+    void setLastChangeDate(Date lastChangeDate);
+
+    void setLastModifier(String lastModifier);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attr.java
new file mode 100644
index 0000000..10df1c2
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attr.java
@@ -0,0 +1,30 @@
+/*
+ * 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.server.persistence.api.entity;
+
+public interface Attr<S extends Schema> extends Entity<Long> {
+
+    Attributable<?, ?, ?> getOwner();
+
+    void setOwner(Attributable<?, ?, ?> owner);
+
+    S getSchema();
+
+    void setSchema(S schema);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttrTemplate.java
new file mode 100644
index 0000000..6c86241
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttrTemplate.java
@@ -0,0 +1,32 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import org.apache.syncope.server.persistence.api.entity.role.Role;
+
+public interface AttrTemplate<S extends Schema> extends Entity<Long> {
+
+    Role getOwner();
+
+    void setOwner(Role role);
+
+    S getSchema();
+
+    void setSchema(S schema);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attributable.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attributable.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attributable.java
new file mode 100644
index 0000000..11cb3ea
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Attributable.java
@@ -0,0 +1,48 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.List;
+
+public interface Attributable<P extends PlainAttr, D extends DerAttr, V extends VirAttr> extends AnnotatedEntity<Long> {
+
+    boolean addPlainAttr(P attr);
+
+    boolean addDerAttr(D derAttr);
+
+    boolean addVirAttr(V virAttr);
+
+    boolean removePlainAttr(P attr);
+
+    boolean removeDerAttr(D derAttr);
+
+    boolean removeVirAttr(V virAttr);
+
+    P getPlainAttr(String plainSchemaName);
+
+    List<? extends P> getPlainAttrs();
+
+    D getDerAttr(String derSchemaName);
+
+    List<? extends D> getDerAttrs();
+
+    V getVirAttr(String virSchemaName);
+
+    List<? extends V> getVirAttrs();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtil.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtil.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtil.java
new file mode 100644
index 0000000..aac4201
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtil.java
@@ -0,0 +1,91 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.List;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+
+public interface AttributableUtil {
+
+    AttributableType getType();
+
+    <T extends Attributable<?, ?, ?>> Class<T> attributableClass();
+
+    <T extends PlainSchema> Class<T> plainSchemaClass();
+
+    <T extends PlainSchema> T newPlainSchema();
+
+    <T extends PlainAttr> Class<T> plainAttrClass();
+
+    <T extends PlainAttr> T newPlainAttr();
+
+    <T extends PlainAttrValue> Class<T> plainAttrValueClass();
+
+    <T extends PlainAttrValue> T newPlainAttrValue();
+
+    <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass();
+
+    <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass();
+
+    <T extends PlainAttrValue> T newPlainAttrUniqueValue();
+
+    <T extends DerSchema> Class<T> derSchemaClass();
+
+    <T extends DerSchema> T newDerSchema();
+
+    <T extends DerAttr> Class<T> derAttrClass();
+
+    <T extends DerAttr> T newDerAttr();
+
+    <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass();
+
+    <T extends VirSchema> Class<T> virSchemaClass();
+
+    <T extends VirSchema> T newVirSchema();
+
+    <T extends VirAttr> Class<T> virAttrClass();
+
+    <T extends VirAttr> T newVirAttr();
+
+    <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass();
+
+    <T extends MappingItem> T getAccountIdItem(ExternalResource resource);
+
+    String getAccountLink(ExternalResource resource);
+
+    <T extends MappingItem> List<T> getMappingItems(ExternalResource resource, MappingPurpose purpose);
+
+    <T extends MappingItem> List<T> getUidToMappingItems(ExternalResource resource, MappingPurpose purpose);
+
+    IntMappingType intMappingType();
+
+    IntMappingType derIntMappingType();
+
+    IntMappingType virIntMappingType();
+
+    <T extends MappingItem> Class<T> mappingItemClass();
+
+    <T extends AbstractAttributableTO> T newAttributableTO();
+
+    <T extends AbstractSubjectTO> T newSubjectTO();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtilFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtilFactory.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtilFactory.java
new file mode 100644
index 0000000..bcd66ea
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/AttributableUtilFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.server.persistence.api.entity;
+
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+
+public interface AttributableUtilFactory {
+
+    AttributableUtil getInstance(AttributableType type);
+
+    AttributableUtil getInstance(String attributableType);
+
+    AttributableUtil getInstance(ObjectClass objectClass);
+
+    AttributableUtil getInstance(Attributable<?, ?, ?> attributable);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnInstance.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnInstance.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnInstance.java
new file mode 100644
index 0000000..fb40eae
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnInstance.java
@@ -0,0 +1,71 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+
+public interface ConnInstance extends Entity<Long> {
+
+    boolean addCapability(ConnectorCapability capabitily);
+
+    boolean addResource(ExternalResource resource);
+
+    String getBundleName();
+
+    Set<ConnectorCapability> getCapabilities();
+
+    Set<ConnConfProperty> getConfiguration();
+
+    Integer getConnRequestTimeout();
+
+    String getConnectorName();
+
+    String getDisplayName();
+
+    String getLocation();
+
+    ConnPoolConf getPoolConf();
+
+    List<? extends ExternalResource> getResources();
+
+    String getVersion();
+
+    boolean removeCapability(ConnectorCapability capabitily);
+
+    boolean removeResource(ExternalResource resource);
+
+    void setBundleName(String bundleName);
+
+    void setConfiguration(Set<ConnConfProperty> configuration);
+
+    void setConnRequestTimeout(Integer timeout);
+
+    void setConnectorName(String connectorName);
+
+    void setDisplayName(String displayName);
+
+    void setLocation(String location);
+
+    void setPoolConf(ConnPoolConf poolConf);
+
+    void setVersion(String version);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnPoolConf.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnPoolConf.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnPoolConf.java
new file mode 100644
index 0000000..c4f16aa
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ConnPoolConf.java
@@ -0,0 +1,42 @@
+/*
+ * 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.server.persistence.api.entity;
+
+public interface ConnPoolConf {
+
+    Integer getMaxObjects();
+
+    void setMaxObjects(Integer maxObjects);
+
+    Integer getMinIdle();
+
+    void setMinIdle(Integer minIdle);
+
+    Integer getMaxIdle();
+
+    void setMaxIdle(Integer maxIdle);
+
+    Long getMaxWait();
+
+    void setMaxWait(Long maxWait);
+
+    Long getMinEvictableIdleTimeMillis();
+
+    void setMinEvictableIdleTimeMillis(Long minEvictableIdleTimeMillis);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerAttr.java
new file mode 100644
index 0000000..8b5c162
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerAttr.java
@@ -0,0 +1,26 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.Collection;
+
+public interface DerAttr extends Attr<DerSchema> {
+
+    String getValue(Collection<? extends PlainAttr> attrs);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerSchema.java
new file mode 100644
index 0000000..130d550
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/DerSchema.java
@@ -0,0 +1,26 @@
+/*
+ * 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.server.persistence.api.entity;
+
+public interface DerSchema extends Schema {
+
+    String getExpression();
+
+    void setExpression(String expression);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entitlement.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entitlement.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entitlement.java
new file mode 100644
index 0000000..a5a3d5c
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entitlement.java
@@ -0,0 +1,29 @@
+/*
+ * 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.server.persistence.api.entity;
+
+public interface Entitlement extends Entity<String> {
+
+    String getDescription();
+
+    void setKey(String key);
+
+    void setDescription(String description);
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entity.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entity.java
new file mode 100644
index 0000000..df97829
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Entity.java
@@ -0,0 +1,26 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.io.Serializable;
+
+public interface Entity<KEY> extends Serializable {
+
+    KEY getKey();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/EntityFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/EntityFactory.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/EntityFactory.java
new file mode 100644
index 0000000..f79dfab
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/EntityFactory.java
@@ -0,0 +1,28 @@
+package org.apache.syncope.server.persistence.api.entity;
+
+/*
+ * 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.
+ */
+public interface EntityFactory {
+
+    <KEY, T extends Entity<KEY>> T newEntity(Class<T> reference);
+
+    <T extends Policy> T newPolicy(Class<T> reference, boolean global);
+
+    ConnPoolConf newConnPoolConf();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Exec.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Exec.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Exec.java
new file mode 100644
index 0000000..4b8924a
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Exec.java
@@ -0,0 +1,45 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.Date;
+
+public interface Exec extends Entity<Long> {
+
+    Date getEndDate();
+
+    String getMessage();
+
+    Date getStartDate();
+
+    String getStatus();
+
+    void setEndDate(Date endDate);
+
+    /**
+     * Set a message for this execution, taking care of replacing every null character with newline.
+     *
+     * @param message the message to set for this execution
+     */
+    void setMessage(String message);
+
+    void setStartDate(Date startDate);
+
+    void setStatus(String status);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ExternalResource.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ExternalResource.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ExternalResource.java
new file mode 100644
index 0000000..8653d18
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/ExternalResource.java
@@ -0,0 +1,111 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import org.apache.syncope.server.persistence.api.entity.user.UMapping;
+import org.apache.syncope.server.persistence.api.entity.role.RMapping;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.PropagationMode;
+import org.apache.syncope.common.lib.types.TraceLevel;
+import org.identityconnectors.framework.common.objects.SyncToken;
+
+public interface ExternalResource extends AnnotatedEntity<String> {
+
+    AccountPolicy getAccountPolicy();
+
+    PasswordPolicy getPasswordPolicy();
+
+    SyncPolicy getSyncPolicy();
+
+    Set<ConnConfProperty> getConnInstanceConfiguration();
+
+    ConnInstance getConnector();
+
+    TraceLevel getCreateTraceLevel();
+
+    TraceLevel getUpdateTraceLevel();
+
+    TraceLevel getDeleteTraceLevel();
+
+    TraceLevel getSyncTraceLevel();
+
+    List<String> getPropagationActionsClassNames();
+
+    PropagationMode getPropagationMode();
+
+    Integer getPropagationPriority();
+
+    UMapping getUmapping();
+
+    RMapping getRmapping();
+
+    SyncToken getUsyncToken();
+
+    String getSerializedUSyncToken();
+
+    SyncToken getRsyncToken();
+
+    String getSerializedRSyncToken();
+
+    boolean isEnforceMandatoryCondition();
+
+    boolean isPropagationPrimary();
+
+    boolean isRandomPwdIfNotProvided();
+
+    void setKey(String name);
+
+    void setAccountPolicy(AccountPolicy accountPolicy);
+
+    void setPasswordPolicy(PasswordPolicy passwordPolicy);
+
+    void setSyncPolicy(SyncPolicy syncPolicy);
+
+    void setConnInstanceConfiguration(Set<ConnConfProperty> properties);
+
+    void setConnector(ConnInstance connector);
+
+    void setCreateTraceLevel(TraceLevel createTraceLevel);
+
+    void setUpdateTraceLevel(TraceLevel updateTraceLevel);
+
+    void setDeleteTraceLevel(TraceLevel deleteTraceLevel);
+
+    void setSyncTraceLevel(TraceLevel syncTraceLevel);
+
+    void setPropagationMode(PropagationMode propagationMode);
+
+    void setPropagationPriority(Integer priority);
+
+    void setUmapping(UMapping umapping);
+
+    void setRmapping(RMapping rmapping);
+
+    void setEnforceMandatoryCondition(boolean enforce);
+
+    void setPropagationPrimary(boolean condition);
+
+    void setRandomPwdIfNotProvided(boolean condition);
+
+    void setUsyncToken(SyncToken syncToken);
+
+    void setRsyncToken(SyncToken syncToken);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Logger.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Logger.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Logger.java
new file mode 100644
index 0000000..ef12f40
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Logger.java
@@ -0,0 +1,35 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import org.apache.syncope.common.lib.types.LoggerLevel;
+import org.apache.syncope.common.lib.types.LoggerType;
+
+public interface Logger extends Entity<String> {
+
+    void setKey(String name);
+
+    LoggerLevel getLevel();
+
+    void setLevel(LoggerLevel level);
+
+    LoggerType getType();
+
+    void setType(LoggerType type);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Mapping.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Mapping.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Mapping.java
new file mode 100644
index 0000000..de6184e
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Mapping.java
@@ -0,0 +1,42 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import java.util.List;
+
+public interface Mapping<T extends MappingItem> extends Entity<Long> {
+
+    T getAccountIdItem();
+
+    String getAccountLink();
+
+    List<? extends T> getItems();
+
+    ExternalResource getResource();
+
+    boolean addItem(T item);
+
+    boolean removeItem(T item);
+
+    void setAccountIdItem(T item);
+
+    void setAccountLink(String accountLink);
+
+    void setResource(ExternalResource resource);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/MappingItem.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/MappingItem.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/MappingItem.java
new file mode 100644
index 0000000..eddd4a0
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/MappingItem.java
@@ -0,0 +1,57 @@
+/*
+ * 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.server.persistence.api.entity;
+
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+
+public interface MappingItem extends Entity<Long> {
+
+    String getExtAttrName();
+
+    String getIntAttrName();
+
+    IntMappingType getIntMappingType();
+
+    String getMandatoryCondition();
+
+    Mapping<?> getMapping();
+
+    MappingPurpose getPurpose();
+
+    boolean isAccountid();
+
+    boolean isPassword();
+
+    void setAccountid(boolean accountid);
+
+    void setExtAttrName(String extAttrName);
+
+    void setIntAttrName(String intAttrName);
+
+    void setIntMappingType(IntMappingType intMappingType);
+
+    void setMandatoryCondition(String condition);
+
+    void setMapping(Mapping<?> mapping);
+
+    void setPassword(boolean password);
+
+    void setPurpose(MappingPurpose purpose);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Notification.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Notification.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Notification.java
new file mode 100644
index 0000000..80628ba
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/Notification.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.server.persistence.api.entity;
+
+import java.util.List;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.TraceLevel;
+
+public interface Notification extends Entity<Long> {
+
+    boolean addEvent(String event);
+
+    boolean addStaticRecipient(String staticRecipient);
+
+    List<String> getEvents();
+
+    String getRecipientAttrName();
+
+    IntMappingType getRecipientAttrType();
+
+    String getRecipients();
+
+    String getRoleAbout();
+
+    String getSender();
+
+    List<String> getStaticRecipients();
+
+    String getSubject();
+
+    String getTemplate();
+
+    TraceLevel getTraceLevel();
+
+    String getUserAbout();
+
+    boolean isActive();
+
+    boolean isSelfAsRecipient();
+
+    boolean removeEvent(String event);
+
+    boolean removeStaticRecipient(String staticRecipient);
+
+    void setActive(boolean active);
+
+    void setRecipientAttrName(String recipientAttrName);
+
+    void setRecipientAttrType(IntMappingType recipientAttrType);
+
+    void setRecipients(String recipients);
+
+    void setRoleAbout(String roleAbout);
+
+    void setSelfAsRecipient(boolean selfAsRecipient);
+
+    void setSender(String sender);
+
+    void setSubject(String subject);
+
+    void setTemplate(String template);
+
+    void setTraceLevel(TraceLevel traceLevel);
+
+    void setUserAbout(String userAbout);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/PasswordPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/PasswordPolicy.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/PasswordPolicy.java
new file mode 100644
index 0000000..2e943a6
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/entity/PasswordPolicy.java
@@ -0,0 +1,23 @@
+/*
+ * 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.server.persistence.api.entity;
+
+public interface PasswordPolicy extends Policy {
+    
+}