You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2013/11/05 09:22:32 UTC

svn commit: r1538902 [3/4] - in /syncope/branches/1_1_X: client/src/main/java/org/apache/syncope/client/services/proxy/ client/src/test/java/org/apache/syncope/client/test/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/o...

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java Tue Nov  5 08:22:31 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -25,19 +26,16 @@ import java.util.Map;
 import java.util.Set;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.ConnBundleTO;
 import org.apache.syncope.common.to.ConnInstanceTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.ConnectorSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.ConnConfPropSchema;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.ConnInstance;
 import org.apache.syncope.core.persistence.beans.ExternalResource;
 import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
@@ -67,10 +65,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/connector")
-public class ConnInstanceController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class ConnInstanceController extends AbstractTransactionalController<ConnInstanceTO> {
 
     @Autowired
     private ResourceDAO resourceDAO;
@@ -92,12 +87,7 @@ public class ConnInstanceController exte
         ConnInstance connInstance = binder.getConnInstance(connInstanceTO);
         try {
             connInstance = connInstanceDAO.save(connInstance);
-            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.success,
-                    "Successfully created connector instance: " + connInstance.getDisplayName());
         } catch (Exception e) {
-            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
-                    "Could not create connector instance: " + connInstanceTO.getDisplayName(), e);
-
             SyncopeClientCompositeErrorException scce =
                     new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
@@ -121,12 +111,7 @@ public class ConnInstanceController exte
         ConnInstance connInstance = binder.updateConnInstance(connInstanceTO.getId(), connInstanceTO);
         try {
             connInstance = connInstanceDAO.save(connInstance);
-            auditManager.audit(Category.connector, ConnectorSubCategory.update, Result.success,
-                    "Successfully update connector instance: " + connInstance.getDisplayName());
         } catch (Exception e) {
-            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
-                    "Could not update connector instance: " + connInstanceTO.getDisplayName(), e);
-
             SyncopeClientCompositeErrorException scce =
                     new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
@@ -164,11 +149,7 @@ public class ConnInstanceController exte
         }
 
         ConnInstanceTO connToDelete = binder.getConnInstanceTO(connInstance);
-
         connInstanceDAO.delete(connInstanceId);
-        auditManager.audit(Category.connector, ConnectorSubCategory.delete, Result.success,
-                "Successfully deleted connector instance: " + connInstanceId);
-
         return connToDelete;
     }
 
@@ -194,9 +175,6 @@ public class ConnInstanceController exte
             }
         }
 
-        auditManager.audit(Category.connector, ConnectorSubCategory.list, Result.success,
-                "Successfully listed all connectors: " + connInstanceTOs.size());
-
         return connInstanceTOs;
     }
 
@@ -209,9 +187,6 @@ public class ConnInstanceController exte
             throw new NotFoundException("Connector '" + connInstanceId + "'");
         }
 
-        auditManager.audit(Category.connector, ConnectorSubCategory.read, Result.success,
-                "Successfully read connector: " + connInstance.getDisplayName());
-
         return binder.getConnInstanceTO(connInstance);
     }
 
@@ -263,9 +238,6 @@ public class ConnInstanceController exte
             }
         }
 
-        auditManager.audit(Category.connector, ConnectorSubCategory.getBundles, Result.success,
-                "Successfully listed all bundles: " + connectorBundleTOs.size());
-
         return connectorBundleTOs;
     }
 
@@ -291,10 +263,6 @@ public class ConnInstanceController exte
         final List<String> result =
                 new ArrayList<String>(connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial));
 
-        auditManager.audit(Category.connector, ConnectorSubCategory.getSchemaNames, Result.success,
-                "Successfully listed " + (includeSpecial ? "all " : "") + "schema names (" + result.size() + ") "
-                + "for connector " + connInstance.getDisplayName());
-
         return result;
     }
 
@@ -321,10 +289,6 @@ public class ConnInstanceController exte
             result.add(objectClass.getObjectClassValue());
         }
 
-        auditManager.audit(Category.connector, ConnectorSubCategory.getSupportedObjectClasses, Result.success,
-                "Successfully listed supported object classes (" + result.size() + ") "
-                + "for connector " + connInstance.getDisplayName());
-
         return result;
     }
 
@@ -339,13 +303,7 @@ public class ConnInstanceController exte
             throw new NotFoundException("Connector '" + connInstanceId + "'");
         }
 
-        List<ConnConfProperty> result = new ArrayList<ConnConfProperty>(connInstance.getConfiguration());
-
-        auditManager.audit(Category.connector, ConnectorSubCategory.getConfigurationProperties, Result.success,
-                "Successfully listed all conf properties (" + result.size() + ") for connector "
-                + connInstance.getDisplayName());
-
-        return result;
+        return new ArrayList<ConnConfProperty>(connInstance.getConfiguration());
     }
 
     @PreAuthorize("hasRole('CONNECTOR_READ')")
@@ -359,13 +317,7 @@ public class ConnInstanceController exte
         try {
             connector.test();
             result = true;
-
-            auditManager.audit(Category.connector, ConnectorSubCategory.check, Result.success,
-                    "Successfully checked connector: " + connInstanceTO);
         } catch (Exception ex) {
-            auditManager.audit(Category.connector, ConnectorSubCategory.check, Result.failure,
-                    "Unsuccessful check for connector: " + connInstanceTO, ex);
-
             LOG.error("Test connection failure {}", ex);
             result = false;
         }
@@ -382,12 +334,7 @@ public class ConnInstanceController exte
             throw new NotFoundException("Resource '" + resourceName + "'");
         }
 
-        final Connector connector = connFactory.getConnector(resource);
-
-        auditManager.audit(Category.connector, ConnectorSubCategory.readConnectorBean, Result.success,
-                "Successfully read connector for resource: " + resourceName);
-
-        return binder.getConnInstanceTO(connector.getActiveConnInstance());
+        return binder.getConnInstanceTO(connFactory.getConnector(resource).getActiveConnInstance());
     }
 
     @PreAuthorize("hasRole('CONNECTOR_RELOAD')")
@@ -396,9 +343,6 @@ public class ConnInstanceController exte
     public void reload() {
         connFactory.unload();
         connFactory.load();
-
-        auditManager.audit(Category.connector, ConnectorSubCategory.reload, Result.success,
-                "Successfully reloaded all connector bundles and instances");
     }
 
     @PreAuthorize("hasRole('CONNECTOR_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
@@ -424,4 +368,34 @@ public class ConnInstanceController exte
 
         return res;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ConnInstanceTO 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 ConnInstanceTO) {
+                    id = ((ConnInstanceTO) args[i]).getId();
+                }
+            }
+        }
+
+        if (id != null) {
+            try {
+                return binder.getConnInstanceTO(connInstanceDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
 }
\ No newline at end of file

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/DerivedSchemaController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/DerivedSchemaController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/DerivedSchemaController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/DerivedSchemaController.java Tue Nov  5 08:22:31 2013
@@ -18,19 +18,17 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import javax.persistence.EntityExistsException;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.DerivedSchemaTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.common.types.AuditElements.SchemaSubCategory;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.AbstractDerSchema;
 import org.apache.syncope.core.persistence.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
@@ -47,10 +45,7 @@ import org.springframework.web.bind.anno
 
 @Controller
 @RequestMapping("/derivedSchema")
-public class DerivedSchemaController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class DerivedSchemaController extends AbstractTransactionalController<DerivedSchemaTO> {
 
     @Autowired
     private DerSchemaDAO derSchemaDAO;
@@ -81,9 +76,6 @@ public class DerivedSchemaController ext
 
         AbstractDerSchema derivedSchema = derSchemaDAO.save(binder.create(derSchemaTO, attrUtil.newDerSchema()));
 
-        auditManager.audit(Category.schema, SchemaSubCategory.createDerived, Result.success,
-                "Successfully created derived schema: " + kind + "/" + derivedSchema.getName());
-
         response.setStatus(HttpServletResponse.SC_CREATED);
         return binder.getDerivedSchemaTO(derivedSchema);
     }
@@ -100,12 +92,7 @@ public class DerivedSchemaController ext
         }
 
         DerivedSchemaTO schemaToDelete = binder.getDerivedSchemaTO(derivedSchema);
-
         derSchemaDAO.delete(derivedSchemaName, getAttributableUtil(kind));
-
-        auditManager.audit(Category.schema, SchemaSubCategory.deleteDerived, Result.success,
-                "Successfully deleted derived schema: " + kind + "/" + derivedSchema.getName());
-
         return schemaToDelete;
     }
 
@@ -119,9 +106,6 @@ public class DerivedSchemaController ext
             derivedSchemaTOs.add(binder.getDerivedSchemaTO(derivedSchema));
         }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.listDerived, Result.success,
-                "Successfully listed all derived schemas: " + kind + "/" + derivedSchemaTOs.size());
-
         return derivedSchemaTOs;
     }
 
@@ -136,9 +120,6 @@ public class DerivedSchemaController ext
             throw new NotFoundException("Derived schema '" + derivedSchemaName + "'");
         }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.readDerived, Result.success,
-                "Successfully read derived schema: " + kind + "/" + derivedSchema.getName());
-
         return binder.getDerivedSchemaTO(derivedSchema);
     }
 
@@ -155,10 +136,41 @@ public class DerivedSchemaController ext
 
         derivedSchema = binder.update(derivedSchemaTO, derivedSchema);
         derivedSchema = derSchemaDAO.save(derivedSchema);
+        return binder.getDerivedSchemaTO(derivedSchema);
+    }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.updateDerived, Result.success,
-                "Successfully updated derived schema: " + kind + "/" + derivedSchema.getName());
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected DerivedSchemaTO resolveReference(final Method method, final Object... args) throws
+            UnresolvedReferenceException {
+        String kind = null;
+        String name = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; (name == null || kind == null) && i < args.length; i++) {
+                if (args[i] instanceof String) {
+                    if (kind == null) {
+                        kind = (String) args[i];
+                    } else {
+                        name = (String) args[i];
+                    }
+                } else if (args[i] instanceof DerivedSchemaTO) {
+                    name = ((DerivedSchemaTO) args[i]).getName();
+                }
+            }
+        }
+
+        if (name != null) {
+            try {
+                return binder.getDerivedSchemaTO(derSchemaDAO.find(name, getAttributableUtil(kind).derSchemaClass()));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
 
-        return binder.getDerivedSchemaTO(derivedSchema);
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java Tue Nov  5 08:22:31 2013
@@ -20,18 +20,13 @@ package org.apache.syncope.core.rest.con
 
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.syncope.common.to.LoggerTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.LoggerSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.AuditLoggerName;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.types.SyncopeLoggerLevel;
 import org.apache.syncope.common.types.SyncopeLoggerType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.SyncopeLogger;
 import org.apache.syncope.core.persistence.dao.LoggerDAO;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
@@ -46,20 +41,43 @@ import org.springframework.web.bind.anno
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-
 import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.syncope.common.to.EventCategoryTO;
+import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.AuditElements.EventCategoryType;
+import org.apache.syncope.common.types.ResourceOperation;
+import org.apache.syncope.core.persistence.beans.ExternalResource;
+import org.apache.syncope.core.persistence.beans.SchedTask;
+import org.apache.syncope.core.persistence.beans.SyncTask;
+import org.apache.syncope.core.persistence.dao.ResourceDAO;
+import org.apache.syncope.core.persistence.dao.TaskDAO;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.SystemPropertyUtils;
 
 @Controller
 @RequestMapping("/logger")
-public class LoggerController extends AbstractController {
+public class LoggerController extends AbstractTransactionalController<LoggerTO> {
 
     @Autowired
-    private AuditManager auditManager;
+    private LoggerDAO loggerDAO;
 
     @Autowired
-    private LoggerDAO loggerDAO;
+    private ResourceDAO resourceDAO;
+
+    @Autowired
+    private TaskDAO taskDAO;
 
     private List<LoggerTO> list(final SyncopeLoggerType type) {
         List<LoggerTO> result = new ArrayList<LoggerTO>();
@@ -69,9 +87,6 @@ public class LoggerController extends Ab
             result.add(loggerTO);
         }
 
-        auditManager.audit(Category.logger, LoggerSubCategory.list, Result.success,
-                "Successfully listed all loggers (" + type + "): " + result.size());
-
         return result;
     }
 
@@ -92,7 +107,7 @@ public class LoggerController extends Ab
             try {
                 result.add(AuditLoggerName.fromLoggerName(logger.getName()));
             } catch (Exception e) {
-                LOG.error("Unexpected audit logger name: {}", logger.getName(), e);
+                LOG.warn("Unexpected audit logger name: {}", logger.getName(), e);
             }
         }
 
@@ -134,9 +149,6 @@ public class LoggerController extends Ab
         LoggerTO result = new LoggerTO();
         BeanUtils.copyProperties(syncopeLogger, result);
 
-        auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success,
-                String.format("Successfully set level %s to logger %s (%s)", level, name, expectedType));
-
         return result;
     }
 
@@ -182,9 +194,6 @@ public class LoggerController extends Ab
         Logger logger = lc.getLogger(name);
         logger.setLevel(Level.OFF);
 
-        auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success, String.format(
-                "Successfully deleted logger %s (%s)", name, expectedType));
-
         return loggerToDelete;
     }
 
@@ -212,4 +221,92 @@ public class LoggerController extends Ab
             throw sccee;
         }
     }
+
+    @RequestMapping(method = RequestMethod.GET, value = "/events")
+    public List<EventCategoryTO> listAuditEvents() {
+        // use set to avoi duplications or null elements
+        final Set<EventCategoryTO> events = new HashSet<EventCategoryTO>();
+
+        try {
+            final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
+            final MetadataReaderFactory metadataReaderFactory =
+                    new CachingMetadataReaderFactory(resourcePatternResolver);
+
+            final String packageSearchPath =
+                    ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+                    + ClassUtils.convertClassNameToResourcePath(
+                    SystemPropertyUtils.resolvePlaceholders(this.getClass().getPackage().getName()))
+                    + "/" + "**/*.class";
+
+            final Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
+            for (Resource resource : resources) {
+                if (resource.isReadable()) {
+                    final MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
+                    final Class<?> clazz = Class.forName(metadataReader.getClassMetadata().getClassName());
+
+                    if (clazz.isAnnotationPresent(Controller.class)) {
+                        final EventCategoryTO eventCategoryTO = new EventCategoryTO();
+                        eventCategoryTO.setCategory(clazz.getSimpleName());
+                        for (Method method : clazz.getDeclaredMethods()) {
+                            if (Modifier.isPublic(method.getModifiers())) {
+                                eventCategoryTO.getEvents().add(method.getName());
+                            }
+                        }
+                        events.add(eventCategoryTO);
+                    }
+                }
+            }
+
+            events.add(new EventCategoryTO(EventCategoryType.PROPAGATION));
+            events.add(new EventCategoryTO(EventCategoryType.SYNCHRONIZATION));
+
+            for (AttributableType attributableType : AttributableType.values()) {
+                for (ExternalResource resource : resourceDAO.findAll()) {
+                    final EventCategoryTO propEventCategoryTO = new EventCategoryTO(EventCategoryType.PROPAGATION);
+                    final EventCategoryTO syncEventCategoryTO = new EventCategoryTO(EventCategoryType.SYNCHRONIZATION);
+
+                    propEventCategoryTO.setCategory(attributableType.name().toLowerCase());
+                    propEventCategoryTO.setSubcategory(resource.getName());
+
+                    syncEventCategoryTO.setCategory(attributableType.name().toLowerCase());
+                    syncEventCategoryTO.setSubcategory(resource.getName());
+
+                    for (ResourceOperation resourceOperation : ResourceOperation.values()) {
+                        propEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+                        syncEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+                    }
+
+                    events.add(propEventCategoryTO);
+                    events.add(syncEventCategoryTO);
+                }
+            }
+
+            for (SchedTask task : taskDAO.findAll(SchedTask.class)) {
+                final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+                eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
+                events.add(eventCategoryTO);
+            }
+
+            for (SyncTask task : taskDAO.findAll(SyncTask.class)) {
+                final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+                eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
+                events.add(eventCategoryTO);
+            }
+
+
+        } catch (Exception e) {
+            LOG.error("Failure retrieving audit/notification events", e);
+        }
+
+        return new ArrayList<EventCategoryTO>(events);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected LoggerTO resolveReference(final Method method, final Object... args)
+            throws UnresolvedReferenceException {
+        throw new UnresolvedReferenceException();
+    }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java Tue Nov  5 08:22:31 2013
@@ -18,16 +18,12 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.servlet.http.HttpServletResponse;
-
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.NotificationTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.NotificationSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.Notification;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.dao.NotificationDAO;
@@ -42,10 +38,7 @@ import org.springframework.web.bind.anno
 
 @Controller
 @RequestMapping("/notification")
-public class NotificationController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class NotificationController extends AbstractTransactionalController<NotificationTO> {
 
     @Autowired
     private NotificationDAO notificationDAO;
@@ -76,9 +69,6 @@ public class NotificationController exte
             notificationTOs.add(binder.getNotificationTO(notification));
         }
 
-        auditManager.audit(Category.notification, NotificationSubCategory.list, Result.success,
-                "Successfully listed all notifications: " + notificationTOs.size());
-
         return notificationTOs;
     }
 
@@ -92,10 +82,7 @@ public class NotificationController exte
     @PreAuthorize("hasRole('NOTIFICATION_CREATE')")
     public NotificationTO createInternal(final NotificationTO notificationTO) {
         LOG.debug("Notification create called with parameter {}", notificationTO);
-        Notification notification = notificationDAO.save(binder.createNotification(notificationTO));
-        auditManager.audit(Category.notification, NotificationSubCategory.create, Result.success,
-                "Successfully created notification: " + notification.getId());
-        return binder.getNotificationTO(notification);
+        return binder.getNotificationTO(notificationDAO.save(binder.createNotification(notificationTO)));
     }
 
     @PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
@@ -113,9 +100,6 @@ public class NotificationController exte
         binder.updateNotification(notification, notificationTO);
         notification = notificationDAO.save(notification);
 
-        auditManager.audit(Category.notification, NotificationSubCategory.update, Result.success,
-                "Successfully updated notification: " + notification.getId());
-
         return binder.getNotificationTO(notification);
     }
 
@@ -130,12 +114,37 @@ public class NotificationController exte
         }
 
         NotificationTO notificationToDelete = binder.getNotificationTO(notification);
+        notificationDAO.delete(notificationId);
+        return notificationToDelete;
+    }
 
-        auditManager.audit(Category.notification, NotificationSubCategory.delete, Result.success,
-                "Successfully deleted notification: " + notification.getId());
+    /**
+     * {@inheritDoc}
+     */
+    @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]).getId();
+                }
+            }
+        }
 
-        notificationDAO.delete(notificationId);
+        if (id != null) {
+            try {
+                return binder.getNotificationTO(notificationDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
 
-        return notificationToDelete;
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java Tue Nov  5 08:22:31 2013
@@ -18,21 +18,17 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
-import java.util.Set;
 import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.AccountPolicyTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
 import org.apache.syncope.common.to.PolicyTO;
 import org.apache.syncope.common.to.SyncPolicyTO;
-import org.apache.syncope.common.types.AuditElements;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.PolicySubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.PolicyType;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.init.ImplementationClassNamesLoader;
 import org.apache.syncope.core.persistence.beans.AccountPolicy;
 import org.apache.syncope.core.persistence.beans.PasswordPolicy;
@@ -52,15 +48,12 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/policy")
-public class PolicyController extends AbstractController {
+public class PolicyController extends AbstractTransactionalController<PolicyTO> {
 
     @Autowired
     private ImplementationClassNamesLoader classNamesLoader;
 
     @Autowired
-    private AuditManager auditManager;
-
-    @Autowired
     private PolicyDAO policyDAO;
 
     @Autowired
@@ -84,24 +77,13 @@ public class PolicyController extends Ab
     @PreAuthorize("hasRole('POLICY_CREATE')")
     public <T extends PolicyTO> T createInternal(final T policyTO) {
         LOG.debug("Creating policy " + policyTO);
-
-        final Policy policy = binder.getPolicy(null, policyTO);
-
-        auditManager.audit(Category.policy, PolicySubCategory.create, Result.success,
-                "Successfully created " + policy.getType().toString() + " policy: " + policy.getId());
-
-        return binder.getPolicyTO(policyDAO.save(policy));
+        return binder.getPolicyTO(policyDAO.save(binder.getPolicy(null, policyTO)));
     }
 
     private <T extends PolicyTO, K extends Policy> T update(final T policyTO, final K policy) {
         LOG.debug("Updating policy " + policyTO);
-
         binder.getPolicy(policy, policyTO);
         K savedPolicy = policyDAO.save(policy);
-
-        auditManager.audit(Category.policy, PolicySubCategory.update, Result.success,
-                "Successfully updated policy (" + savedPolicy.getType() + "): " + savedPolicy.getId());
-
         return binder.getPolicyTO(savedPolicy);
     }
 
@@ -149,9 +131,6 @@ public class PolicyController extends Ab
             policyTOs.add(binder.getPolicyTO(policy));
         }
 
-        auditManager.audit(Category.policy, PolicySubCategory.list, Result.success,
-                "Successfully listed all policies (" + kind + "): " + policyTOs.size());
-
         return policyTOs;
     }
 
@@ -165,9 +144,6 @@ public class PolicyController extends Ab
             throw new NotFoundException("No password policy found");
         }
 
-        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
-                "Successfully read global password policy: " + policy.getId());
-
         return (PasswordPolicyTO) binder.getPolicyTO(policy);
     }
 
@@ -181,9 +157,6 @@ public class PolicyController extends Ab
             throw new NotFoundException("No account policy found");
         }
 
-        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
-                "Successfully read global account policy: " + policy.getId());
-
         return (AccountPolicyTO) binder.getPolicyTO(policy);
     }
 
@@ -197,9 +170,6 @@ public class PolicyController extends Ab
             throw new NotFoundException("No sync policy found");
         }
 
-        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
-                "Successfully read global sync policy: " + policy.getId());
-
         return (SyncPolicyTO) binder.getPolicyTO(policy);
     }
 
@@ -213,9 +183,6 @@ public class PolicyController extends Ab
             throw new NotFoundException("Policy " + id + " not found");
         }
 
-        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
-                "Successfully read policy (" + policy.getType() + "): " + policy.getId());
-
         return binder.getPolicyTO(policy);
     }
 
@@ -230,21 +197,43 @@ public class PolicyController extends Ab
         PolicyTO policyToDelete = binder.getPolicyTO(policy);
         policyDAO.delete(id);
 
-        auditManager.audit(Category.policy, PolicySubCategory.delete, Result.success,
-                "Successfully deleted policy: " + id);
-
         return policyToDelete;
     }
 
     @PreAuthorize("hasRole('POLICY_LIST')")
     @RequestMapping(method = RequestMethod.GET, value = "/syncCorrelationRuleClasses")
     public ModelAndView getSyncCorrelationRuleClasses() {
-        final Set<String> correlationRules =
-                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_CORRELATION_RULES);
+        return new ModelAndView().addObject(
+                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_CORRELATION_RULES));
+    }
 
-        auditManager.audit(Category.policy, AuditElements.PolicySubCategory.getCorrelationRuleClasses,
-                Result.success, "Successfully listed all correlation rule classes: " + correlationRules.size());
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected PolicyTO 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 PolicyTO) {
+                    id = ((PolicyTO) args[i]).getId();
+                }
+            }
+        }
+
+        if (id != null) {
+            try {
+                return binder.getPolicyTO(policyDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
 
-        return new ModelAndView().addObject(correlationRules);
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java Tue Nov  5 08:22:31 2013
@@ -21,6 +21,7 @@ package org.apache.syncope.core.rest.con
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -39,20 +40,17 @@ import org.apache.cocoon.sax.component.X
 import org.apache.cocoon.sax.component.XMLSerializer;
 import org.apache.cocoon.sax.component.XSLTTransformer;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.report.ReportletConf;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.ReportSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.ReportExecExportFormat;
 import static org.apache.syncope.common.types.ReportExecExportFormat.RTF;
 import org.apache.syncope.common.types.ReportExecStatus;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.init.JobInstanceLoader;
 import org.apache.syncope.core.persistence.beans.Report;
 import org.apache.syncope.core.persistence.beans.ReportExec;
@@ -80,10 +78,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/report")
-public class ReportController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class ReportController extends AbstractTransactionalController<ReportTO> {
 
     @Autowired
     private ReportDAO reportDAO;
@@ -128,9 +123,6 @@ public class ReportController extends Ab
             throw scce;
         }
 
-        auditManager.audit(Category.report, ReportSubCategory.create, Result.success,
-                "Successfully created report: " + report.getId());
-
         return binder.getReportTO(report);
     }
 
@@ -160,9 +152,6 @@ public class ReportController extends Ab
             throw sccee;
         }
 
-        auditManager.audit(Category.report, ReportSubCategory.update, Result.success,
-                "Successfully updated report: " + report.getId());
-
         return binder.getReportTO(report);
     }
 
@@ -180,10 +169,6 @@ public class ReportController extends Ab
         for (Report report : reports) {
             result.add(binder.getReportTO(report));
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.list, Result.success,
-                "Successfully listed all reports: " + result.size());
-
         return result;
     }
 
@@ -195,10 +180,6 @@ public class ReportController extends Ab
         for (Report report : reports) {
             result.add(binder.getReportTO(report));
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.list, Result.success,
-                "Successfully listed reports (page=" + page + ", size=" + size + "): " + result.size());
-
         return result;
     }
 
@@ -219,9 +200,6 @@ public class ReportController extends Ab
                 reportletConfClasses.add(reportletConfClass.getName());
             }
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.getReportletConfClasses, Result.success,
-                "Successfully listed all ReportletConf classes: " + reportletConfClasses.size());
         return reportletConfClasses;
     }
 
@@ -232,10 +210,6 @@ public class ReportController extends Ab
         if (report == null) {
             throw new NotFoundException("Report " + reportId);
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.read, Result.success,
-                "Successfully read report: " + report.getId());
-
         return binder.getReportTO(report);
     }
 
@@ -247,10 +221,6 @@ public class ReportController extends Ab
         if (reportExec == null) {
             throw new NotFoundException("Report execution " + executionId);
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.readExecution, Result.success,
-                "Successfully read report execution: " + reportExec.getId());
-
         return binder.getReportExecTO(reportExec);
     }
 
@@ -343,9 +313,6 @@ public class ReportController extends Ab
             IOUtils.closeQuietly(zis);
             IOUtils.closeQuietly(bais);
         }
-
-        auditManager.audit(Category.report, ReportSubCategory.exportExecutionResult, Result.success,
-                "Successfully exported report execution: " + reportExec.getId());
     }
 
     @PreAuthorize("hasRole('REPORT_READ')")
@@ -384,15 +351,9 @@ public class ReportController extends Ab
 
             scheduler.getScheduler().triggerJob(
                     new JobKey(JobInstanceLoader.getJobName(report), Scheduler.DEFAULT_GROUP));
-
-            auditManager.audit(Category.report, ReportSubCategory.execute, Result.success,
-                    "Successfully started execution for report: " + report.getId());
         } catch (Exception e) {
             LOG.error("While executing report {}", report, e);
 
-            auditManager.audit(Category.report, ReportSubCategory.execute, Result.failure,
-                    "Could not start execution for report: " + report.getId(), e);
-
             SyncopeClientCompositeErrorException scce =
                     new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
             SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
@@ -419,14 +380,8 @@ public class ReportController extends Ab
         }
 
         ReportTO deletedReport = binder.getReportTO(report);
-
         jobInstanceLoader.unregisterJob(report);
-
         reportDAO.delete(report);
-
-        auditManager.audit(Category.report, ReportSubCategory.delete, Result.success,
-                "Successfully deleted report: " + report.getId());
-
         return deletedReport;
     }
 
@@ -439,12 +394,40 @@ public class ReportController extends Ab
         }
 
         ReportExecTO reportExecToDelete = binder.getReportExecTO(reportExec);
-
         reportExecDAO.delete(reportExec);
+        return reportExecToDelete;
+    }
 
-        auditManager.audit(Category.report, ReportSubCategory.deleteExecution, Result.success,
-                "Successfully deleted report execution: " + reportExec.getId());
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ReportTO resolveReference(final Method method, final Object... args) throws
+            UnresolvedReferenceException {
+        Long id = null;
+
+        if (ArrayUtils.isNotEmpty(args) && ("create".equals(method.getName())
+                || "createInternal".equals(method.getName())
+                || "update".equals(method.getName())
+                || "delete".equals(method.getName()))) {
+            for (int i = 0; id == null && i < args.length; i++) {
+                if (args[i] instanceof Long) {
+                    id = (Long) args[i];
+                } else if (args[i] instanceof ReportTO) {
+                    id = ((ReportTO) args[i]).getId();
+                }
+            }
+        }
 
-        return reportExecToDelete;
+        if (id != null) {
+            try {
+                return binder.getReportTO(reportDAO.find(id));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java Tue Nov  5 08:22:31 2013
@@ -18,25 +18,22 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.List;
 import java.util.Set;
 import javax.persistence.EntityExistsException;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.types.AuditElements;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.ResourceSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.MappingPurpose;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.connid.ConnObjectUtil;
 import org.apache.syncope.core.init.ImplementationClassNamesLoader;
 import org.apache.syncope.core.persistence.beans.AbstractAttributable;
@@ -73,10 +70,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/resource")
-public class ResourceController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class ResourceController extends AbstractTransactionalController<ResourceTO> {
 
     @Autowired
     private ResourceDAO resourceDAO;
@@ -125,9 +119,6 @@ public class ResourceController extends 
 
         ExternalResource resource = resourceDAO.save(binder.create(resourceTO));
 
-        auditManager.audit(Category.resource, ResourceSubCategory.create, Result.success,
-                "Successfully created resource: " + resource.getName());
-
         response.setStatus(HttpServletResponse.SC_CREATED);
         return binder.getResourceTO(resource);
     }
@@ -145,9 +136,6 @@ public class ResourceController extends 
         resource = binder.update(resource, resourceTO);
         resource = resourceDAO.save(resource);
 
-        auditManager.audit(Category.resource, ResourceSubCategory.update, Result.success,
-                "Successfully updated resource: " + resource.getName());
-
         return binder.getResourceTO(resource);
     }
 
@@ -161,9 +149,6 @@ public class ResourceController extends 
 
         ResourceTO resourceToDelete = binder.getResourceTO(resource);
 
-        auditManager.audit(Category.resource, ResourceSubCategory.delete, Result.success,
-                "Successfully deleted resource: " + resource.getName());
-
         resourceDAO.delete(resourceName);
 
         return resourceToDelete;
@@ -178,9 +163,6 @@ public class ResourceController extends 
             throw new NotFoundException("Resource '" + resourceName + "'");
         }
 
-        auditManager.audit(Category.resource, ResourceSubCategory.read, Result.success,
-                "Successfully read resource: " + resource.getName());
-
         return binder.getResourceTO(resource);
     }
 
@@ -190,9 +172,6 @@ public class ResourceController extends 
         Set<String> actionsClasses = classNamesLoader.getClassNames(
                 ImplementationClassNamesLoader.Type.PROPAGATION_ACTIONS);
 
-        auditManager.audit(Category.resource, AuditElements.ResourceSubCategory.getPropagationActionsClasses,
-                Result.success, "Successfully listed all PropagationActions classes: " + actionsClasses.size());
-
         return new ModelAndView().addObject(actionsClasses);
     }
 
@@ -210,11 +189,6 @@ public class ResourceController extends 
 
         List<ResourceTO> result = binder.getResourceTOs(resources);
 
-        auditManager.audit(Category.resource, ResourceSubCategory.list, Result.success,
-                connInstanceId == null
-                ? "Successfully listed all resources: " + result.size()
-                : "Successfully listed resources for connector " + connInstanceId + ": " + result.size());
-
         return result;
     }
 
@@ -244,14 +218,15 @@ public class ResourceController extends 
                 throw new IllegalArgumentException("Not supported for MEMBERSHIP");
         }
         if (attributable == null) {
-            throw new NotFoundException(type + " " + id );
+            throw new NotFoundException(type + " " + id);
         }
 
         final AttributableUtil attrUtil = AttributableUtil.getInstance(type);
 
         AbstractMappingItem accountIdItem = attrUtil.getAccountIdItem(resource);
         if (accountIdItem == null) {
-            throw new NotFoundException("AccountId mapping for " + type + " " + id + " on resource '" + resourceName + "'");
+            throw new NotFoundException("AccountId mapping for " + type + " " + id + " on resource '" + resourceName
+                    + "'");
         }
         final String accountIdValue =
                 MappingUtil.getAccountIdValue(attributable, resource, attrUtil.getAccountIdItem(resource));
@@ -274,10 +249,6 @@ public class ResourceController extends 
             attributes.add(connectorObject.getName());
         }
 
-        auditManager.audit(Category.resource, ResourceSubCategory.getObject, Result.success,
-                "Successfully read object " + accountIdValue + " with class " + objectClass
-                + " from resource " + resourceName);
-
         return connObjectUtil.getConnObjectTO(connectorObject);
     }
 
@@ -293,13 +264,7 @@ public class ResourceController extends 
         try {
             connector.test();
             result = true;
-
-            auditManager.audit(Category.connector, AuditElements.ConnectorSubCategory.check, Result.success,
-                    "Successfully checked connector: " + resourceTO);
         } catch (Exception e) {
-            auditManager.audit(Category.connector, AuditElements.ConnectorSubCategory.check, Result.failure,
-                    "Unsuccessful check for connector: " + resourceTO, e);
-
             LOG.error("Test connection failure {}", e);
             result = false;
         }
@@ -330,4 +295,34 @@ public class ResourceController extends 
 
         return res;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ResourceTO resolveReference(final Method method, final Object... args) throws
+            UnresolvedReferenceException {
+        String name = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; name == null && i < args.length; i++) {
+                if (args[i] instanceof String) {
+                    name = (String) args[i];
+                } else if (args[i] instanceof ResourceTO) {
+                    name = ((ResourceTO) args[i]).getName();
+                }
+            }
+        }
+
+        if (name != null) {
+            try {
+                return binder.getResourceTO(resourceDAO.find(name));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java Tue Nov  5 08:22:31 2013
@@ -18,21 +18,19 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import static org.apache.syncope.core.rest.controller.AbstractController.LOG;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.types.AuditElements;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.common.types.AuditElements.RoleSubCategory;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -51,8 +49,6 @@ import org.apache.syncope.core.util.Attr
 import org.apache.syncope.core.util.EntitlementUtil;
 import org.apache.syncope.core.workflow.WorkflowResult;
 import org.apache.syncope.core.workflow.role.RoleWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -66,15 +62,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/role")
-public class RoleController {
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(RoleController.class);
-
-    @Autowired
-    protected AuditManager auditManager;
+public class RoleController extends AbstractController<RoleTO> {
 
     @Autowired
     protected RoleDAO roleDAO;
@@ -111,9 +99,6 @@ public class RoleController {
             throw new UnauthorizedRoleException(role.getId());
         }
 
-        auditManager.audit(Category.role, RoleSubCategory.read, Result.success,
-                "Successfully read role: " + role.getId());
-
         return binder.getRoleTO(role);
     }
 
@@ -141,9 +126,6 @@ public class RoleController {
             throw new UnauthorizedRoleException(role.getId());
         }
 
-        auditManager.audit(Category.role, RoleSubCategory.selfRead, Result.success,
-                "Successfully read own role: " + role.getId());
-
         return binder.getRoleTO(role);
     }
 
@@ -162,11 +144,6 @@ public class RoleController {
                 ? null
                 : binder.getRoleTO(role.getParent());
 
-        auditManager.audit(Category.role, RoleSubCategory.parent, Result.success,
-                result == null
-                ? "Role " + role.getId() + " is a root role"
-                : "Found parent for role " + role.getId() + ": " + result.getId());
-
         return result;
     }
 
@@ -186,9 +163,6 @@ public class RoleController {
             }
         }
 
-        auditManager.audit(Category.role, RoleSubCategory.children, Result.success,
-                "Found " + childrenTOs.size() + " children of role " + roleId);
-
         return childrenTOs;
     }
 
@@ -224,9 +198,6 @@ public class RoleController {
             result.add(binder.getRoleTO(role));
         }
 
-        auditManager.audit(Category.role, AuditElements.RoleSubCategory.read, Result.success,
-                "Successfully searched for roles (page=" + page + ", size=" + size + "): " + result.size());
-
         return result;
     }
 
@@ -256,9 +227,6 @@ public class RoleController {
             roleTOs.add(binder.getRoleTO(role));
         }
 
-        auditManager.audit(Category.role, RoleSubCategory.list, Result.success,
-                "Successfully listed all roles: " + roleTOs.size());
-
         return roleTOs;
     }
 
@@ -300,9 +268,6 @@ public class RoleController {
 
         LOG.debug("About to return created role\n{}", savedTO);
 
-        auditManager.audit(Category.role, RoleSubCategory.create, Result.success,
-                "Successfully created role: " + savedTO.getId());
-
         response.setStatus(HttpServletResponse.SC_CREATED);
         return savedTO;
     }
@@ -338,9 +303,6 @@ public class RoleController {
         final RoleTO updatedTO = binder.getRoleTO(updated.getResult());
         updatedTO.setPropagationStatusTOs(propagationReporter.getStatuses());
 
-        auditManager.audit(Category.role, RoleSubCategory.update, Result.success,
-                "Successfully updated role: " + role.getId());
-
         LOG.debug("About to return updated role\n{}", updatedTO);
 
         return updatedTO;
@@ -376,11 +338,39 @@ public class RoleController {
 
         rwfAdapter.delete(roleId);
 
-        auditManager.audit(Category.role, RoleSubCategory.delete, Result.success,
-                "Successfully deleted role: " + roleId);
-
         LOG.debug("Role successfully deleted: {}", roleId);
 
         return roleTO;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected RoleTO 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 RoleTO) {
+                    id = ((RoleTO) args[i]).getId();
+                } else if (args[i] instanceof RoleMod) {
+                    id = ((RoleMod) args[i]).getId();
+                }
+            }
+        }
+
+        if (id != null) {
+            try {
+                return binder.getRoleTO(id);
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java Tue Nov  5 08:22:31 2013
@@ -18,19 +18,17 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import javax.persistence.EntityExistsException;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.SchemaTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.common.types.AuditElements.SchemaSubCategory;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.AbstractSchema;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.dao.SchemaDAO;
@@ -47,10 +45,7 @@ import org.springframework.web.bind.anno
 
 @Controller
 @RequestMapping("/schema")
-public class SchemaController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class SchemaController extends AbstractTransactionalController<SchemaTO> {
 
     @Autowired
     private SchemaDAO schemaDAO;
@@ -83,11 +78,8 @@ public class SchemaController extends Ab
         binder.create(schemaTO, schema);
         schema = schemaDAO.save(schema);
 
-        auditManager.audit(Category.schema, SchemaSubCategory.create, Result.success,
-                "Successfully created schema: " + kind + "/" + schema.getName());
-
         response.setStatus(HttpServletResponse.SC_CREATED);
-        return binder.getSchemaTO(schema, attrUtil);
+        return binder.getSchemaTO(schema);
     }
 
     @PreAuthorize("hasRole('SCHEMA_DELETE')")
@@ -101,13 +93,8 @@ public class SchemaController extends Ab
             throw new NotFoundException("Schema '" + schemaName + "'");
         }
 
-        SchemaTO schemaToDelete = binder.getSchemaTO(schema, getAttributableUtil(kind));
-
+        SchemaTO schemaToDelete = binder.getSchemaTO(schema);
         schemaDAO.delete(schemaName, getAttributableUtil(kind));
-
-        auditManager.audit(Category.schema, SchemaSubCategory.delete, Result.success,
-                "Successfully deleted schema: " + kind + "/" + schema.getName());
-
         return schemaToDelete;
     }
 
@@ -118,12 +105,9 @@ public class SchemaController extends Ab
 
         List<SchemaTO> schemaTOs = new ArrayList<SchemaTO>(schemas.size());
         for (AbstractSchema schema : schemas) {
-            schemaTOs.add(binder.getSchemaTO(schema, attributableUtil));
+            schemaTOs.add(binder.getSchemaTO(schema));
         }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.list, Result.success,
-                "Successfully listed all schemas: " + kind + "/" + schemaTOs.size());
-
         return schemaTOs;
     }
 
@@ -138,10 +122,7 @@ public class SchemaController extends Ab
             throw new NotFoundException("Schema '" + schemaName + "'");
         }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.read, Result.success,
-                "Successfully read schema: " + kind + "/" + schema.getName());
-
-        return binder.getSchemaTO(schema, attributableUtil);
+        return binder.getSchemaTO(schema);
     }
 
     @PreAuthorize("hasRole('SCHEMA_UPDATE')")
@@ -156,11 +137,41 @@ public class SchemaController extends Ab
         }
 
         binder.update(schemaTO, schema, attributableUtil);
-        schema = schemaDAO.save(schema);
+        return binder.getSchemaTO(schemaDAO.save(schema));
+    }
 
-        auditManager.audit(Category.schema, SchemaSubCategory.update, Result.success,
-                "Successfully updated schema: " + kind + "/" + schema.getName());
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected SchemaTO resolveReference(final Method method, final Object... args) throws
+            UnresolvedReferenceException {
+        String kind = null;
+        String name = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; (name == null || kind == null) && i < args.length; i++) {
+                if (args[i] instanceof String) {
+                    if (kind == null) {
+                        kind = (String) args[i];
+                    } else {
+                        name = (String) args[i];
+                    }
+                } else if (args[i] instanceof SchemaTO) {
+                    name = ((SchemaTO) args[i]).getName();
+                }
+            }
+        }
+
+        if (name != null) {
+            try {
+                return binder.getSchemaTO(schemaDAO.find(name, getAttributableUtil(kind).schemaClass()));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
 
-        return binder.getSchemaTO(schema, attributableUtil);
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java Tue Nov  5 08:22:31 2013
@@ -18,26 +18,23 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Set;
 import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.SchedTaskTO;
 import org.apache.syncope.common.to.SyncTaskTO;
 import org.apache.syncope.common.to.TaskExecTO;
 import org.apache.syncope.common.to.TaskTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.common.types.AuditElements.TaskSubCategory;
 import org.apache.syncope.common.types.PropagationMode;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.init.ImplementationClassNamesLoader;
 import org.apache.syncope.core.init.JobInstanceLoader;
 import org.apache.syncope.core.notification.NotificationJob;
@@ -70,10 +67,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/task")
-public class TaskController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class TaskController extends AbstractTransactionalController<TaskTO> {
 
     @Autowired
     private TaskDAO taskDAO;
@@ -133,9 +127,6 @@ public class TaskController extends Abst
             throw scce;
         }
 
-        auditManager.audit(Category.task, TaskSubCategory.create, Result.success,
-                "Successfully created task: " + task.getId() + "/" + taskUtil);
-
         return binder.getTaskTO(task, taskUtil);
     }
 
@@ -173,9 +164,6 @@ public class TaskController extends Abst
             throw scce;
         }
 
-        auditManager.audit(Category.task, TaskSubCategory.update, Result.success,
-                "Successfully udpated task: " + task.getId() + "/" + taskUtil);
-
         return binder.getTaskTO(task, taskUtil);
     }
 
@@ -200,9 +188,6 @@ public class TaskController extends Abst
             taskTOs.add(binder.getTaskTO(task, taskUtil));
         }
 
-        auditManager.audit(Category.task, TaskSubCategory.list, Result.success,
-                "Successfully listed all tasks: " + taskTOs.size() + "/" + taskUtil);
-
         return taskTOs;
     }
 
@@ -219,33 +204,21 @@ public class TaskController extends Abst
             taskTOs.add(binder.getTaskTO(task, taskUtil));
         }
 
-        auditManager.audit(Category.task, TaskSubCategory.list, Result.success,
-                "Successfully listed all tasks (page=" + page + ", size=" + size + "): "
-                + taskTOs.size() + "/" + taskUtil);
-
         return taskTOs;
     }
 
     @PreAuthorize("hasRole('TASK_LIST')")
     @RequestMapping(method = RequestMethod.GET, value = "/jobClasses")
     public ModelAndView getJobClasses() {
-        Set<String> jobClasses = classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.TASKJOB);
-
-        auditManager.audit(Category.task, TaskSubCategory.getJobClasses, Result.success,
-                "Successfully listed all Job classes: " + jobClasses.size());
-
-        return new ModelAndView().addObject(jobClasses);
+        return new ModelAndView().addObject(
+                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.TASKJOB));
     }
 
     @PreAuthorize("hasRole('TASK_LIST')")
     @RequestMapping(method = RequestMethod.GET, value = "/syncActionsClasses")
     public ModelAndView getSyncActionsClasses() {
-        Set<String> actionsClasses = classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_ACTIONS);
-
-        auditManager.audit(Category.task, TaskSubCategory.getSyncActionsClasses, Result.success,
-                "Successfully listed all SyncActions classes: " + actionsClasses.size());
-
-        return new ModelAndView().addObject(actionsClasses);
+        return new ModelAndView().addObject(
+                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_ACTIONS));
     }
 
     @PreAuthorize("hasRole('TASK_READ')")
@@ -255,12 +228,7 @@ public class TaskController extends Abst
         if (task == null) {
             throw new NotFoundException("Task " + taskId);
         }
-        TaskUtil taskUtil = getTaskUtil(task);
-
-        auditManager.audit(Category.task, TaskSubCategory.read, Result.success,
-                "Successfully read task: " + task.getId() + "/" + taskUtil);
-
-        return binder.getTaskTO(task, taskUtil);
+        return binder.getTaskTO(task, getTaskUtil(task));
     }
 
     @PreAuthorize("hasRole('TASK_READ')")
@@ -270,10 +238,6 @@ public class TaskController extends Abst
         if (taskExec == null) {
             throw new NotFoundException("Task execution " + executionId);
         }
-
-        auditManager.audit(Category.task, TaskSubCategory.readExecution, Result.success,
-                "Successfully read task execution: " + taskExec.getId());
-
         return binder.getTaskExecTO(taskExec);
     }
 
@@ -316,9 +280,6 @@ public class TaskController extends Abst
                 } catch (Exception e) {
                     LOG.error("While executing task {}", task, e);
 
-                    auditManager.audit(Category.task, TaskSubCategory.execute, Result.failure,
-                            "Could not start execution for task: " + task.getId() + "/" + taskUtil, e);
-
                     SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(
                             HttpStatus.BAD_REQUEST);
                     SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
@@ -337,10 +298,6 @@ public class TaskController extends Abst
             default:
         }
         LOG.debug("Execution finished for {}, {}", task, result);
-
-        auditManager.audit(Category.task, TaskSubCategory.execute, Result.success,
-                "Successfully started execution for task: " + task.getId() + "/" + taskUtil);
-
         return result;
     }
 
@@ -386,21 +343,12 @@ public class TaskController extends Abst
             SyncopeClientCompositeErrorException scce =
                     new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
             scce.addException(sce);
-
-            auditManager.audit(Category.task, TaskSubCategory.report, Result.failure,
-                    "Could not reported execution status: " + exec.getId() + "/" + taskUtil, scce);
-
             throw scce;
         }
 
         exec.setStatus(status.toString());
         exec.setMessage(message);
-        exec = taskExecDAO.save(exec);
-
-        auditManager.audit(Category.task, TaskSubCategory.report, Result.success,
-                "Successfully reported execution status: " + exec.getId() + "/" + taskUtil);
-
-        return binder.getTaskExecTO(exec);
+        return binder.getTaskExecTO(taskExecDAO.save(exec));
     }
 
     @PreAuthorize("hasRole('TASK_DELETE')")
@@ -419,10 +367,6 @@ public class TaskController extends Abst
         }
 
         taskDAO.delete(task);
-
-        auditManager.audit(Category.task, TaskSubCategory.delete, Result.success,
-                "Successfully deleted task: " + task.getId() + "/" + taskUtil);
-
         return taskToDelete;
     }
 
@@ -435,11 +379,7 @@ public class TaskController extends Abst
         }
 
         TaskExecTO taskExecutionToDelete = binder.getTaskExecTO(taskExec);
-
         taskExecDAO.delete(taskExec);
-
-        auditManager.audit(Category.task, TaskSubCategory.deleteExecution, Result.success,
-                "Successfully deleted task execution: " + taskExec.getId());
         return taskExecutionToDelete;
     }
 
@@ -491,4 +431,36 @@ public class TaskController extends Abst
 
         return res;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected TaskTO resolveReference(final Method method, final Object... args) throws
+            UnresolvedReferenceException {
+        Long id = null;
+
+        if (ArrayUtils.isNotEmpty(args)
+                && !"deleteExecution".equals(method.getName()) && !"readExecution".equals(method.getName())) {
+            for (int i = 0; id == null && i < args.length; i++) {
+                if (args[i] instanceof Long) {
+                    id = (Long) args[i];
+                } else if (args[i] instanceof TaskTO) {
+                    id = ((TaskTO) args[i]).getId();
+                }
+            }
+        }
+
+        if (id != null) {
+            try {
+                final Task task = taskDAO.find(id);
+                return binder.getTaskTO(task, getTaskUtil(task));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
 }

Added: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java?rev=1538902&view=auto
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java (added)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java Tue Nov  5 08:22:31 2013
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.syncope.core.rest.controller;
+
+/**
+ * Indicates unresolved bean reference.
+ */
+public class UnresolvedReferenceException extends Exception {
+
+    private static final long serialVersionUID = -675489116009955632L;
+
+    public UnresolvedReferenceException() {
+    }
+
+    public UnresolvedReferenceException(Throwable cause) {
+        super(cause);
+    }
+}