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:08 UTC

[29/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-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainAttrValueValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainAttrValueValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainAttrValueValidator.java
deleted file mode 100644
index f68bb66..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainAttrValueValidator.java
+++ /dev/null
@@ -1,98 +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.jpa.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.PlainAttrUniqueValue;
-import org.apache.syncope.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.persistence.api.entity.PlainSchema;
-import org.apache.syncope.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.persistence.api.entity.user.UPlainSchema;
-
-public class PlainAttrValueValidator extends AbstractValidator<PlainAttrValueCheck, PlainAttrValue> {
-
-    @Override
-    public boolean isValid(final PlainAttrValue object, final ConstraintValidatorContext context) {
-        boolean isValid;
-
-        if (object == null) {
-            isValid = true;
-        } else {
-            int nonNullVales = 0;
-            if (object.getBooleanValue() != null) {
-                nonNullVales++;
-            }
-            if (object.getDateValue() != null) {
-                nonNullVales++;
-            }
-            if (object.getDoubleValue() != null) {
-                nonNullVales++;
-            }
-            if (object.getLongValue() != null) {
-                nonNullVales++;
-            }
-            if (object.getBinaryValue() != null) {
-                nonNullVales++;
-            }
-            if (object.getStringValue() != null) {
-                nonNullVales++;
-            }
-            isValid = nonNullVales == 1;
-
-            if (!isValid) {
-                LOG.error("More than one non-null value for " + object);
-
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.MoreThanOneNonNull, "More than one non-null value found")).
-                        addPropertyNode(object.getClass().getSimpleName().replaceAll("\\n", " ")).
-                        addConstraintViolation();
-
-            } else if (object instanceof PlainAttrUniqueValue) {
-                PlainSchema uniqueValueSchema = ((PlainAttrUniqueValue) object).getSchema();
-                PlainSchema attrSchema = object.getAttr().getSchema();
-
-                isValid = uniqueValueSchema.equals(attrSchema);
-
-                if (!isValid) {
-                    LOG.error("Unique value schema for " + object.getClass().getSimpleName() + "[" + object.getKey()
-                            + "]" + " is " + uniqueValueSchema + ", while owning attribute schema is " + attrSchema);
-
-                    EntityViolationType violationType = attrSchema instanceof UPlainSchema
-                            ? EntityViolationType.InvalidUPlainSchema
-                            : attrSchema instanceof RPlainSchema
-                                    ? EntityViolationType.InvalidRPlainSchema
-                                    : attrSchema instanceof MPlainSchema
-                                            ? EntityViolationType.InvalidMPlainSchema
-                                            : EntityViolationType.InvalidCPlainSchema;
-
-                    context.disableDefaultConstraintViolation();
-                    context.buildConstraintViolationWithTemplate(getTemplate(violationType,
-                            "Unique value schema is " + uniqueValueSchema
-                            + ", while owning attribute schema is " + attrSchema)).addPropertyNode("schema").
-                            addConstraintViolation();
-                }
-            }
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaCheck.java
deleted file mode 100644
index fd25842..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = PlainSchemaValidator.class)
-@Documented
-public @interface PlainSchemaCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.schema}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaValidator.java
deleted file mode 100644
index 5267785..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PlainSchemaValidator.java
+++ /dev/null
@@ -1,61 +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.jpa.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.PlainSchema;
-
-public class PlainSchemaValidator extends AbstractValidator<PlainSchemaCheck, PlainSchema> {
-
-    @Override
-    public boolean isValid(final PlainSchema schema, final ConstraintValidatorContext context) {
-        boolean isValid = schema.getType() != AttrSchemaType.Enum
-                || StringUtils.isNotBlank(schema.getEnumerationValues());
-        if (!isValid) {
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidSchemaEnum, "Enumeration values missing")).
-                    addPropertyNode("enumerationValues").addConstraintViolation();
-        } else {
-            isValid = schema.getType() != AttrSchemaType.Encrypted
-                    || (schema.getSecretKey() != null && schema.getCipherAlgorithm() != null);
-            if (!isValid) {
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidSchemaEncrypted,
-                                "SecretKey or CipherAlgorithm missing")).
-                        addPropertyNode("secretKey").addPropertyNode("cipherAlgorithm").addConstraintViolation();
-            } else {
-                isValid = !schema.isMultivalue() || !schema.isUniqueConstraint();
-                if (!isValid) {
-                    context.disableDefaultConstraintViolation();
-                    context.buildConstraintViolationWithTemplate(
-                            getTemplate(EntityViolationType.InvalidSchemaMultivalueUnique,
-                                    "Cannot contemporary be multivalue and have unique constraint")).
-                            addPropertyNode("multiValue").addConstraintViolation();
-                }
-            }
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyCheck.java
deleted file mode 100644
index e67b662..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = PolicyValidator.class)
-@Documented
-public @interface PolicyCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.policy}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyValidator.java
deleted file mode 100644
index 551bc6f..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PolicyValidator.java
+++ /dev/null
@@ -1,59 +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.jpa.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.AccountPolicySpec;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.common.lib.types.PasswordPolicySpec;
-import org.apache.syncope.common.lib.types.SyncPolicySpec;
-import org.apache.syncope.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.Policy;
-import org.apache.syncope.persistence.api.entity.SyncPolicy;
-
-public class PolicyValidator extends AbstractValidator<PolicyCheck, Policy> {
-
-    @Override
-    public boolean isValid(final Policy object, final ConstraintValidatorContext context) {
-        context.disableDefaultConstraintViolation();
-
-        EntityViolationType violationType =
-                object instanceof PasswordPolicy
-                && !(object.getSpecification(PasswordPolicySpec.class) instanceof PasswordPolicySpec)
-                        ? EntityViolationType.InvalidPasswordPolicy
-                        : object instanceof AccountPolicy
-                        && !(object.getSpecification(AccountPolicySpec.class) instanceof AccountPolicySpec)
-                                ? EntityViolationType.InvalidAccountPolicy
-                                : object instanceof SyncPolicy
-                                && !(object.getSpecification(SyncPolicySpec.class) instanceof SyncPolicySpec)
-                                        ? EntityViolationType.InvalidSyncPolicy
-                                        : null;
-
-        if (violationType != null) {
-            context.buildConstraintViolationWithTemplate(getTemplate(violationType,
-                    "Invalid policy specification")).addPropertyNode("specification").
-                    addConstraintViolation();
-
-            return false;
-        }
-
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskCheck.java
deleted file mode 100644
index f6d374f..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = PropagationTaskValidator.class)
-@Documented
-public @interface PropagationTaskCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.propagationtask}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskValidator.java
deleted file mode 100644
index 8e53c47..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/PropagationTaskValidator.java
+++ /dev/null
@@ -1,65 +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.jpa.validation.entity;
-
-import java.util.List;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.task.TaskExec;
-
-public class PropagationTaskValidator extends AbstractValidator<PropagationTaskCheck, PropagationTask> {
-
-    @Override
-    public boolean isValid(final PropagationTask task, final ConstraintValidatorContext context) {
-        boolean isValid;
-
-        if (task == null) {
-            isValid = true;
-        } else {
-            isValid = task.getPropagationMode() != null
-                    && task.getPropagationOperation() != null
-                    && !task.getAttributes().isEmpty()
-                    && task.getResource() != null;
-
-            if (isValid) {
-                List<? extends TaskExec> executions = task.getExecs();
-                for (TaskExec execution : executions) {
-                    try {
-                        PropagationTaskExecStatus.valueOf(execution.getStatus());
-                    } catch (IllegalArgumentException e) {
-                        LOG.error("Invalid execution status '" + execution.getStatus() + "'", e);
-                        isValid = false;
-                    }
-                }
-            }
-
-            if (!isValid) {
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidPropagationTask, "Invalid task")).
-                        addPropertyNode(task.getClass().getSimpleName()).addConstraintViolation();
-            }
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskCheck.java
deleted file mode 100644
index affc52a..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = ProvisioningTaskValidator.class)
-@Documented
-public @interface ProvisioningTaskCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.abstractsynctask}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskValidator.java
deleted file mode 100644
index 01d1d5d..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ProvisioningTaskValidator.java
+++ /dev/null
@@ -1,84 +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.jpa.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPAPushTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPASyncTask;
-import org.apache.syncope.provisioning.api.sync.PushActions;
-import org.apache.syncope.provisioning.api.sync.SyncActions;
-
-public class ProvisioningTaskValidator extends AbstractValidator<ProvisioningTaskCheck, ProvisioningTask> {
-
-    private final SchedTaskValidator schedV;
-
-    public ProvisioningTaskValidator() {
-        super();
-
-        schedV = new SchedTaskValidator();
-    }
-
-    @Override
-    public boolean isValid(final ProvisioningTask object, final ConstraintValidatorContext context) {
-        boolean isValid = schedV.isValid(object, context);
-
-        if (isValid) {
-            isValid = object.getResource() != null;
-            if (!isValid) {
-                LOG.error("Resource is null");
-
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidSyncTask, "Resource cannot be null")).
-                        addPropertyNode("resource").addConstraintViolation();
-            }
-
-            if (!object.getActionsClassNames().isEmpty()) {
-                for (String className : object.getActionsClassNames()) {
-                    Class<?> actionsClass = null;
-                    boolean isAssignable = false;
-                    try {
-                        actionsClass = Class.forName(className);
-                        isAssignable = object instanceof JPASyncTask
-                                ? SyncActions.class.isAssignableFrom(actionsClass)
-                                : object instanceof JPAPushTask
-                                        ? PushActions.class.isAssignableFrom(actionsClass)
-                                        : false;
-                    } catch (Exception e) {
-                        LOG.error("Invalid SyncActions specified", e);
-                        isValid = false;
-                    }
-
-                    if (actionsClass == null || !isAssignable) {
-                        isValid = false;
-
-                        context.disableDefaultConstraintViolation();
-                        context.buildConstraintViolationWithTemplate(
-                                getTemplate(EntityViolationType.InvalidSyncTask, "Invalid class name")).
-                                addPropertyNode("actionsClassName").addConstraintViolation();
-                    }
-                }
-            }
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportCheck.java
deleted file mode 100644
index 7b18e8c..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = ReportValidator.class)
-@Documented
-public @interface ReportCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.report}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportValidator.java
deleted file mode 100644
index 9ae5cd6..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/ReportValidator.java
+++ /dev/null
@@ -1,67 +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.jpa.validation.entity;
-
-import java.text.ParseException;
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.report.ReportletConf;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.Report;
-import org.quartz.CronExpression;
-
-public class ReportValidator extends AbstractValidator<ReportCheck, Report> {
-
-    @Override
-    @SuppressWarnings("ResultOfObjectAllocationIgnored")
-    public boolean isValid(final Report object, final ConstraintValidatorContext context) {
-        boolean isValid = true;
-
-        if (object.getCronExpression() != null) {
-            try {
-                new CronExpression(object.getCronExpression());
-            } catch (ParseException e) {
-                LOG.error("Invalid cron expression '" + object.getCronExpression() + "'", e);
-                isValid = false;
-
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidReport, "Invalid cron expression")).
-                        addPropertyNode("cronExpression").addConstraintViolation();
-            }
-        }
-
-        Set<String> reportletNames = new HashSet<>();
-        for (ReportletConf conf : object.getReportletConfs()) {
-            reportletNames.add(conf.getName());
-        }
-        if (reportletNames.size() != object.getReportletConfs().size()) {
-            LOG.error("Reportlet name must be unique");
-            isValid = false;
-
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidReport, "Reportlet name must be unique")).
-                    addPropertyNode("reportletConfs").addConstraintViolation();
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleCheck.java
deleted file mode 100644
index fc9d958..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = RoleValidator.class)
-@Documented
-public @interface RoleCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.syncoperole}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleValidator.java
deleted file mode 100644
index a946b30..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/RoleValidator.java
+++ /dev/null
@@ -1,44 +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.jpa.validation.entity;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.role.Role;
-
-public class RoleValidator extends AbstractValidator<RoleCheck, Role> {
-
-    @Override
-    public boolean isValid(final Role object, final ConstraintValidatorContext context) {
-        context.disableDefaultConstraintViolation();
-
-        boolean isValid = true;
-
-        if (object.getUserOwner() != null && object.getRoleOwner() != null) {
-            isValid = false;
-
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidRoleOwner,
-                            "A role must either be owned by an user or a role, not both")).
-                    addPropertyNode("owner").addConstraintViolation();
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskCheck.java
deleted file mode 100644
index 2b67e4b..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = SchedTaskValidator.class)
-@Documented
-public @interface SchedTaskCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.schedtask}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskValidator.java
deleted file mode 100644
index 2591b94..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchedTaskValidator.java
+++ /dev/null
@@ -1,68 +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.jpa.validation.entity;
-
-import java.text.ParseException;
-
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.task.SchedTask;
-import org.quartz.CronExpression;
-import org.quartz.Job;
-
-public class SchedTaskValidator extends AbstractValidator<SchedTaskCheck, SchedTask> {
-
-    @Override
-    public boolean isValid(final SchedTask object, final ConstraintValidatorContext context) {
-        boolean isValid;
-
-        Class<?> jobClass = null;
-        try {
-            jobClass = Class.forName(object.getJobClassName());
-            isValid = Job.class.isAssignableFrom(jobClass);
-        } catch (Exception e) {
-            LOG.error("Invalid Job class specified", e);
-            isValid = false;
-        }
-        if (jobClass == null || !isValid) {
-            isValid = false;
-
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidSchedTask, "Invalid job class name")).
-                    addPropertyNode("jobClassName").addConstraintViolation();
-        }
-
-        if (isValid && object.getCronExpression() != null) {
-            try {
-                new CronExpression(object.getCronExpression());
-            } catch (ParseException e) {
-                LOG.error("Invalid cron expression '" + object.getCronExpression() + "'", e);
-                isValid = false;
-
-                context.disableDefaultConstraintViolation();
-                context.buildConstraintViolationWithTemplate(
-                        getTemplate(EntityViolationType.InvalidSchedTask, "Invalid cron expression")).
-                        addPropertyNode("cronExpression").addConstraintViolation();
-            }
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameCheck.java
deleted file mode 100644
index b445c79..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameCheck.java
+++ /dev/null
@@ -1,41 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = SchemaNameValidator.class)
-@Documented
-public @interface SchemaNameCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.schema}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameValidator.java
deleted file mode 100644
index eda316d..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/SchemaNameValidator.java
+++ /dev/null
@@ -1,133 +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.jpa.validation.entity;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import javax.validation.ConstraintValidatorContext;
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.persistence.api.entity.conf.CPlainSchema;
-import org.apache.syncope.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.persistence.api.entity.user.UDerSchema;
-import org.apache.syncope.persistence.api.entity.user.UPlainSchema;
-import org.apache.syncope.persistence.api.entity.user.UVirSchema;
-import org.apache.syncope.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.persistence.jpa.entity.role.JPARole;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUser;
-
-public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Object> {
-
-    private static final List<String> UNALLOWED_USCHEMA_NAMES = new ArrayList<>();
-
-    private static final List<String> UNALLOWED_MSCHEMA_NAMES = new ArrayList<>();
-
-    private static final List<String> UNALLOWED_RSCHEMA_NAMES = new ArrayList<>();
-
-    private static final List<String> UNALLOWED_CSCHEMA_NAMES = new ArrayList<>();
-
-    static {
-        initUnallowedSchemaNames(JPAUser.class, UNALLOWED_USCHEMA_NAMES);
-        initUnallowedSchemaNames(JPAMembership.class, UNALLOWED_MSCHEMA_NAMES);
-        initUnallowedSchemaNames(JPARole.class, UNALLOWED_RSCHEMA_NAMES);
-        initUnallowedSchemaNames(JPAConf.class, UNALLOWED_CSCHEMA_NAMES);
-    }
-
-    private static void initUnallowedSchemaNames(final Class<?> entityClass, final List<String> names) {
-        List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
-        classes.add(JPAUser.class);
-        for (Class<?> clazz : classes) {
-            for (Field field : clazz.getDeclaredFields()) {
-                if (!Collection.class.isAssignableFrom(field.getType())
-                        && !Map.class.isAssignableFrom(field.getType())) {
-
-                    names.add(field.getName());
-                }
-            }
-        }
-    }
-
-    @Override
-    public boolean isValid(final Object object, final ConstraintValidatorContext context) {
-        final String schemaName;
-        final List<String> unallowedNames;
-
-        if (object instanceof UPlainSchema) {
-            schemaName = ((UPlainSchema) object).getKey();
-            unallowedNames = UNALLOWED_USCHEMA_NAMES;
-        } else if (object instanceof UDerSchema) {
-            schemaName = ((UDerSchema) object).getKey();
-            unallowedNames = UNALLOWED_USCHEMA_NAMES;
-        } else if (object instanceof UVirSchema) {
-            schemaName = ((UVirSchema) object).getKey();
-            unallowedNames = UNALLOWED_USCHEMA_NAMES;
-        } else if (object instanceof MPlainSchema) {
-            schemaName = ((MPlainSchema) object).getKey();
-            unallowedNames = UNALLOWED_MSCHEMA_NAMES;
-        } else if (object instanceof MDerSchema) {
-            schemaName = ((MDerSchema) object).getKey();
-            unallowedNames = UNALLOWED_MSCHEMA_NAMES;
-        } else if (object instanceof MVirSchema) {
-            schemaName = ((MVirSchema) object).getKey();
-            unallowedNames = UNALLOWED_MSCHEMA_NAMES;
-        } else if (object instanceof RPlainSchema) {
-            schemaName = ((RPlainSchema) object).getKey();
-            unallowedNames = UNALLOWED_RSCHEMA_NAMES;
-        } else if (object instanceof RDerSchema) {
-            schemaName = ((RDerSchema) object).getKey();
-            unallowedNames = UNALLOWED_RSCHEMA_NAMES;
-        } else if (object instanceof RVirSchema) {
-            schemaName = ((RVirSchema) object).getKey();
-            unallowedNames = UNALLOWED_RSCHEMA_NAMES;
-        } else if (object instanceof CPlainSchema) {
-            schemaName = ((CPlainSchema) object).getKey();
-            unallowedNames = UNALLOWED_CSCHEMA_NAMES;
-        } else {
-            schemaName = null;
-            unallowedNames = Collections.emptyList();
-        }
-
-        boolean isValid = NAME_PATTERN.matcher(schemaName).matches();
-        if (!isValid) {
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Invalid Schema name")).
-                    addPropertyNode("name").addConstraintViolation();
-        } else if (unallowedNames.contains(schemaName)) {
-            context.disableDefaultConstraintViolation();
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidName, "Schema name not allowed: " + schemaName)).
-                    addPropertyNode("name").addConstraintViolation();
-
-            return false;
-        }
-
-        return isValid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserCheck.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserCheck.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserCheck.java
deleted file mode 100644
index 854d4dd..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserCheck.java
+++ /dev/null
@@ -1,42 +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.jpa.validation.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
-
-@Target( { ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = UserValidator.class)
-@Documented
-public @interface UserCheck {
-
-    String message() default "{org.apache.syncope.persistence.validation.syncopeuser}";
-
-    Class<?>[] groups() default {};
-
-    Class<? extends Payload>[] payload() default {};
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserValidator.java
deleted file mode 100644
index 5ef6917..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/validation/entity/UserValidator.java
+++ /dev/null
@@ -1,194 +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.jpa.validation.entity;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Resource;
-import javax.validation.ConstraintValidatorContext;
-import org.apache.syncope.common.lib.types.AccountPolicySpec;
-import org.apache.syncope.common.lib.types.EntityViolationType;
-import org.apache.syncope.common.lib.types.PasswordPolicySpec;
-import org.apache.syncope.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.Policy;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.server.utils.policy.AccountPolicyEnforcer;
-import org.apache.syncope.server.utils.policy.AccountPolicyException;
-import org.apache.syncope.server.utils.policy.PasswordPolicyEnforcer;
-import org.apache.syncope.server.utils.policy.PolicyEvaluator;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class UserValidator extends AbstractValidator<UserCheck, User> {
-
-    @Resource(name = "adminUser")
-    private String adminUser;
-
-    @Resource(name = "anonymousUser")
-    private String anonymousUser;
-
-    @Autowired
-    private PolicyDAO policyDAO;
-
-    @Autowired
-    private PolicyEvaluator evaluator;
-
-    @Autowired
-    private PasswordPolicyEnforcer ppEnforcer;
-
-    @Autowired
-    private AccountPolicyEnforcer apEnforcer;
-
-    @Override
-    public boolean isValid(final User user, final ConstraintValidatorContext context) {
-        context.disableDefaultConstraintViolation();
-
-        // ------------------------------
-        // Verify password policies
-        // ------------------------------
-        LOG.debug("Password Policy enforcement");
-
-        try {
-            int maxPPSpecHistory = 0;
-            for (Policy policy : getPasswordPolicies(user)) {
-                // evaluate policy
-                final PasswordPolicySpec ppSpec = evaluator.evaluate(policy, user);
-                // enforce policy
-                ppEnforcer.enforce(ppSpec, policy.getType(), user);
-
-                if (ppSpec.getHistoryLength() > maxPPSpecHistory) {
-                    maxPPSpecHistory = ppSpec.getHistoryLength();
-                }
-            }
-
-            // update user's password history with encrypted password
-            if (maxPPSpecHistory > 0 && user.getPassword() != null) {
-                user.getPasswordHistory().add(user.getPassword());
-            }
-            // keep only the last maxPPSpecHistory items in user's password history
-            if (maxPPSpecHistory < user.getPasswordHistory().size()) {
-                for (int i = 0; i < user.getPasswordHistory().size() - maxPPSpecHistory; i++) {
-                    user.getPasswordHistory().remove(i);
-                }
-            }
-        } catch (Exception e) {
-            LOG.debug("Invalid password");
-
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidPassword, e.getMessage())).
-                    addPropertyNode("password").addConstraintViolation();
-
-            return false;
-        } finally {
-            // password has been validated, let's remove its clear version
-            user.removeClearPassword();
-        }
-        // ------------------------------
-
-        // ------------------------------
-        // Verify account policies
-        // ------------------------------
-        LOG.debug("Account Policy enforcement");
-
-        try {
-            if (adminUser.equals(user.getUsername()) || anonymousUser.equals(user.getUsername())) {
-                throw new AccountPolicyException("Not allowed: " + user.getUsername());
-            }
-
-            // invalid username
-            for (Policy policy : getAccountPolicies(user)) {
-                // evaluate policy
-                final AccountPolicySpec accountPolicy = evaluator.evaluate(policy, user);
-
-                // enforce policy
-                apEnforcer.enforce(accountPolicy, policy.getType(), user);
-            }
-        } catch (Exception e) {
-            LOG.debug("Invalid username");
-
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.InvalidUsername, e.getMessage())).
-                    addPropertyNode("username").addConstraintViolation();
-
-            return false;
-        }
-        // ------------------------------
-
-        return true;
-    }
-
-    private List<PasswordPolicy> getPasswordPolicies(final User user) {
-        final List<PasswordPolicy> policies = new ArrayList<>();
-
-        // Add global policy
-        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
-        if (policy != null) {
-            policies.add(policy);
-        }
-
-        // add resource policies
-        for (ExternalResource resource : user.getResources()) {
-            policy = resource.getPasswordPolicy();
-            if (policy != null) {
-                policies.add(policy);
-            }
-        }
-
-        // add role policies
-        for (Role role : user.getRoles()) {
-            policy = role.getPasswordPolicy();
-            if (policy != null) {
-                policies.add(policy);
-            }
-        }
-
-        return policies;
-    }
-
-    private List<AccountPolicy> getAccountPolicies(final User user) {
-        final List<AccountPolicy> policies = new ArrayList<>();
-
-        // add global policy
-        AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
-        if (policy != null) {
-            policies.add(policy);
-        }
-
-        // add resource policies
-        for (ExternalResource resource : user.getResources()) {
-            policy = resource.getAccountPolicy();
-            if (policy != null) {
-                policies.add(policy);
-            }
-        }
-
-        // add role policies
-        for (Role role : user.getRoles()) {
-            policy = role.getAccountPolicy();
-            if (policy != null) {
-                policies.add(policy);
-            }
-        }
-
-        return policies;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AbstractValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AbstractValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AbstractValidator.java
new file mode 100644
index 0000000..f020a27
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/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.server.persistence.jpa.attrvalue.validation;
+
+import java.io.Serializable;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.Validator;
+import org.apache.syncope.server.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.server.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/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/AlwaysTrueValidator.java
new file mode 100644
index 0000000..5578e1d
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/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.server.persistence.jpa.attrvalue.validation;
+
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.server.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.server.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/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/BasicValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/BasicValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/BasicValidator.java
new file mode 100644
index 0000000..9e86497
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/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.server.persistence.jpa.attrvalue.validation;
+
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.server.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.server.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/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/EmailAddressValidator.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/EmailAddressValidator.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/attrvalue/validation/EmailAddressValidator.java
new file mode 100644
index 0000000..13ae1a8
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/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.server.persistence.jpa.attrvalue.validation;
+
+import java.util.regex.Matcher;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
+import org.apache.syncope.server.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.server.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/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/AbstractContentDealer.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/AbstractContentDealer.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/AbstractContentDealer.java
new file mode 100644
index 0000000..dbd984e
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/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.server.persistence.jpa.content;
+
+import java.io.IOException;
+import java.util.Properties;
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import org.apache.syncope.server.misc.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");
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/ContentLoaderHandler.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/ContentLoaderHandler.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/ContentLoaderHandler.java
new file mode 100644
index 0000000..27be00a
--- /dev/null
+++ b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/server/persistence/jpa/content/ContentLoaderHandler.java
@@ -0,0 +1,199 @@
+/*
+ * 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.jpa.content;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.DataSource;
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.syncope.server.misc.DataFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.ResultSetExtractor;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * SAX handler for generating SQL INSERT statements out of given XML file.
+ */
+class ContentLoaderHandler extends DefaultHandler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ContentLoaderHandler.class);
+
+    private final DataSource dataSource;
+
+    private final String rootElement;
+
+    public ContentLoaderHandler(final DataSource dataSource, final String rootElement) {
+        this.dataSource = dataSource;
+        this.rootElement = rootElement;
+    }
+
+    private Object[] getParameters(final String tableName, final Attributes attrs) {
+        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+
+        Map<String, Integer> colTypes = jdbcTemplate.query("SELECT * FROM " + tableName,
+                new ResultSetExtractor<Map<String, Integer>>() {
+
+                    @Override
+                    public Map<String, Integer> extractData(final ResultSet rs) throws SQLException, DataAccessException {
+                        Map<String, Integer> colTypes = new HashMap<String, Integer>();
+                        for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
+                            colTypes.put(rs.getMetaData().getColumnName(i).toUpperCase(),
+                                    rs.getMetaData().getColumnType(i));
+                        }
+                        return colTypes;
+                    }
+                });
+
+        Object[] parameters = new Object[attrs.getLength()];
+        for (int i = 0; i < attrs.getLength(); i++) {
+            Integer colType = colTypes.get(attrs.getQName(i).toUpperCase());
+            if (colType == null) {
+                LOG.warn("No column type found for {}", attrs.getQName(i).toUpperCase());
+                colType = Types.VARCHAR;
+            }
+
+            switch (colType) {
+                case Types.INTEGER:
+                case Types.TINYINT:
+                case Types.SMALLINT:
+                    try {
+                        parameters[i] = Integer.valueOf(attrs.getValue(i));
+                    } catch (NumberFormatException e) {
+                        LOG.error("Unparsable Integer '{}'", attrs.getValue(i));
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.NUMERIC:
+                case Types.DECIMAL:
+                case Types.BIGINT:
+                    try {
+                        parameters[i] = Long.valueOf(attrs.getValue(i));
+                    } catch (NumberFormatException e) {
+                        LOG.error("Unparsable Long '{}'", attrs.getValue(i));
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.DOUBLE:
+                    try {
+                        parameters[i] = Double.valueOf(attrs.getValue(i));
+                    } catch (NumberFormatException e) {
+                        LOG.error("Unparsable Double '{}'", attrs.getValue(i));
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.REAL:
+                case Types.FLOAT:
+                    try {
+                        parameters[i] = Float.valueOf(attrs.getValue(i));
+                    } catch (NumberFormatException e) {
+                        LOG.error("Unparsable Float '{}'", attrs.getValue(i));
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.DATE:
+                case Types.TIME:
+                case Types.TIMESTAMP:
+                    try {
+                        parameters[i] = DataFormat.parseDate(attrs.getValue(i));
+                    } catch (ParseException e) {
+                        LOG.error("Unparsable Date '{}'", attrs.getValue(i));
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.BIT:
+                case Types.BOOLEAN:
+                    parameters[i] = "1".equals(attrs.getValue(i)) ? Boolean.TRUE : Boolean.FALSE;
+                    break;
+
+                case Types.BINARY:
+                case Types.VARBINARY:
+                case Types.LONGVARBINARY:
+                    try {
+                        parameters[i] = Hex.decodeHex(attrs.getValue(i).toCharArray());
+                    } catch (DecoderException | IllegalArgumentException e) {
+                        parameters[i] = attrs.getValue(i);
+                    }
+                    break;
+
+                case Types.BLOB:
+                    try {
+                        parameters[i] = Hex.decodeHex(attrs.getValue(i).toCharArray());
+                    } catch (DecoderException | IllegalArgumentException e) {
+                        LOG.warn("Error decoding hex string to specify a blob parameter", e);
+                        parameters[i] = attrs.getValue(i);
+                    } catch (Exception e) {
+                        LOG.warn("Error creating a new blob parameter", e);
+                    }
+                    break;
+
+                default:
+                    parameters[i] = attrs.getValue(i);
+            }
+        }
+
+        return parameters;
+    }
+
+    @Override
+    public void startElement(final String uri, final String localName, final String qName, final Attributes atts)
+            throws SAXException {
+
+        // skip root element
+        if (rootElement.equals(qName)) {
+            return;
+        }
+
+        StringBuilder query = new StringBuilder("INSERT INTO ").append(qName).append('(');
+
+        StringBuilder values = new StringBuilder();
+
+        for (int i = 0; i < atts.getLength(); i++) {
+            query.append(atts.getQName(i));
+            values.append('?');
+            if (i < atts.getLength() - 1) {
+                query.append(',');
+                values.append(',');
+            }
+        }
+        query.append(") VALUES (").append(values).append(')');
+
+        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+
+        try {
+            jdbcTemplate.update(query.toString(), getParameters(qName, atts));
+        } catch (DataAccessException e) {
+            LOG.error("While trying to perform {}", query, e);
+        }
+    }
+}