syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [50/52] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Unit tests all in
Date Mon, 12 Jan 2015 16:32:29 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConfigurationLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConfigurationLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConfigurationLogic.java
index 581f640..06bb568 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConfigurationLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConfigurationLogic.java
@@ -26,17 +26,17 @@ import java.util.Set;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.lib.wrap.Validator;
-import org.apache.syncope.persistence.api.content.ContentExporter;
-import org.apache.syncope.persistence.api.dao.ConfDAO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.persistence.api.entity.conf.CPlainAttr;
-import org.apache.syncope.persistence.api.entity.conf.CPlainSchema;
-import org.apache.syncope.server.logic.data.ConfigurationDataBinder;
+import org.apache.syncope.server.persistence.api.content.ContentExporter;
+import org.apache.syncope.server.persistence.api.dao.ConfDAO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainAttr;
+import org.apache.syncope.server.persistence.api.entity.conf.CPlainSchema;
+import org.apache.syncope.server.provisioning.api.data.ConfigurationDataBinder;
 import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
 import org.apache.syncope.server.logic.init.WorkflowAdapterLoader;
-import org.apache.syncope.server.logic.notification.NotificationManager;
-import org.apache.syncope.server.spring.ResourceWithFallbackLoader;
+import org.apache.syncope.server.provisioning.java.notification.NotificationManager;
+import org.apache.syncope.server.misc.spring.ResourceWithFallbackLoader;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.Resource;
 import org.springframework.security.access.prepost.PreAuthorize;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConnectorLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConnectorLogic.java
index ee550cd..f7043cd 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConnectorLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ConnectorLogic.java
@@ -33,15 +33,15 @@ import org.apache.syncope.common.lib.to.ConnBundleTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.persistence.api.dao.ConnInstanceDAO;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.provisioning.api.Connector;
-import org.apache.syncope.provisioning.api.ConnectorFactory;
-import org.apache.syncope.server.logic.data.ConnInstanceDataBinder;
+import org.apache.syncope.server.persistence.api.dao.ConnInstanceDAO;
+import org.apache.syncope.server.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.entity.ConnInstance;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.provisioning.api.ConnIdBundleManager;
+import org.apache.syncope.server.provisioning.api.Connector;
+import org.apache.syncope.server.provisioning.api.ConnectorFactory;
+import org.apache.syncope.server.provisioning.api.data.ConnInstanceDataBinder;
 import org.identityconnectors.common.l10n.CurrentLocale;
 import org.identityconnectors.framework.api.ConfigurationProperties;
 import org.identityconnectors.framework.api.ConnectorInfo;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/EntitlementLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/EntitlementLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/EntitlementLogic.java
index e71fcb9..d0b051c 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/EntitlementLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/EntitlementLogic.java
@@ -23,9 +23,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import org.apache.syncope.common.lib.wrap.EntitlementTO;
-import org.apache.syncope.persistence.api.dao.EntitlementDAO;
-import org.apache.syncope.persistence.api.entity.Entitlement;
-import org.apache.syncope.server.security.AuthContextUtil;
+import org.apache.syncope.server.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.server.persistence.api.entity.Entitlement;
+import org.apache.syncope.server.misc.security.AuthContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LoggerLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LoggerLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LoggerLogic.java
index 5356b86..47db825 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LoggerLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LoggerLogic.java
@@ -40,16 +40,16 @@ import org.apache.syncope.common.lib.types.LoggerLevel;
 import org.apache.syncope.common.lib.types.LoggerType;
 import org.apache.syncope.common.lib.types.ResourceOperation;
 import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.LoggerDAO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.TaskDAO;
-import org.apache.syncope.persistence.api.entity.EntityFactory;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.Logger;
-import org.apache.syncope.persistence.api.entity.task.SchedTask;
-import org.apache.syncope.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.server.spring.BeanUtils;
+import org.apache.syncope.server.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.server.persistence.api.dao.LoggerDAO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.TaskDAO;
+import org.apache.syncope.server.persistence.api.entity.EntityFactory;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.Logger;
+import org.apache.syncope.server.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.server.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.server.misc.spring.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LogicInvocationHandler.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LogicInvocationHandler.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LogicInvocationHandler.java
index 81ca56f..0baad34 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LogicInvocationHandler.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/LogicInvocationHandler.java
@@ -21,8 +21,8 @@ package org.apache.syncope.server.logic;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import org.apache.syncope.common.lib.types.AuditElements;
-import org.apache.syncope.server.logic.audit.AuditManager;
-import org.apache.syncope.server.logic.notification.NotificationManager;
+import org.apache.syncope.server.misc.AuditManager;
+import org.apache.syncope.server.provisioning.java.notification.NotificationManager;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationController.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationController.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationController.java
deleted file mode 100644
index 053cf3f..0000000
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationController.java
+++ /dev/null
@@ -1,127 +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.server.logic;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.NotificationTO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.NotificationDAO;
-import org.apache.syncope.persistence.api.entity.Notification;
-import org.apache.syncope.server.logic.data.NotificationDataBinder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Component;
-
-@Component
-public class NotificationController extends AbstractTransactionalLogic<NotificationTO> {
-
-    @Autowired
-    private NotificationDAO notificationDAO;
-
-    @Autowired
-    private NotificationDataBinder binder;
-
-    @PreAuthorize("hasRole('NOTIFICATION_READ')")
-    public NotificationTO read(final Long notificationId) {
-        Notification notification = notificationDAO.find(notificationId);
-        if (notification == null) {
-            LOG.error("Could not find notification '" + notificationId + "'");
-
-            throw new NotFoundException(String.valueOf(notificationId));
-        }
-
-        return binder.getNotificationTO(notification);
-    }
-
-    @PreAuthorize("hasRole('NOTIFICATION_LIST')")
-    public List<NotificationTO> list() {
-        List<Notification> notifications = notificationDAO.findAll();
-
-        List<NotificationTO> notificationTOs = new ArrayList<NotificationTO>();
-        for (Notification notification : notifications) {
-            notificationTOs.add(binder.getNotificationTO(notification));
-        }
-
-        return notificationTOs;
-    }
-
-    @PreAuthorize("hasRole('NOTIFICATION_CREATE')")
-    public NotificationTO create(final NotificationTO notificationTO) {
-        return binder.getNotificationTO(notificationDAO.save(binder.create(notificationTO)));
-    }
-
-    @PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
-    public NotificationTO update(final NotificationTO notificationTO) {
-        Notification notification = notificationDAO.find(notificationTO.getKey());
-        if (notification == null) {
-            LOG.error("Could not find notification '" + notificationTO.getKey() + "'");
-            throw new NotFoundException(String.valueOf(notificationTO.getKey()));
-        }
-
-        binder.update(notification, notificationTO);
-        notification = notificationDAO.save(notification);
-
-        return binder.getNotificationTO(notification);
-    }
-
-    @PreAuthorize("hasRole('CONNECTOR_DELETE')")
-    public NotificationTO delete(final Long notificationId) {
-        Notification notification = notificationDAO.find(notificationId);
-        if (notification == null) {
-            LOG.error("Could not find notification '" + notificationId + "'");
-
-            throw new NotFoundException(String.valueOf(notificationId));
-        }
-
-        NotificationTO deleted = binder.getNotificationTO(notification);
-        notificationDAO.delete(notificationId);
-        return deleted;
-    }
-
-    @Override
-    protected NotificationTO resolveReference(final Method method, final Object... args)
-            throws UnresolvedReferenceException {
-
-        Long id = null;
-
-        if (ArrayUtils.isNotEmpty(args)) {
-            for (int i = 0; id == null && i < args.length; i++) {
-                if (args[i] instanceof Long) {
-                    id = (Long) args[i];
-                } else if (args[i] instanceof NotificationTO) {
-                    id = ((NotificationTO) args[i]).getKey();
-                }
-            }
-        }
-
-        if ((id != null) && !id.equals(0l)) {
-            try {
-                return binder.getNotificationTO(notificationDAO.find(id));
-            } catch (Throwable ignore) {
-                LOG.debug("Unresolved reference", ignore);
-                throw new UnresolvedReferenceException(ignore);
-            }
-        }
-
-        throw new UnresolvedReferenceException();
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationLogic.java
new file mode 100644
index 0000000..3e4ce46
--- /dev/null
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/NotificationLogic.java
@@ -0,0 +1,127 @@
+/*
+ * 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.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.to.NotificationTO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.NotificationDAO;
+import org.apache.syncope.server.persistence.api.entity.Notification;
+import org.apache.syncope.server.provisioning.api.data.NotificationDataBinder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NotificationLogic extends AbstractTransactionalLogic<NotificationTO> {
+
+    @Autowired
+    private NotificationDAO notificationDAO;
+
+    @Autowired
+    private NotificationDataBinder binder;
+
+    @PreAuthorize("hasRole('NOTIFICATION_READ')")
+    public NotificationTO read(final Long notificationId) {
+        Notification notification = notificationDAO.find(notificationId);
+        if (notification == null) {
+            LOG.error("Could not find notification '" + notificationId + "'");
+
+            throw new NotFoundException(String.valueOf(notificationId));
+        }
+
+        return binder.getNotificationTO(notification);
+    }
+
+    @PreAuthorize("hasRole('NOTIFICATION_LIST')")
+    public List<NotificationTO> list() {
+        List<Notification> notifications = notificationDAO.findAll();
+
+        List<NotificationTO> notificationTOs = new ArrayList<NotificationTO>();
+        for (Notification notification : notifications) {
+            notificationTOs.add(binder.getNotificationTO(notification));
+        }
+
+        return notificationTOs;
+    }
+
+    @PreAuthorize("hasRole('NOTIFICATION_CREATE')")
+    public NotificationTO create(final NotificationTO notificationTO) {
+        return binder.getNotificationTO(notificationDAO.save(binder.create(notificationTO)));
+    }
+
+    @PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
+    public NotificationTO update(final NotificationTO notificationTO) {
+        Notification notification = notificationDAO.find(notificationTO.getKey());
+        if (notification == null) {
+            LOG.error("Could not find notification '" + notificationTO.getKey() + "'");
+            throw new NotFoundException(String.valueOf(notificationTO.getKey()));
+        }
+
+        binder.update(notification, notificationTO);
+        notification = notificationDAO.save(notification);
+
+        return binder.getNotificationTO(notification);
+    }
+
+    @PreAuthorize("hasRole('CONNECTOR_DELETE')")
+    public NotificationTO delete(final Long notificationId) {
+        Notification notification = notificationDAO.find(notificationId);
+        if (notification == null) {
+            LOG.error("Could not find notification '" + notificationId + "'");
+
+            throw new NotFoundException(String.valueOf(notificationId));
+        }
+
+        NotificationTO deleted = binder.getNotificationTO(notification);
+        notificationDAO.delete(notificationId);
+        return deleted;
+    }
+
+    @Override
+    protected NotificationTO resolveReference(final Method method, final Object... args)
+            throws UnresolvedReferenceException {
+
+        Long id = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; id == null && i < args.length; i++) {
+                if (args[i] instanceof Long) {
+                    id = (Long) args[i];
+                } else if (args[i] instanceof NotificationTO) {
+                    id = ((NotificationTO) args[i]).getKey();
+                }
+            }
+        }
+
+        if ((id != null) && !id.equals(0l)) {
+            try {
+                return binder.getNotificationTO(notificationDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyController.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyController.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyController.java
deleted file mode 100644
index fbfb127..0000000
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyController.java
+++ /dev/null
@@ -1,197 +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.server.logic;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
-import org.apache.syncope.common.lib.to.AccountPolicyTO;
-import org.apache.syncope.common.lib.to.PasswordPolicyTO;
-import org.apache.syncope.common.lib.to.SyncPolicyTO;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.PolicyDAO;
-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;
-import org.apache.syncope.server.logic.data.PolicyDataBinder;
-import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PolicyController extends AbstractTransactionalLogic<AbstractPolicyTO> {
-
-    @Autowired
-    private ImplementationClassNamesLoader classNamesLoader;
-
-    @Autowired
-    private PolicyDAO policyDAO;
-
-    @Autowired
-    private PolicyDataBinder binder;
-
-    @PreAuthorize("hasRole('POLICY_CREATE')")
-    public <T extends AbstractPolicyTO> T create(final T policyTO) {
-        return binder.getPolicyTO(policyDAO.save(binder.getPolicy(null, policyTO)));
-    }
-
-    private <T extends AbstractPolicyTO, K extends Policy> T update(final T policyTO, final K policy) {
-        binder.getPolicy(policy, policyTO);
-        K savedPolicy = policyDAO.save(policy);
-        return binder.getPolicyTO(savedPolicy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_UPDATE')")
-    public PasswordPolicyTO update(final PasswordPolicyTO policyTO) {
-        Policy policy = policyDAO.find(policyTO.getId());
-        if (!(policy instanceof PasswordPolicy)) {
-            throw new NotFoundException("PasswordPolicy with id " + policyTO.getId());
-        }
-
-        return update(policyTO, policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_UPDATE')")
-    public AccountPolicyTO update(final AccountPolicyTO policyTO) {
-        Policy policy = policyDAO.find(policyTO.getId());
-        if (!(policy instanceof AccountPolicy)) {
-            throw new NotFoundException("AccountPolicy with id " + policyTO.getId());
-        }
-
-        return update(policyTO, policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_UPDATE')")
-    public SyncPolicyTO update(final SyncPolicyTO policyTO) {
-        Policy policy = policyDAO.find(policyTO.getId());
-        if (!(policy instanceof SyncPolicy)) {
-            throw new NotFoundException("SyncPolicy with id " + policyTO.getId());
-        }
-
-        return update(policyTO, policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_LIST')")
-    @SuppressWarnings("unchecked")
-    public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
-
-        List<? extends Policy> policies = policyDAO.find(type);
-
-        final List<T> policyTOs = new ArrayList<T>();
-        for (Policy policy : policies) {
-            policyTOs.add((T) binder.getPolicyTO(policy));
-        }
-
-        return policyTOs;
-    }
-
-    @PreAuthorize("hasRole('POLICY_READ')")
-    public PasswordPolicyTO getGlobalPasswordPolicy() {
-        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
-        if (policy == null) {
-            throw new NotFoundException("No password policy found");
-        }
-
-        return (PasswordPolicyTO) binder.getPolicyTO(policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_READ')")
-    public AccountPolicyTO getGlobalAccountPolicy() {
-        AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
-        if (policy == null) {
-            throw new NotFoundException("No account policy found");
-        }
-
-        return (AccountPolicyTO) binder.getPolicyTO(policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_READ')")
-    public SyncPolicyTO getGlobalSyncPolicy() {
-        SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
-        if (policy == null) {
-            throw new NotFoundException("No sync policy found");
-        }
-
-        return (SyncPolicyTO) binder.getPolicyTO(policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_READ')")
-    public <T extends AbstractPolicyTO> T read(final Long id) {
-        Policy policy = policyDAO.find(id);
-        if (policy == null) {
-            throw new NotFoundException("Policy " + id + " not found");
-        }
-
-        return binder.getPolicyTO(policy);
-    }
-
-    @PreAuthorize("hasRole('POLICY_DELETE')")
-    public <T extends AbstractPolicyTO> T delete(final Long id) {
-        Policy policy = policyDAO.find(id);
-        if (policy == null) {
-            throw new NotFoundException("Policy " + id + " not found");
-        }
-
-        T policyToDelete = binder.getPolicyTO(policy);
-        policyDAO.delete(policy);
-
-        return policyToDelete;
-    }
-
-    @PreAuthorize("hasRole('POLICY_LIST')")
-    public Set<String> getSyncCorrelationRuleClasses() {
-        return classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_CORRELATION_RULES);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected AbstractPolicyTO resolveReference(final Method method, final Object... args)
-            throws UnresolvedReferenceException {
-        Long id = null;
-
-        if (ArrayUtils.isNotEmpty(args)) {
-            for (int i = 0; id == null && i < args.length; i++) {
-                if (args[i] instanceof Long) {
-                    id = (Long) args[i];
-                } else if (args[i] instanceof AbstractPolicyTO) {
-                    id = ((AbstractPolicyTO) args[i]).getId();
-                }
-            }
-        }
-
-        if ((id != null) && !id.equals(0l)) {
-            try {
-                return binder.getPolicyTO(policyDAO.find(id));
-            } catch (Throwable ignore) {
-                LOG.debug("Unresolved reference", ignore);
-                throw new UnresolvedReferenceException(ignore);
-            }
-        }
-
-        throw new UnresolvedReferenceException();
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyLogic.java
new file mode 100644
index 0000000..1bc03de
--- /dev/null
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/PolicyLogic.java
@@ -0,0 +1,197 @@
+/*
+ * 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.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.to.AccountPolicyTO;
+import org.apache.syncope.common.lib.to.PasswordPolicyTO;
+import org.apache.syncope.common.lib.to.SyncPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.PolicyDAO;
+import org.apache.syncope.server.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.server.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.server.persistence.api.entity.Policy;
+import org.apache.syncope.server.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.server.provisioning.api.data.PolicyDataBinder;
+import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PolicyLogic extends AbstractTransactionalLogic<AbstractPolicyTO> {
+
+    @Autowired
+    private ImplementationClassNamesLoader classNamesLoader;
+
+    @Autowired
+    private PolicyDAO policyDAO;
+
+    @Autowired
+    private PolicyDataBinder binder;
+
+    @PreAuthorize("hasRole('POLICY_CREATE')")
+    public <T extends AbstractPolicyTO> T create(final T policyTO) {
+        return binder.getPolicyTO(policyDAO.save(binder.getPolicy(null, policyTO)));
+    }
+
+    private <T extends AbstractPolicyTO, K extends Policy> T update(final T policyTO, final K policy) {
+        binder.getPolicy(policy, policyTO);
+        K savedPolicy = policyDAO.save(policy);
+        return binder.getPolicyTO(savedPolicy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_UPDATE')")
+    public PasswordPolicyTO update(final PasswordPolicyTO policyTO) {
+        Policy policy = policyDAO.find(policyTO.getKey());
+        if (!(policy instanceof PasswordPolicy)) {
+            throw new NotFoundException("PasswordPolicy with id " + policyTO.getKey());
+        }
+
+        return update(policyTO, policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_UPDATE')")
+    public AccountPolicyTO update(final AccountPolicyTO policyTO) {
+        Policy policy = policyDAO.find(policyTO.getKey());
+        if (!(policy instanceof AccountPolicy)) {
+            throw new NotFoundException("AccountPolicy with id " + policyTO.getKey());
+        }
+
+        return update(policyTO, policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_UPDATE')")
+    public SyncPolicyTO update(final SyncPolicyTO policyTO) {
+        Policy policy = policyDAO.find(policyTO.getKey());
+        if (!(policy instanceof SyncPolicy)) {
+            throw new NotFoundException("SyncPolicy with id " + policyTO.getKey());
+        }
+
+        return update(policyTO, policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_LIST')")
+    @SuppressWarnings("unchecked")
+    public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
+
+        List<? extends Policy> policies = policyDAO.find(type);
+
+        final List<T> policyTOs = new ArrayList<T>();
+        for (Policy policy : policies) {
+            policyTOs.add((T) binder.getPolicyTO(policy));
+        }
+
+        return policyTOs;
+    }
+
+    @PreAuthorize("hasRole('POLICY_READ')")
+    public PasswordPolicyTO getGlobalPasswordPolicy() {
+        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
+        if (policy == null) {
+            throw new NotFoundException("No password policy found");
+        }
+
+        return (PasswordPolicyTO) binder.getPolicyTO(policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_READ')")
+    public AccountPolicyTO getGlobalAccountPolicy() {
+        AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
+        if (policy == null) {
+            throw new NotFoundException("No account policy found");
+        }
+
+        return (AccountPolicyTO) binder.getPolicyTO(policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_READ')")
+    public SyncPolicyTO getGlobalSyncPolicy() {
+        SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
+        if (policy == null) {
+            throw new NotFoundException("No sync policy found");
+        }
+
+        return (SyncPolicyTO) binder.getPolicyTO(policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_READ')")
+    public <T extends AbstractPolicyTO> T read(final Long id) {
+        Policy policy = policyDAO.find(id);
+        if (policy == null) {
+            throw new NotFoundException("Policy " + id + " not found");
+        }
+
+        return binder.getPolicyTO(policy);
+    }
+
+    @PreAuthorize("hasRole('POLICY_DELETE')")
+    public <T extends AbstractPolicyTO> T delete(final Long id) {
+        Policy policy = policyDAO.find(id);
+        if (policy == null) {
+            throw new NotFoundException("Policy " + id + " not found");
+        }
+
+        T policyToDelete = binder.getPolicyTO(policy);
+        policyDAO.delete(policy);
+
+        return policyToDelete;
+    }
+
+    @PreAuthorize("hasRole('POLICY_LIST')")
+    public Set<String> getSyncCorrelationRuleClasses() {
+        return classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_CORRELATION_RULES);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected AbstractPolicyTO resolveReference(final Method method, final Object... args)
+            throws UnresolvedReferenceException {
+        Long id = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; id == null && i < args.length; i++) {
+                if (args[i] instanceof Long) {
+                    id = (Long) args[i];
+                } else if (args[i] instanceof AbstractPolicyTO) {
+                    id = ((AbstractPolicyTO) args[i]).getKey();
+                }
+            }
+        }
+
+        if ((id != null) && !id.equals(0l)) {
+            try {
+                return binder.getPolicyTO(policyDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ReportLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ReportLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ReportLogic.java
index 0d8af57..dbf0833 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ReportLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ReportLogic.java
@@ -45,16 +45,19 @@ import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
 import org.apache.syncope.common.lib.types.ReportExecStatus;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.ReportDAO;
-import org.apache.syncope.persistence.api.dao.ReportExecDAO;
-import org.apache.syncope.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.persistence.api.entity.EntityFactory;
-import org.apache.syncope.persistence.api.entity.Report;
-import org.apache.syncope.persistence.api.entity.ReportExec;
-import org.apache.syncope.server.logic.data.ReportDataBinder;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.ReportDAO;
+import org.apache.syncope.server.persistence.api.dao.ReportExecDAO;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.entity.EntityFactory;
+import org.apache.syncope.server.persistence.api.entity.Report;
+import org.apache.syncope.server.persistence.api.entity.ReportExec;
+import org.apache.syncope.server.provisioning.api.data.ReportDataBinder;
+import org.apache.syncope.server.provisioning.api.job.JobNamer;
+import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
 import org.apache.syncope.server.logic.init.JobInstanceLoader;
 import org.apache.syncope.server.logic.report.Reportlet;
+import org.apache.syncope.server.logic.report.ReportletConfClass;
 import org.apache.syncope.server.logic.report.TextSerializer;
 import org.apache.xmlgraphics.util.MimeConstants;
 import org.quartz.JobKey;
@@ -64,6 +67,7 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ClassUtils;
 
 @Component
 public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
@@ -86,6 +90,9 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
     @Autowired
     private EntityFactory entityFactory;
 
+    @Autowired
+    private ImplementationClassNamesLoader classNamesLoader;
+
     @PreAuthorize("hasRole('REPORT_CREATE')")
     public ReportTO create(final ReportTO reportTO) {
         Report report = entityFactory.newEntity(Report.class);
@@ -107,9 +114,9 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
 
     @PreAuthorize("hasRole('REPORT_UPDATE')")
     public ReportTO update(final ReportTO reportTO) {
-        Report report = reportDAO.find(reportTO.getId());
+        Report report = reportDAO.find(reportTO.getKey());
         if (report == null) {
-            throw new NotFoundException("Report " + reportTO.getId());
+            throw new NotFoundException("Report " + reportTO.getKey());
         }
 
         binder.getReport(report, reportTO);
@@ -136,20 +143,60 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
     @PreAuthorize("hasRole('REPORT_LIST')")
     public List<ReportTO> list(final int page, final int size, final List<OrderByClause> orderByClauses) {
         List<Report> reports = reportDAO.findAll(page, size, orderByClauses);
-        List<ReportTO> result = new ArrayList<ReportTO>(reports.size());
+        List<ReportTO> result = new ArrayList<>(reports.size());
         for (Report report : reports) {
             result.add(binder.getReportTO(report));
         }
         return result;
     }
 
+    private Class<? extends ReportletConf> getReportletConfClass(final Class<Reportlet> reportletClass) {
+        Class<? extends ReportletConf> result = null;
+
+        ReportletConfClass annotation = reportletClass.getAnnotation(ReportletConfClass.class);
+        if (annotation != null) {
+            result = annotation.value();
+        }
+
+        return result;
+    }
+
+    public Class<Reportlet> findReportletClassHavingConfClass(final Class<? extends ReportletConf> reportletConfClass) {
+        Class<Reportlet> result = null;
+        for (Class<Reportlet> reportletClass : getAllReportletClasses()) {
+            Class<? extends ReportletConf> found = getReportletConfClass(reportletClass);
+            if (found != null && found.equals(reportletConfClass)) {
+                result = reportletClass;
+            }
+        }
+
+        return result;
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    private Set<Class<Reportlet>> getAllReportletClasses() {
+        Set<Class<Reportlet>> reportletClasses = new HashSet<>();
+
+        for (String className : classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET)) {
+            try {
+                Class reportletClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
+                reportletClasses.add(reportletClass);
+            } catch (ClassNotFoundException e) {
+                LOG.warn("Could not load class {}", className);
+            } catch (LinkageError e) {
+                LOG.warn("Could not link class {}", className);
+            }
+        }
+        return reportletClasses;
+    }
+
     @PreAuthorize("hasRole('REPORT_LIST')")
     @SuppressWarnings("rawtypes")
     public Set<String> getReportletConfClasses() {
-        Set<String> reportletConfClasses = new HashSet<String>();
+        Set<String> reportletConfClasses = new HashSet<>();
 
-        for (Class<Reportlet> reportletClass : binder.getAllReportletClasses()) {
-            Class<? extends ReportletConf> reportletConfClass = binder.getReportletConfClass(reportletClass);
+        for (Class<Reportlet> reportletClass : getAllReportletClasses()) {
+            Class<? extends ReportletConf> reportletConfClass = getReportletConfClass(reportletClass);
             if (reportletConfClass != null) {
                 reportletConfClasses.add(reportletConfClass.getName());
             }
@@ -270,7 +317,7 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
             jobInstanceLoader.registerJob(report);
 
             scheduler.getScheduler().triggerJob(
-                    new JobKey(JobInstanceLoader.getJobName(report), Scheduler.DEFAULT_GROUP));
+                    new JobKey(JobNamer.getJobName(report), Scheduler.DEFAULT_GROUP));
         } catch (Exception e) {
             LOG.error("While executing report {}", report, e);
 
@@ -329,7 +376,7 @@ public class ReportLogic extends AbstractTransactionalLogic<ReportTO> {
                 if (args[i] instanceof Long) {
                     id = (Long) args[i];
                 } else if (args[i] instanceof ReportTO) {
-                    id = ((ReportTO) args[i]).getId();
+                    id = ((ReportTO) args[i]).getKey();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ResourceLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ResourceLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ResourceLogic.java
index d1b2851..d18fc15 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ResourceLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/ResourceLogic.java
@@ -31,24 +31,24 @@ import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.persistence.api.dao.ConnInstanceDAO;
-import org.apache.syncope.persistence.api.dao.DuplicateException;
-import org.apache.syncope.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.MappingItem;
-import org.apache.syncope.persistence.api.entity.Subject;
-import org.apache.syncope.provisioning.api.Connector;
-import org.apache.syncope.provisioning.api.ConnectorFactory;
-import org.apache.syncope.server.logic.data.ResourceDataBinder;
+import org.apache.syncope.server.persistence.api.dao.ConnInstanceDAO;
+import org.apache.syncope.server.persistence.api.dao.DuplicateException;
+import org.apache.syncope.server.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.RoleDAO;
+import org.apache.syncope.server.persistence.api.dao.UserDAO;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.server.persistence.api.entity.ConnInstance;
+import org.apache.syncope.server.persistence.api.entity.ExternalResource;
+import org.apache.syncope.server.persistence.api.entity.MappingItem;
+import org.apache.syncope.server.persistence.api.entity.Subject;
+import org.apache.syncope.server.provisioning.api.Connector;
+import org.apache.syncope.server.provisioning.api.ConnectorFactory;
+import org.apache.syncope.server.provisioning.api.data.ResourceDataBinder;
 import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
-import org.apache.syncope.server.utils.ConnObjectUtil;
-import org.apache.syncope.server.utils.MappingUtil;
+import org.apache.syncope.server.misc.ConnObjectUtil;
+import org.apache.syncope.server.misc.MappingUtil;
 import org.identityconnectors.framework.common.objects.Attribute;
 import org.identityconnectors.framework.common.objects.AttributeUtil;
 import org.identityconnectors.framework.common.objects.ConnectorObject;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/RoleLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/RoleLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/RoleLogic.java
index aee0d27..c1a5582 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/RoleLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/RoleLogic.java
@@ -35,22 +35,22 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
 import org.apache.syncope.common.lib.to.RoleTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.provisioning.api.AttributableTransformer;
-import org.apache.syncope.provisioning.api.RoleProvisioningManager;
-import org.apache.syncope.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.server.logic.data.RoleDataBinder;
-import org.apache.syncope.server.security.AuthContextUtil;
-import org.apache.syncope.server.security.UnauthorizedRoleException;
+import org.apache.syncope.server.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.RoleDAO;
+import org.apache.syncope.server.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.server.persistence.api.dao.UserDAO;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.dao.search.SearchCond;
+import org.apache.syncope.server.persistence.api.entity.role.Role;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.apache.syncope.server.provisioning.api.AttributableTransformer;
+import org.apache.syncope.server.provisioning.api.RoleProvisioningManager;
+import org.apache.syncope.server.provisioning.api.data.RoleDataBinder;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationTaskExecutor;
+import org.apache.syncope.server.misc.security.AuthContextUtil;
+import org.apache.syncope.server.misc.security.UnauthorizedRoleException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
@@ -100,7 +100,7 @@ public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
         if (anonymousUser.equals(AuthContextUtil.getAuthenticatedUsername())) {
             role = roleDAO.find(roleKey);
         } else {
-            role = roleDAO.authFetchRole(roleKey);
+            role = roleDAO.authFetch(roleKey);
         }
 
         if (role == null) {
@@ -140,7 +140,7 @@ public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
     @PreAuthorize("hasRole('ROLE_READ')")
     @Transactional(readOnly = true)
     public RoleTO parent(final Long roleKey) {
-        Role role = roleDAO.authFetchRole(roleKey);
+        Role role = roleDAO.authFetch(roleKey);
 
         Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
         if (role.getParent() != null && !allowedRoleIds.contains(role.getParent().getKey())) {
@@ -157,12 +157,12 @@ public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
     @PreAuthorize("hasRole('ROLE_READ')")
     @Transactional(readOnly = true)
     public List<RoleTO> children(final Long roleKey) {
-        Role role = roleDAO.authFetchRole(roleKey);
+        Role role = roleDAO.authFetch(roleKey);
 
         Set<Long> allowedRoleIds = RoleEntitlementUtil.getRoleKeys(AuthContextUtil.getOwnedEntitlementNames());
 
         List<Role> children = roleDAO.findChildren(role);
-        List<RoleTO> childrenTOs = new ArrayList<RoleTO>(children.size());
+        List<RoleTO> childrenTOs = new ArrayList<>(children.size());
         for (Role child : children) {
             if (allowedRoleIds.contains(child.getKey())) {
                 childrenTOs.add(binder.getRoleTO(child));
@@ -244,7 +244,7 @@ public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
     @Override
     public RoleTO update(final RoleMod roleMod) {
         // Check that this operation is allowed to be performed by caller
-        roleDAO.authFetchRole(roleMod.getKey());
+        roleDAO.authFetch(roleMod.getKey());
 
         // Attribute value transformation (if configured)
         RoleMod actual = attrTransformer.transform(roleMod);
@@ -350,7 +350,7 @@ public class RoleLogic extends AbstractSubjectLogic<RoleTO, RoleMod> {
     @Transactional(rollbackFor = { Throwable.class })
     @Override
     public RoleTO deprovision(final Long roleKey, final Collection<String> resources) {
-        final Role role = roleDAO.authFetchRole(roleKey);
+        final Role role = roleDAO.authFetch(roleKey);
 
         List<PropagationStatus> statuses = provisioningManager.deprovision(roleKey, resources);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SchemaLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SchemaLogic.java
index 675bd42..ccf191f 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SchemaLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SchemaLogic.java
@@ -31,17 +31,17 @@ import org.apache.syncope.common.lib.to.VirSchemaTO;
 import org.apache.syncope.common.lib.types.AttributableType;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.persistence.api.dao.DerSchemaDAO;
-import org.apache.syncope.persistence.api.dao.DuplicateException;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.persistence.api.entity.AttributableUtilFactory;
-import org.apache.syncope.persistence.api.entity.DerSchema;
-import org.apache.syncope.persistence.api.entity.PlainSchema;
-import org.apache.syncope.persistence.api.entity.VirSchema;
-import org.apache.syncope.server.logic.data.SchemaDataBinder;
+import org.apache.syncope.server.persistence.api.dao.DerSchemaDAO;
+import org.apache.syncope.server.persistence.api.dao.DuplicateException;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.server.persistence.api.dao.VirSchemaDAO;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.server.persistence.api.entity.AttributableUtilFactory;
+import org.apache.syncope.server.persistence.api.entity.DerSchema;
+import org.apache.syncope.server.persistence.api.entity.PlainSchema;
+import org.apache.syncope.server.persistence.api.entity.VirSchema;
+import org.apache.syncope.server.provisioning.api.data.SchemaDataBinder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SecurityQuestionLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SecurityQuestionLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SecurityQuestionLogic.java
index 01b2a57..65f3ce2 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SecurityQuestionLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SecurityQuestionLogic.java
@@ -23,12 +23,12 @@ import java.util.ArrayList;
 import java.util.List;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.SecurityQuestionDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.server.logic.data.SecurityQuestionDataBinder;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.SecurityQuestionDAO;
+import org.apache.syncope.server.persistence.api.dao.UserDAO;
+import org.apache.syncope.server.persistence.api.entity.user.SecurityQuestion;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.apache.syncope.server.provisioning.api.data.SecurityQuestionDataBinder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
@@ -47,7 +47,7 @@ public class SecurityQuestionLogic extends AbstractTransactionalLogic<SecurityQu
 
     @PreAuthorize("isAuthenticated()")
     public List<SecurityQuestionTO> list() {
-        List<SecurityQuestionTO> result = new ArrayList<SecurityQuestionTO>();
+        List<SecurityQuestionTO> result = new ArrayList<>();
         for (SecurityQuestion securityQuestion : securityQuestionDAO.findAll()) {
             result.add(binder.getSecurityQuestionTO(securityQuestion));
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SpringBeanJobFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SpringBeanJobFactory.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SpringBeanJobFactory.java
new file mode 100644
index 0000000..9eccaea
--- /dev/null
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/SpringBeanJobFactory.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.server.logic;
+
+import org.apache.syncope.server.provisioning.api.job.JobNamer;
+import org.apache.syncope.server.logic.init.JobInstanceLoader;
+import org.quartz.SchedulerContext;
+import org.quartz.spi.TriggerFiredBundle;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.beans.PropertyAccessorFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public class SpringBeanJobFactory extends org.springframework.scheduling.quartz.SpringBeanJobFactory {
+
+    private String[] ignoredUnknownProperties;
+
+    private SchedulerContext schedulerContext;
+
+    @Override
+    public void setIgnoredUnknownProperties(final String[] ignoredUnknownProperties) {
+        String[] defensiveCopy = ignoredUnknownProperties.clone();
+        super.setIgnoredUnknownProperties(defensiveCopy);
+        this.ignoredUnknownProperties = defensiveCopy;
+    }
+
+    @Override
+    public void setSchedulerContext(final SchedulerContext schedulerContext) {
+        super.setSchedulerContext(schedulerContext);
+        this.schedulerContext = schedulerContext;
+    }
+
+    /**
+     * An implementation of SpringBeanJobFactory that retrieves the bean from the Spring context so that autowiring and
+     * transactions work.
+     *
+     * {@inheritDoc}
+     */
+    @Override
+    protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
+        final ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext"));
+
+        // Try to re-create job bean from underlying task (useful for managing failover scenarios)
+        if (!ctx.containsBean(bundle.getJobDetail().getKey().getName())) {
+            Long taskId = JobNamer.getTaskIdFromJobName(bundle.getJobDetail().getKey().getName());
+            if (taskId != null) {
+                JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class);
+                jobInstanceLoader.registerTaskJob(taskId);
+            }
+
+            Long reportId = JobNamer.getReportIdFromJobName(bundle.getJobDetail().getKey().getName());
+            if (reportId != null) {
+                JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class);
+                jobInstanceLoader.registerReportJob(reportId);
+            }
+        }
+
+        final Object job = ctx.getBean(bundle.getJobDetail().getKey().getName());
+        final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(job);
+        if (isEligibleForPropertyPopulation(wrapper.getWrappedInstance())) {
+            final MutablePropertyValues pvs = new MutablePropertyValues();
+            if (this.schedulerContext != null) {
+                pvs.addPropertyValues(this.schedulerContext);
+            }
+            pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
+            pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
+            if (this.ignoredUnknownProperties == null) {
+                wrapper.setPropertyValues(pvs, true);
+            } else {
+                for (String propName : this.ignoredUnknownProperties) {
+                    if (pvs.contains(propName) && !wrapper.isWritableProperty(propName)) {
+                        pvs.removePropertyValue(propName);
+                    }
+                }
+                wrapper.setPropertyValues(pvs);
+            }
+        }
+        return job;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/TaskLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/TaskLogic.java
index 11c9b4b..683cda6 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/TaskLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/TaskLogic.java
@@ -35,20 +35,21 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.PropagationMode;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.TaskDAO;
-import org.apache.syncope.persistence.api.dao.TaskExecDAO;
-import org.apache.syncope.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.persistence.api.entity.task.NotificationTask;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.task.SchedTask;
-import org.apache.syncope.persistence.api.entity.task.Task;
-import org.apache.syncope.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.persistence.api.entity.task.TaskUtil;
-import org.apache.syncope.persistence.api.entity.task.TaskUtilFactory;
-import org.apache.syncope.provisioning.api.job.TaskJob;
-import org.apache.syncope.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.server.logic.data.TaskDataBinder;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.TaskDAO;
+import org.apache.syncope.server.persistence.api.dao.TaskExecDAO;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.entity.task.NotificationTask;
+import org.apache.syncope.server.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.server.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.server.persistence.api.entity.task.Task;
+import org.apache.syncope.server.persistence.api.entity.task.TaskExec;
+import org.apache.syncope.server.persistence.api.entity.task.TaskUtil;
+import org.apache.syncope.server.persistence.api.entity.task.TaskUtilFactory;
+import org.apache.syncope.server.provisioning.api.data.TaskDataBinder;
+import org.apache.syncope.server.provisioning.api.job.JobNamer;
+import org.apache.syncope.server.provisioning.api.job.TaskJob;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationTaskExecutor;
 import org.apache.syncope.server.logic.init.ImplementationClassNamesLoader;
 import org.apache.syncope.server.logic.init.JobInstanceLoader;
 import org.apache.syncope.server.logic.notification.NotificationJob;
@@ -117,9 +118,9 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
 
     @PreAuthorize("hasRole('TASK_UPDATE')")
     public <T extends SchedTaskTO> T updateSched(final SchedTaskTO taskTO) {
-        SchedTask task = taskDAO.find(taskTO.getId());
+        SchedTask task = taskDAO.find(taskTO.getKey());
         if (task == null) {
-            throw new NotFoundException("Task " + taskTO.getId());
+            throw new NotFoundException("Task " + taskTO.getKey());
         }
 
         TaskUtil taskUtil = taskUtilFactory.getInstance(task);
@@ -226,7 +227,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
                     map.put(TaskJob.DRY_RUN_JOBDETAIL_KEY, dryRun);
 
                     scheduler.getScheduler().triggerJob(
-                            new JobKey(JobInstanceLoader.getJobName(task), Scheduler.DEFAULT_GROUP), map);
+                            new JobKey(JobNamer.getJobName(task), Scheduler.DEFAULT_GROUP), map);
                 } catch (Exception e) {
                     LOG.error("While executing task {}", task, e);
 
@@ -334,7 +335,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
             case DELETE:
                 for (String taskId : bulkAction.getTargets()) {
                     try {
-                        res.add(delete(Long.valueOf(taskId)).getId(), BulkActionResult.Status.SUCCESS);
+                        res.add(delete(Long.valueOf(taskId)).getKey(), BulkActionResult.Status.SUCCESS);
                     } catch (Exception e) {
                         LOG.error("Error performing delete for task {}", taskId, e);
                         res.add(taskId, BulkActionResult.Status.FAILURE);
@@ -388,7 +389,7 @@ public class TaskLogic extends AbstractTransactionalLogic<AbstractTaskTO> {
                 if (args[i] instanceof Long) {
                     id = (Long) args[i];
                 } else if (args[i] instanceof AbstractTaskTO) {
-                    id = ((AbstractTaskTO) args[i]).getId();
+                    id = ((AbstractTaskTO) args[i]).getKey();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
index 870a075..6b6d313 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserLogic.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.server.logic;
 
-import org.apache.syncope.server.security.UnauthorizedRoleException;
+import org.apache.syncope.server.misc.security.UnauthorizedRoleException;
 import java.lang.reflect.Method;
 import java.security.AccessControlException;
 import java.util.ArrayList;
@@ -41,22 +41,23 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.SubjectType;
-import org.apache.syncope.persistence.api.RoleEntitlementUtil;
-import org.apache.syncope.persistence.api.dao.ConfDAO;
-import org.apache.syncope.persistence.api.dao.NotFoundException;
-import org.apache.syncope.persistence.api.dao.RoleDAO;
-import org.apache.syncope.persistence.api.dao.SubjectSearchDAO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.provisioning.api.AttributableTransformer;
-import org.apache.syncope.provisioning.api.UserProvisioningManager;
-import org.apache.syncope.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.server.logic.data.UserDataBinder;
-import org.apache.syncope.server.security.AuthContextUtil;
+import org.apache.syncope.server.persistence.api.RoleEntitlementUtil;
+import org.apache.syncope.server.persistence.api.dao.ConfDAO;
+import org.apache.syncope.server.persistence.api.dao.NotFoundException;
+import org.apache.syncope.server.persistence.api.dao.RoleDAO;
+import org.apache.syncope.server.persistence.api.dao.SubjectSearchDAO;
+import org.apache.syncope.server.persistence.api.dao.UserDAO;
+import org.apache.syncope.server.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.server.persistence.api.dao.search.SearchCond;
+import org.apache.syncope.server.persistence.api.entity.role.Role;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.apache.syncope.server.provisioning.api.AttributableTransformer;
+import org.apache.syncope.server.provisioning.api.UserProvisioningManager;
+import org.apache.syncope.server.provisioning.api.data.UserDataBinder;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationTaskExecutor;
+import org.apache.syncope.server.provisioning.java.VirAttrHandler;
+import org.apache.syncope.server.misc.security.AuthContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
@@ -86,6 +87,9 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
     protected UserDataBinder binder;
 
     @Autowired
+    protected VirAttrHandler virtAttrHandler;
+
+    @Autowired
     protected PropagationManager propagationManager;
 
     @Autowired
@@ -191,7 +195,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
 
     @PreAuthorize("hasRole('USER_CREATE')")
     public UserTO create(final UserTO userTO, final boolean storePassword) {
-        Set<Long> requestRoleIds = new HashSet<Long>(userTO.getMemberships().size());
+        Set<Long> requestRoleIds = new HashSet<>(userTO.getMemberships().size());
         for (MembershipTO membership : userTO.getMemberships()) {
             requestRoleIds.add(membership.getRoleId());
         }
@@ -238,7 +242,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
         // SYNCOPE-501: check if there are memberships to be removed with virtual attributes assigned
         boolean removeMemberships = false;
         for (Long membershipId : actual.getMembershipsToRemove()) {
-            if (!binder.fillMembershipVirtual(
+            if (!virtAttrHandler.fillMembershipVirtual(
                     null,
                     null,
                     membershipId,
@@ -283,7 +287,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
     @PreAuthorize("hasRole('USER_UPDATE')")
     @Transactional(rollbackFor = { Throwable.class })
     public UserTO status(final StatusMod statusMod) {
-        User user = userDAO.authFecthUser(statusMod.getId());
+        User user = userDAO.authFetch(statusMod.getKey());
 
         Map.Entry<Long, List<PropagationStatus>> updated = setStatusOnWfAdapter(user, statusMod);
         final UserTO savedTO = binder.getUserTO(updated.getKey());
@@ -382,7 +386,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
             case SUSPEND:
                 for (String key : bulkAction.getTargets()) {
                     StatusMod statusMod = new StatusMod();
-                    statusMod.setId(Long.valueOf(key));
+                    statusMod.setKey(Long.valueOf(key));
                     statusMod.setType(StatusMod.ModType.SUSPEND);
                     try {
                         res.add(status(statusMod).getKey(), Status.SUCCESS);
@@ -396,7 +400,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
             case REACTIVATE:
                 for (String key : bulkAction.getTargets()) {
                     StatusMod statusMod = new StatusMod();
-                    statusMod.setId(Long.valueOf(key));
+                    statusMod.setKey(Long.valueOf(key));
                     statusMod.setType(StatusMod.ModType.REACTIVATE);
                     try {
                         res.add(status(statusMod).getKey(), Status.SUCCESS);
@@ -473,7 +477,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod> {
     @Transactional(rollbackFor = { Throwable.class })
     @Override
     public UserTO deprovision(final Long key, final Collection<String> resources) {
-        final User user = userDAO.authFecthUser(key);
+        final User user = userDAO.authFetch(key);
 
         List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserWorkflowLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserWorkflowLogic.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserWorkflowLogic.java
index 08b5e71..999dddc 100644
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserWorkflowLogic.java
+++ b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/UserWorkflowLogic.java
@@ -26,14 +26,14 @@ import org.apache.syncope.common.lib.mod.AbstractAttributableMod;
 import org.apache.syncope.common.lib.mod.UserMod;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.to.WorkflowFormTO;
-import org.apache.syncope.persistence.api.dao.UserDAO;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.server.logic.data.UserDataBinder;
+import org.apache.syncope.server.persistence.api.dao.UserDAO;
+import org.apache.syncope.server.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.server.persistence.api.entity.user.User;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.server.provisioning.api.propagation.PropagationTaskExecutor;
 import org.apache.syncope.server.workflow.api.UserWorkflowAdapter;
-import org.apache.syncope.provisioning.api.WorkflowResult;
+import org.apache.syncope.server.provisioning.api.WorkflowResult;
+import org.apache.syncope.server.provisioning.api.data.UserDataBinder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
@@ -83,7 +83,7 @@ public class UserWorkflowLogic extends AbstractTransactionalLogic<WorkflowFormTO
     @PreAuthorize("hasRole('WORKFLOW_FORM_READ') and hasRole('USER_READ')")
     @Transactional(rollbackFor = { Throwable.class })
     public WorkflowFormTO getFormForUser(final Long key) {
-        User user = userDAO.authFecthUser(key);
+        User user = userDAO.authFetch(key);
         return uwfAdapter.getForm(user.getWorkflowId());
     }
 
@@ -96,7 +96,7 @@ public class UserWorkflowLogic extends AbstractTransactionalLogic<WorkflowFormTO
     @PreAuthorize("hasRole('WORKFLOW_FORM_READ') and hasRole('USER_READ')")
     @Transactional(rollbackFor = { Throwable.class })
     public List<WorkflowFormTO> getForms(final Long key, final String formName) {
-        User user = userDAO.authFecthUser(key);
+        User user = userDAO.authFetch(key);
         return uwfAdapter.getForms(user.getWorkflowId(), formName);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/audit/AuditManager.java
----------------------------------------------------------------------
diff --git a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/audit/AuditManager.java b/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/audit/AuditManager.java
deleted file mode 100644
index ed674fd..0000000
--- a/syncope620/server/logic/src/main/java/org/apache/syncope/server/logic/audit/AuditManager.java
+++ /dev/null
@@ -1,107 +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.server.logic.audit;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.types.AuditElements;
-import org.apache.syncope.common.lib.types.AuditElements.Result;
-import org.apache.syncope.common.lib.types.AuditLoggerName;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.persistence.api.dao.LoggerDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-public class AuditManager {
-
-    /**
-     * Logger.
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(AuditManager.class);
-
-    @Autowired
-    private LoggerDAO loggerDAO;
-
-    public void audit(
-            final AuditElements.EventCategoryType type,
-            final String category,
-            final String subcategory,
-            final String event,
-            final Result result,
-            final Object before,
-            final Object output,
-            final Object... input) {
-
-        final Throwable throwable;
-        final StringBuilder message = new StringBuilder();
-
-        message.append("BEFORE:\n");
-        message.append("\t").append(before == null ? "unknown" : before).append("\n");
-
-        message.append("INPUT:\n");
-
-        if (ArrayUtils.isNotEmpty(input)) {
-            for (Object obj : input) {
-                message.append("\t").append(obj == null ? null : obj.toString()).append("\n");
-            }
-        } else {
-            message.append("\t").append("none").append("\n");
-        }
-
-        message.append("OUTPUT:\n");
-
-        if (output instanceof Throwable) {
-            throwable = (Throwable) output;
-            message.append("\t").append(throwable.getMessage());
-        } else {
-            throwable = null;
-            message.append("\t").append(output == null ? "none" : output.toString());
-        }
-
-        AuditLoggerName auditLoggerName = null;
-        try {
-            auditLoggerName = new AuditLoggerName(type, category, subcategory, event, result);
-        } catch (IllegalArgumentException e) {
-            LOG.error("Invalid audit parameters, aborting...", e);
-        }
-
-        if (auditLoggerName != null) {
-            org.apache.syncope.persistence.api.entity.Logger syncopeLogger =
-                     loggerDAO.find(auditLoggerName.toLoggerName());
-            if (syncopeLogger != null && syncopeLogger.getLevel() == LoggerLevel.DEBUG) {
-                StringBuilder auditMessage = new StringBuilder();
-
-                final SecurityContext ctx = SecurityContextHolder.getContext();
-                if (ctx != null && ctx.getAuthentication() != null) {
-                    auditMessage.append('[').append(ctx.getAuthentication().getName()).append(']').append(' ');
-                }
-                auditMessage.append(message);
-
-                final Logger logger = LoggerFactory.getLogger(auditLoggerName.toLoggerName());
-                if (throwable == null) {
-                    logger.debug(auditMessage.toString());
-                } else {
-                    logger.debug(auditMessage.toString(), throwable);
-                }
-            }
-        }
-    }
-}


Mime
View raw message