syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [29/32] syncope git commit: [SYNCOPE-620] JPA entities + basic tests
Date Thu, 01 Jan 2015 18:12:24 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttr.java
new file mode 100644
index 0000000..b134b01
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttr.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.persistence.api.entity.membership;
+
+import java.util.List;
+import org.apache.syncope.persistence.api.entity.PlainAttr;
+
+public interface MPlainAttr extends PlainAttr {
+
+    @Override
+    Membership getOwner();
+
+    @Override
+    MPlainSchema getSchema();
+
+    MPlainAttrTemplate getTemplate();
+
+    void setTemplate(MPlainAttrTemplate template);
+
+    @Override
+    List<? extends MPlainAttrValue> getValues();
+
+    @Override
+    MPlainAttrUniqueValue getUniqueValue();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrTemplate.java
new file mode 100644
index 0000000..ac6ab91
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrTemplate.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.membership;
+
+import org.apache.syncope.persistence.api.entity.AttrTemplate;
+
+public interface MPlainAttrTemplate extends AttrTemplate<MPlainSchema> {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrUniqueValue.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrUniqueValue.java
new file mode 100644
index 0000000..a611d8a
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainAttrUniqueValue.java
@@ -0,0 +1,31 @@
+/*
+ * 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.persistence.api.entity.membership;
+
+import org.apache.syncope.persistence.api.entity.PlainAttrUniqueValue;
+
+public interface MPlainAttrUniqueValue extends PlainAttrUniqueValue {
+
+    @Override
+    MPlainAttr getAttr();
+
+    @Override
+    MPlainSchema getSchema();
+
+}

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainSchema.java
new file mode 100644
index 0000000..3af8f97
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MPlainSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.membership;
+
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public interface MPlainSchema extends PlainSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttr.java
index 43e42fe..17a74ca 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttr.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttr.java
@@ -22,6 +22,12 @@ import org.apache.syncope.persistence.api.entity.VirAttr;
 
 public interface MVirAttr extends VirAttr {
 
+    @Override
+    Membership getOwner();
+
+    @Override
+    MVirSchema getSchema();
+
     MVirAttrTemplate getTemplate();
 
     void setTemplate(MVirAttrTemplate template);

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttrTemplate.java
index 6a47df0..1f3a688 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttrTemplate.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirAttrTemplate.java
@@ -19,8 +19,7 @@
 package org.apache.syncope.persistence.api.entity.membership;
 
 import org.apache.syncope.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.persistence.api.entity.VirSchema;
 
-public interface MVirAttrTemplate extends AttrTemplate<VirSchema> {
+public interface MVirAttrTemplate extends AttrTemplate<MVirSchema> {
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirSchema.java
new file mode 100644
index 0000000..8d5fa7b
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/MVirSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.membership;
+
+import org.apache.syncope.persistence.api.entity.VirSchema;
+
+public interface MVirSchema extends VirSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/Membership.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/Membership.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/Membership.java
index 15c2ad0..d07dbd6 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/Membership.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/membership/Membership.java
@@ -23,7 +23,7 @@ import org.apache.syncope.persistence.api.entity.Attributable;
 import org.apache.syncope.persistence.api.entity.role.Role;
 import org.apache.syncope.persistence.api.entity.user.User;
 
-public interface Membership extends Attributable<MNormAttr, MDerAttr, MVirAttr> {
+public interface Membership extends Attributable<MPlainAttr, MDerAttr, MVirAttr> {
 
     Role getRole();
 
@@ -34,38 +34,20 @@ public interface Membership extends Attributable<MNormAttr, MDerAttr, MVirAttr>
     void setUser(User user);
 
     @Override
-    boolean addNormAttr(MNormAttr attr);
+    MPlainAttr getPlainAttr(String plainSchemaName);
 
     @Override
-    boolean addDerAttr(MDerAttr attr);
-
-    @Override
-    boolean addVirAttr(MVirAttr attr);
-
-    @Override
-    MNormAttr getNormAttr(String normSchemaName);
-
-    @Override
-    List<MNormAttr> getNormAttrs();
+    List<? extends MPlainAttr> getPlainAttrs();
 
     @Override
     MDerAttr getDerAttr(String derSchemaName);
 
     @Override
-    List<MDerAttr> getDerAttrs();
+    List<? extends MDerAttr> getDerAttrs();
 
     @Override
     MVirAttr getVirAttr(String virSchemaName);
 
     @Override
-    List<MVirAttr> getVirAttrs();
-
-    @Override
-    boolean removeNormAttr(MNormAttr attr);
-
-    @Override
-    boolean removeDerAttr(MDerAttr derAttr);
-
-    @Override
-    boolean removeVirAttr(MVirAttr virAttr);
+    List<? extends MVirAttr> getVirAttrs();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttr.java
index b08c0a6..16a0c4e 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttr.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttr.java
@@ -20,7 +20,13 @@ package org.apache.syncope.persistence.api.entity.role;
 
 import org.apache.syncope.persistence.api.entity.DerAttr;
 
-public interface RDerAttr extends DerAttr<RNormAttr> {
+public interface RDerAttr extends DerAttr {
+
+    @Override
+    Role getOwner();
+
+    @Override
+    RDerSchema getSchema();
 
     RDerAttrTemplate getTemplate();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttrTemplate.java
index 832d8d2..66bf7e0 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttrTemplate.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerAttrTemplate.java
@@ -19,8 +19,7 @@
 package org.apache.syncope.persistence.api.entity.role;
 
 import org.apache.syncope.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.persistence.api.entity.DerSchema;
 
-public interface RDerAttrTemplate extends AttrTemplate<DerSchema> {
+public interface RDerAttrTemplate extends AttrTemplate<RDerSchema> {
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerSchema.java
new file mode 100644
index 0000000..583c783
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RDerSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.role;
+
+import org.apache.syncope.persistence.api.entity.DerSchema;
+
+public interface RDerSchema extends DerSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RMappingItem.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RMappingItem.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RMappingItem.java
index 9174683..983dc18 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RMappingItem.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RMappingItem.java
@@ -18,8 +18,12 @@
  */
 package org.apache.syncope.persistence.api.entity.role;
 
+import org.apache.syncope.persistence.api.entity.Mapping;
 import org.apache.syncope.persistence.api.entity.MappingItem;
 
 public interface RMappingItem extends MappingItem {
 
+    @Override
+    Mapping<RMappingItem> getMapping();
+
 }

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

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

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttr.java
new file mode 100644
index 0000000..e1cd627
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttr.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.persistence.api.entity.role;
+
+import java.util.List;
+import org.apache.syncope.persistence.api.entity.PlainAttr;
+
+public interface RPlainAttr extends PlainAttr {
+
+    @Override
+    Role getOwner();
+
+    @Override
+    RPlainSchema getSchema();
+
+    RPlainAttrTemplate getTemplate();
+
+    void setTemplate(RPlainAttrTemplate template);
+
+    @Override
+    List<? extends RPlainAttrValue> getValues();
+
+    @Override
+    RPlainAttrUniqueValue getUniqueValue();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrTemplate.java
new file mode 100644
index 0000000..231bffe
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrTemplate.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.role;
+
+import org.apache.syncope.persistence.api.entity.AttrTemplate;
+
+public interface RPlainAttrTemplate extends AttrTemplate<RPlainSchema> {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrUniqueValue.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrUniqueValue.java
new file mode 100644
index 0000000..5356ad7
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainAttrUniqueValue.java
@@ -0,0 +1,31 @@
+/*
+ * 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.persistence.api.entity.role;
+
+import org.apache.syncope.persistence.api.entity.PlainAttrUniqueValue;
+
+public interface RPlainAttrUniqueValue extends PlainAttrUniqueValue {
+
+    @Override
+    RPlainAttr getAttr();
+
+    @Override
+    RPlainSchema getSchema();
+
+}

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainSchema.java
new file mode 100644
index 0000000..5fc5da8
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RPlainSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.role;
+
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public interface RPlainSchema extends PlainSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttr.java
index 1ea6519..92810fc 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttr.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttr.java
@@ -22,6 +22,12 @@ import org.apache.syncope.persistence.api.entity.VirAttr;
 
 public interface RVirAttr extends VirAttr {
 
+    @Override
+    Role getOwner();
+
+    @Override
+    RVirSchema getSchema();
+
     RVirAttrTemplate getTemplate();
 
     void setTemplate(RVirAttrTemplate template);

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttrTemplate.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttrTemplate.java
index 3e07013..c7602a4 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttrTemplate.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirAttrTemplate.java
@@ -19,8 +19,7 @@
 package org.apache.syncope.persistence.api.entity.role;
 
 import org.apache.syncope.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.persistence.api.entity.VirSchema;
 
-public interface RVirAttrTemplate extends AttrTemplate<VirSchema> {
+public interface RVirAttrTemplate extends AttrTemplate<RVirSchema> {
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirSchema.java
new file mode 100644
index 0000000..1d4cb96
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/RVirSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.role;
+
+import org.apache.syncope.persistence.api.entity.VirSchema;
+
+public interface RVirSchema extends VirSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/Role.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/Role.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/Role.java
index 3d314e2..0c3ac50 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/Role.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/role/Role.java
@@ -28,7 +28,7 @@ import org.apache.syncope.persistence.api.entity.Schema;
 import org.apache.syncope.persistence.api.entity.Subject;
 import org.apache.syncope.persistence.api.entity.user.User;
 
-public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
+public interface Role extends Subject<RPlainAttr, RDerAttr, RVirAttr> {
 
     String getName();
 
@@ -43,21 +43,21 @@ public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
      *
      * @return a list of inherited and only inherited attributes.
      */
-    List<RNormAttr> findLastInheritedAncestorNormAttrs();
+    List<? extends RPlainAttr> findLastInheritedAncestorPlainAttrs();
 
     /**
      * Get all inherited derived attributes from the ancestors.
      *
      * @return a list of inherited and only inherited attributes.
      */
-    List<RDerAttr> findLastInheritedAncestorDerAttrs();
+    List<? extends RDerAttr> findLastInheritedAncestorDerAttrs();
 
     /**
      * Get all inherited virtual attributes from the ancestors.
      *
      * @return a list of inherited and only inherited attributes.
      */
-    List<RVirAttr> findLastInheritedAncestorVirAttrs();
+    List<? extends RVirAttr> findLastInheritedAncestorVirAttrs();
 
     /**
      * Get first valid account policy.
@@ -74,9 +74,9 @@ public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
 
     <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(Class<T> reference);
 
-    <T extends AttrTemplate<Schema>> List<T> getAttrTemplates(Class<T> reference);
+    <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(Class<T> reference);
 
-    Set<Entitlement> getEntitlements();
+    Set<? extends Entitlement> getEntitlements();
 
     /**
      * Get first valid password policy.
@@ -106,8 +106,6 @@ public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
 
     void setAccountPolicy(AccountPolicy accountPolicy);
 
-    void setEntitlements(List<Entitlement> entitlements);
-
     void setInheritAccountPolicy(boolean condition);
 
     void setInheritAttrs(boolean inheritAttrs);
@@ -133,7 +131,7 @@ public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
     void setUserOwner(User userOwner);
 
     @Override
-    boolean addNormAttr(RNormAttr attr);
+    boolean addPlainAttr(RPlainAttr attr);
 
     @Override
     boolean addDerAttr(RDerAttr attr);
@@ -142,25 +140,25 @@ public interface Role extends Subject<RNormAttr, RDerAttr, RVirAttr> {
     boolean addVirAttr(RVirAttr attr);
 
     @Override
-    RNormAttr getNormAttr(String normSchemaName);
+    RPlainAttr getPlainAttr(String plainSchemaName);
 
     @Override
-    List<RNormAttr> getNormAttrs();
+    List<? extends RPlainAttr> getPlainAttrs();
 
     @Override
     RDerAttr getDerAttr(String derSchemaName);
 
     @Override
-    List<RDerAttr> getDerAttrs();
+    List<? extends RDerAttr> getDerAttrs();
 
     @Override
     RVirAttr getVirAttr(String virSchemaName);
 
     @Override
-    List<RVirAttr> getVirAttrs();
+    List<? extends RVirAttr> getVirAttrs();
 
     @Override
-    boolean removeNormAttr(RNormAttr attr);
+    boolean removePlainAttr(RPlainAttr attr);
 
     @Override
     boolean removeDerAttr(RDerAttr derAttr);

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/NotificationTask.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/NotificationTask.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/NotificationTask.java
index a60ee2b..07c3744 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/NotificationTask.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/NotificationTask.java
@@ -45,8 +45,6 @@ public interface NotificationTask extends Task {
 
     boolean removeRecipient(String recipient);
 
-    void setRecipients(Set<String> recipients);
-
     void setSender(String sender);
 
     void setSubject(String subject);

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/SyncTask.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/SyncTask.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/SyncTask.java
index e51f379..1cf1e35 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/SyncTask.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/SyncTask.java
@@ -18,17 +18,20 @@
  */
 package org.apache.syncope.persistence.api.entity.task;
 
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.UserTO;
+
 public interface SyncTask extends ProvisioningTask {
 
-    String getRoleTemplate();
+    RoleTO getRoleTemplate();
 
-    String getUserTemplate();
+    UserTO getUserTemplate();
 
     boolean isFullReconciliation();
 
     void setFullReconciliation(boolean condition);
 
-    void setRoleTemplate(String roleTemplate);
+    void setRoleTemplate(RoleTO roleTemplate);
 
-    void setUserTemplate(String userTemplate);
+    void setUserTemplate(UserTO userTemplate);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/Task.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/Task.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/Task.java
index baf8637..7c7c005 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/Task.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/task/Task.java
@@ -19,15 +19,16 @@
 package org.apache.syncope.persistence.api.entity.task;
 
 import java.util.List;
+import org.apache.syncope.common.lib.types.TaskType;
 import org.apache.syncope.persistence.api.entity.Entity;
 
 public interface Task extends Entity<Long> {
 
+    TaskType getType();
+
     boolean addExec(TaskExec exec);
 
     boolean removeExec(TaskExec exec);
 
-    List<TaskExec> getExecs();
-
-    void setExecs(List<TaskExec> executions);
+    List<? extends TaskExec> getExecs();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerAttr.java
index ffec8ba..5c5e52d 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerAttr.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerAttr.java
@@ -20,6 +20,12 @@ package org.apache.syncope.persistence.api.entity.user;
 
 import org.apache.syncope.persistence.api.entity.DerAttr;
 
-public interface UDerAttr extends DerAttr<UNormAttr> {
+public interface UDerAttr extends DerAttr {
+
+    @Override
+    User getOwner();
+
+    @Override
+    UDerSchema getSchema();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerSchema.java
new file mode 100644
index 0000000..7ab8cb1
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UDerSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.user;
+
+import org.apache.syncope.persistence.api.entity.DerSchema;
+
+public interface UDerSchema extends DerSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java
index e14eefe..2352130 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java
@@ -18,8 +18,12 @@
  */
 package org.apache.syncope.persistence.api.entity.user;
 
+import org.apache.syncope.persistence.api.entity.Mapping;
 import org.apache.syncope.persistence.api.entity.MappingItem;
 
 public interface UMappingItem extends MappingItem {
 
+    @Override
+    Mapping<UMappingItem> getMapping();
+
 }

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

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java
new file mode 100644
index 0000000..59a9863
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.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.persistence.api.entity.user;
+
+import java.util.List;
+import org.apache.syncope.persistence.api.entity.PlainAttr;
+
+public interface UPlainAttr extends PlainAttr {
+
+    @Override
+    User getOwner();
+
+    @Override
+    UPlainSchema getSchema();
+
+    @Override
+    List<? extends UPlainAttrValue> getValues();
+
+    @Override
+    UPlainAttrUniqueValue getUniqueValue();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java
new file mode 100644
index 0000000..078da52
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java
@@ -0,0 +1,31 @@
+/*
+ * 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.persistence.api.entity.user;
+
+import org.apache.syncope.persistence.api.entity.PlainAttrUniqueValue;
+
+public interface UPlainAttrUniqueValue extends PlainAttrUniqueValue {
+
+    @Override
+    UPlainAttr getAttr();
+
+    @Override
+    UPlainSchema getSchema();
+
+}

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

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java
new file mode 100644
index 0000000..1ec236e
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.user;
+
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public interface UPlainSchema extends PlainSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java
index baf744d..78f6882 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java
@@ -22,4 +22,10 @@ import org.apache.syncope.persistence.api.entity.VirAttr;
 
 public interface UVirAttr extends VirAttr {
 
+    @Override
+    User getOwner();
+
+    @Override
+    UVirSchema getSchema();
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java
new file mode 100644
index 0000000..78575f7
--- /dev/null
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java
@@ -0,0 +1,25 @@
+/*
+ * 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.persistence.api.entity.user;
+
+import org.apache.syncope.persistence.api.entity.VirSchema;
+
+public interface UVirSchema extends VirSchema {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java
index c7aaf9f..6eece4d 100644
--- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java
+++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java
@@ -27,7 +27,7 @@ import org.apache.syncope.persistence.api.entity.Subject;
 import org.apache.syncope.persistence.api.entity.membership.Membership;
 import org.apache.syncope.persistence.api.entity.role.Role;
 
-public interface User extends Subject<UNormAttr, UDerAttr, UVirAttr> {
+public interface User extends Subject<UPlainAttr, UDerAttr, UVirAttr> {
 
     boolean addMembership(Membership membership);
 
@@ -49,9 +49,9 @@ public interface User extends Subject<UNormAttr, UDerAttr, UVirAttr> {
 
     Membership getMembership(Long syncopeRoleId);
 
-    List<Membership> getMemberships();
+    List<? extends Membership> getMemberships();
 
-    Set<ExternalResource> getOwnResources();
+    Set<? extends ExternalResource> getOwnResources();
 
     String getPassword();
 
@@ -95,8 +95,6 @@ public interface User extends Subject<UNormAttr, UDerAttr, UVirAttr> {
 
     void setLastLoginDate(Date lastLoginDate);
 
-    void setMemberships(List<Membership> memberships);
-
     void setPassword(String password, CipherAlgorithm cipherAlgoritm);
 
     void setSecurityAnswer(String securityAnswer);
@@ -114,39 +112,39 @@ public interface User extends Subject<UNormAttr, UDerAttr, UVirAttr> {
     boolean verifyPasswordHistory(String password, int size);
 
     @Override
-    boolean addNormAttr(UNormAttr attr);
+    boolean addPlainAttr(UPlainAttr attr);
 
     @Override
-    boolean addDerAttr(UDerAttr attr);
+    boolean removePlainAttr(UPlainAttr attr);
 
     @Override
-    boolean addVirAttr(UVirAttr attr);
+    boolean addDerAttr(UDerAttr attr);
 
     @Override
-    UNormAttr getNormAttr(String normSchemaName);
+    boolean removeDerAttr(UDerAttr derAttr);
 
     @Override
-    List<UNormAttr> getNormAttrs();
+    boolean addVirAttr(UVirAttr attr);
 
     @Override
-    UDerAttr getDerAttr(String derSchemaName);
+    boolean removeVirAttr(UVirAttr virAttr);
 
     @Override
-    List<UDerAttr> getDerAttrs();
+    UPlainAttr getPlainAttr(String plainSchemaName);
 
     @Override
-    UVirAttr getVirAttr(String virSchemaName);
+    List<? extends UPlainAttr> getPlainAttrs();
 
     @Override
-    List<UVirAttr> getVirAttrs();
+    UDerAttr getDerAttr(String derSchemaName);
 
     @Override
-    boolean removeNormAttr(UNormAttr attr);
+    List<? extends UDerAttr> getDerAttrs();
 
     @Override
-    boolean removeDerAttr(UDerAttr derAttr);
+    UVirAttr getVirAttr(String virSchemaName);
 
     @Override
-    boolean removeVirAttr(UVirAttr virAttr);
+    List<? extends UVirAttr> getVirAttrs();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/pom.xml b/syncope620/server/persistence-jpa/pom.xml
new file mode 100644
index 0000000..17b6a92
--- /dev/null
+++ b/syncope620/server/persistence-jpa/pom.xml
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.syncope</groupId>
+    <artifactId>syncope-server</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+  </parent>
+
+  <name>Apache Syncope Server Persistence JPA</name>
+  <description>Apache Syncope Server Persistence JPA</description>
+  <groupId>org.apache.syncope.server</groupId>
+  <artifactId>syncope-persistence-jpa</artifactId>
+  <packaging>jar</packaging>
+
+  <dependencies>    
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_2.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.el</groupId>
+      <artifactId>javax.el-api</artifactId>
+    </dependency>
+      
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-jdbc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-persistence-jdbc</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-dbcp2</artifactId>
+    </dependency>
+      
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-validator</artifactId>
+    </dependency>
+      
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-tx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-jdbc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-orm</artifactId>
+    </dependency>
+      
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+    </dependency>
+            
+    <dependency>
+      <groupId>org.quartz-scheduler</groupId>
+      <artifactId>quartz</artifactId>
+    </dependency>
+      
+    <dependency>
+      <groupId>org.apache.syncope.server</groupId>
+      <artifactId>syncope-provisioning-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.server</groupId>
+      <artifactId>syncope-persistence-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.server</groupId>
+      <artifactId>syncope-server-utils</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.server</groupId>
+      <artifactId>syncope-server-spring</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.server</groupId>
+      <artifactId>syncope-server-security</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    
+    <!-- TEST -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.h2database</groupId>
+      <artifactId>h2</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.openjpa</groupId>
+        <artifactId>openjpa-maven-plugin</artifactId>
+        <inherited>true</inherited>
+        <dependencies>
+          <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>${h2.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <persistenceXmlFile>${project.basedir}/src/main/resources/META-INF/spring-persistence.xml</persistenceXmlFile> 
+          <includes>org/apache/syncope/persistence/jpa/entity/**/*.class</includes>
+          <connectionDriverName>org.springframework.jdbc.datasource.DriverManagerDataSource</connectionDriverName>
+          <connectionProperties>
+            driverClassName=org.h2.Driver,
+            url=jdbc:h2:mem:syncopedb
+            username=sa,
+            password=
+          </connectionProperties>
+        </configuration>
+        <executions>
+          <execution>
+            <id>enhancer</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>enhance</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>        
+      </testResource>
+    </testResources>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>sqlgen</id>
+      
+      <properties>
+        <skipTests>true</skipTests>
+      </properties>
+      
+      <build>
+        <defaultGoal>clean verify</defaultGoal>
+        
+        <plugins>
+          <plugin>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-maven-plugin</artifactId>
+            <inherited>true</inherited>
+            <executions>
+              <execution>
+                <id>sqlgenr</id>
+                <phase>process-classes</phase>
+                <goals>
+                  <goal>sql</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>          
+        </plugins>
+      </build>
+        
+    </profile>
+  </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AbstractValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AbstractValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AbstractValidator.java
new file mode 100644
index 0000000..637f923
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AbstractValidator.java
@@ -0,0 +1,54 @@
+/*
+ * 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.persistence.jpa.attrvalue.validation;
+
+import java.io.Serializable;
+import org.apache.syncope.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.persistence.api.attrvalue.validation.Validator;
+import org.apache.syncope.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractValidator implements Validator, Serializable {
+
+    private static final long serialVersionUID = -5439345166669502493L;
+
+    /*
+     * Logger
+     */
+    protected static final Logger LOG = LoggerFactory.getLogger(AbstractValidator.class);
+
+    protected final PlainSchema schema;
+
+    public AbstractValidator(final PlainSchema schema) {
+        this.schema = schema;
+    }
+
+    @Override
+    public void validate(String value, PlainAttrValue attrValue)
+            throws ParsingValidationException, InvalidPlainAttrValueException {
+
+        attrValue.parseValue(schema, value);
+        doValidate(attrValue);
+    }
+
+    protected abstract void doValidate(PlainAttrValue attrValue) throws InvalidPlainAttrValueException;
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java
new file mode 100644
index 0000000..919da6d
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.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.persistence.jpa.attrvalue.validation;
+
+import org.apache.syncope.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public class AlwaysTrueValidator extends AbstractValidator {
+
+    private static final long serialVersionUID = 872107345555773183L;
+
+    public AlwaysTrueValidator(final PlainSchema schema) {
+        super(schema);
+    }
+
+    @Override
+    protected void doValidate(final PlainAttrValue attrValue) throws InvalidPlainAttrValueException {
+        Boolean value = attrValue.getValue();
+        if (!value) {
+            throw new InvalidPlainAttrValueException("This attribute must be set to \"true\"");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/BasicValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/BasicValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/BasicValidator.java
new file mode 100644
index 0000000..a2b9731
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/BasicValidator.java
@@ -0,0 +1,54 @@
+/*
+ * 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.persistence.jpa.attrvalue.validation;
+
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public class BasicValidator extends AbstractValidator {
+
+    private static final long serialVersionUID = -2606728447694223607L;
+
+    public BasicValidator(final PlainSchema schema) {
+        super(schema);
+    }
+
+    @Override
+    protected void doValidate(final PlainAttrValue attrValue) throws InvalidPlainAttrValueException {
+        if (AttrSchemaType.Enum == schema.getType()) {
+            final String[] enumeration = schema.getEnumerationValues().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+            final String value = attrValue.getStringValue();
+
+            boolean found = false;
+            for (int i = 0; i < enumeration.length && !found; i++) {
+                if (enumeration[i].trim().equals(value)) {
+                    found = true;
+                }
+            }
+
+            if (!found) {
+                throw new InvalidPlainAttrValueException(
+                        "'" + value + "' is not one of: " + schema.getEnumerationValues());
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/EmailAddressValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/EmailAddressValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/EmailAddressValidator.java
new file mode 100644
index 0000000..d334b65
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/attrvalue/validation/EmailAddressValidator.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.persistence.jpa.attrvalue.validation;
+
+import java.util.regex.Matcher;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.persistence.api.entity.PlainSchema;
+
+public class EmailAddressValidator extends AbstractValidator {
+
+    private static final long serialVersionUID = 792457177290331518L;
+
+    public EmailAddressValidator(final PlainSchema schema) {
+        super(schema);
+    }
+
+    @Override
+    protected void doValidate(final PlainAttrValue attrValue) throws InvalidPlainAttrValueException {
+        Matcher matcher = SyncopeConstants.EMAIL_PATTERN.matcher(attrValue.<CharSequence>getValue());
+        if (!matcher.matches()) {
+            throw new InvalidPlainAttrValueException("\"" + attrValue.getValue() + "\" is not a valid email address");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/556d5186/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/content/AbstractContentDealer.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/content/AbstractContentDealer.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/content/AbstractContentDealer.java
new file mode 100644
index 0000000..e3ad2d4
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/content/AbstractContentDealer.java
@@ -0,0 +1,88 @@
+/*
+ * 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.persistence.jpa.content;
+
+import java.io.IOException;
+import java.util.Properties;
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import org.apache.syncope.server.spring.ResourceWithFallbackLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.support.PropertiesLoaderUtils;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+public abstract class AbstractContentDealer {
+
+    protected static final Logger LOG = LoggerFactory.getLogger(AbstractContentDealer.class);
+
+    protected static final String ROOT_ELEMENT = "dataset";
+
+    @Resource(name = "database.schema")
+    protected String dbSchema;
+
+    @Resource(name = "indexesXML")
+    private ResourceWithFallbackLoader indexesXML;
+
+    @Resource(name = "viewsXML")
+    private ResourceWithFallbackLoader viewsXML;
+
+    @Autowired
+    protected DataSource dataSource;
+
+    protected void createIndexes() throws IOException {
+        LOG.debug("Creating indexes");
+
+        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+
+        Properties indexes = PropertiesLoaderUtils.loadProperties(indexesXML.getResource());
+        for (String idx : indexes.stringPropertyNames()) {
+            LOG.debug("Creating index {}", indexes.get(idx).toString());
+
+            try {
+                jdbcTemplate.execute(indexes.get(idx).toString());
+            } catch (DataAccessException e) {
+                LOG.error("Could not create index ", e);
+            }
+        }
+
+        LOG.debug("Indexes created");
+    }
+
+    protected void createViews() throws IOException {
+        LOG.debug("Creating views");
+
+        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+
+        Properties views = PropertiesLoaderUtils.loadProperties(viewsXML.getResource());
+        for (String idx : views.stringPropertyNames()) {
+            LOG.debug("Creating view {}", views.get(idx).toString());
+
+            try {
+                jdbcTemplate.execute(views.get(idx).toString().replaceAll("\\n", " "));
+            } catch (DataAccessException e) {
+                LOG.error("Could not create view ", e);
+            }
+        }
+
+        LOG.debug("Views created");
+    }
+}


Mime
View raw message