syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1536304 [2/4] - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/rest/ common/src/main/java/org/apache/syncope/common/ common/src/main/java/org/apache/syncope/common/types/ common/src/main/java/org/apache/syncope/common/va...
Date Mon, 28 Oct 2013 10:24:49 GMT
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java Mon Oct 28 10:24:47 2013
@@ -34,7 +34,7 @@ import org.apache.syncope.common.to.Reso
 import org.apache.syncope.common.to.SchemaTO;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.util.BeanUtils;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.console.SyncopeSession;
 import org.springframework.stereotype.Component;
 
@@ -73,7 +73,7 @@ public class ConnectorRestClient extends
 
         try {
             connectorTO = getService(ConnectorService.class).read(connectorInstanceId);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a connector", e);
         }
 
@@ -97,7 +97,7 @@ public class ConnectorRestClient extends
 
         try {
             bundles = getService(ConnectorService.class).getBundles(SyncopeSession.get().getLocale().toString());
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting connector bundles", e);
         }
 
@@ -115,7 +115,7 @@ public class ConnectorRestClient extends
 
         try {
             properties = getService(ConnectorService.class).getConfigurationProperties(connectorId);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting connector configuration properties", e);
         }
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java Mon Oct 28 10:24:47 2013
@@ -25,7 +25,7 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.types.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportTO;
 import org.apache.syncope.common.types.ReportExecExportFormat;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -37,7 +37,7 @@ public class ReportRestClient extends Ba
         try {
             ReportletConfClasses reportletConfClasses = getService(ReportService.class).getReportletConfClasses();
             return reportletConfClasses.getConfClasses();
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting available reportlet classes", e);
             return new ArrayList<String>();
         }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ResourceRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ResourceRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ResourceRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ResourceRestClient.java Mon Oct 28 10:24:47 2013
@@ -29,7 +29,7 @@ import org.apache.syncope.common.to.Prop
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.springframework.stereotype.Component;
 
 /**
@@ -46,7 +46,7 @@ public class ResourceRestClient extends 
         try {
             Set<PropagationActionClassTO> response = getService(ResourceService.class).getPropagationActionsClasses();
             actions = CollectionWrapper.unwrapPropagationActionClasses(response);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all propagation actions classes", e);
         }
         return actions;
@@ -57,7 +57,7 @@ public class ResourceRestClient extends 
 
         try {
             resources = getService(ResourceService.class).list();
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading all resources", e);
         }
 
@@ -73,7 +73,7 @@ public class ResourceRestClient extends 
 
         try {
             resourceTO = getService(ResourceService.class).read(name);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a resource", e);
         }
         return resourceTO;

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java Mon Oct 28 10:24:47 2013
@@ -32,7 +32,7 @@ import org.apache.syncope.common.to.VirS
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.springframework.stereotype.Component;
 
 /**
@@ -48,7 +48,7 @@ public class SchemaRestClient extends Ba
 
         try {
             schemas = getService(SchemaService.class).list(attrType, schemaType);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all schemas for {} and {}", attrType, schemaType, e);
         }
 
@@ -65,7 +65,7 @@ public class SchemaRestClient extends Ba
 
         try {
             schemas = getService(SchemaService.class).list(type, SchemaType.NORMAL);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all schemas", e);
         }
 
@@ -80,7 +80,7 @@ public class SchemaRestClient extends Ba
             for (AbstractSchemaTO schemaTO : schemas) {
                 schemaNames.add(schemaTO.getName());
             }
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user schema names", e);
         }
 
@@ -100,7 +100,7 @@ public class SchemaRestClient extends Ba
             for (SchemaTO schemaTO : schemas) {
                 schemaNames.add(schemaTO.getName());
             }
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user schema names", e);
         }
 
@@ -118,7 +118,7 @@ public class SchemaRestClient extends Ba
 
         try {
             userDerSchemas = getService(SchemaService.class).list(type, SchemaType.DERIVED);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user derived schemas", e);
         }
 
@@ -139,7 +139,7 @@ public class SchemaRestClient extends Ba
             for (DerSchemaTO schemaTO : userDerSchemas) {
                 userDerSchemasNames.add(schemaTO.getName());
             }
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user derived schema names", e);
         }
 
@@ -157,7 +157,7 @@ public class SchemaRestClient extends Ba
 
         try {
             userVirSchemas = getService(SchemaService.class).list(type, SchemaType.VIRTUAL);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user derived schemas", e);
         }
 
@@ -178,7 +178,7 @@ public class SchemaRestClient extends Ba
             for (VirSchemaTO schemaTO : userVirSchemas) {
                 userVirSchemasNames.add(schemaTO.getName());
             }
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all user derived schema names", e);
         }
 
@@ -205,7 +205,7 @@ public class SchemaRestClient extends Ba
 
         try {
             schema = getService(SchemaService.class).read(type, SchemaType.NORMAL, name);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a user schema", e);
         }
         return schema;
@@ -260,7 +260,7 @@ public class SchemaRestClient extends Ba
         DerSchemaTO derivedSchemaTO = null;
         try {
             derivedSchemaTO = getService(SchemaService.class).read(type, SchemaType.DERIVED, name);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a derived user schema", e);
         }
         return derivedSchemaTO;
@@ -316,7 +316,7 @@ public class SchemaRestClient extends Ba
             List<ValidatorTO> validators = new ArrayList<ValidatorTO>(getService(ConfigurationService.class)
                     .getValidators());
             response = CollectionWrapper.unwrapValidator(validators);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all validators", e);
         }
         return response;

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/TaskRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/TaskRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/TaskRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/TaskRestClient.java Mon Oct 28 10:24:47 2013
@@ -32,7 +32,7 @@ import org.apache.syncope.common.to.Sync
 import org.apache.syncope.common.to.AbstractTaskTO;
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.springframework.stereotype.Component;
 
 /**
@@ -53,7 +53,7 @@ public class TaskRestClient extends Base
 
         try {
             jobClasses = new ArrayList<JobClassTO>(getService(TaskService.class).getJobClasses());
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all job classes", e);
         }
         return CollectionWrapper.unwrapJobClasses(jobClasses);
@@ -64,7 +64,7 @@ public class TaskRestClient extends Base
 
         try {
             actions = new ArrayList<SyncActionClassTO>(getService(TaskService.class).getSyncActionsClasses());
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While getting all sync actions classes", e);
         }
         return CollectionWrapper.unwrapSyncActionClasses(actions);

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/UserRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/UserRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/UserRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/UserRestClient.java Mon Oct 28 10:24:47 2013
@@ -30,7 +30,7 @@ import org.apache.syncope.common.to.Bulk
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.console.commons.StatusBean;
 import org.apache.syncope.console.commons.StatusUtils;
 import org.springframework.stereotype.Component;
@@ -78,7 +78,7 @@ public class UserRestClient extends Abst
         UserTO userTO = null;
         try {
             userTO = getService(UserService.class).read(id);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a user", e);
         }
         return userTO;
@@ -88,7 +88,7 @@ public class UserRestClient extends Abst
         UserTO userTO = null;
         try {
             userTO = getService(UserService.class).read(username);
-        } catch (SyncopeClientCompositeException e) {
+        } catch (SyncopeClientException e) {
             LOG.error("While reading a user", e);
         }
         return userTO;

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java Mon Oct 28 10:24:47 2013
@@ -21,7 +21,7 @@ package org.apache.syncope.console.rest;
 import org.apache.syncope.common.services.WorkflowService;
 import org.apache.syncope.common.to.WorkflowDefinitionTO;
 import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -29,11 +29,11 @@ public class WorkflowRestClient extends 
 
     private static final long serialVersionUID = 5049285686167071017L;
 
-    public WorkflowDefinitionTO getDefinition() throws SyncopeClientCompositeException {
+    public WorkflowDefinitionTO getDefinition() throws SyncopeClientException {
         return getService(WorkflowService.class).getDefinition(AttributableType.USER);
     }
 
-    public void updateDefinition(final WorkflowDefinitionTO workflowDef) throws SyncopeClientCompositeException {
+    public void updateDefinition(final WorkflowDefinitionTO workflowDef) throws SyncopeClientException {
         getService(WorkflowService.class).updateDefinition(AttributableType.USER, workflowDef);
     }
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java Mon Oct 28 10:24:47 2013
@@ -19,7 +19,7 @@
 package org.apache.syncope.console.wicket.markup.html.tree;
 
 import org.apache.syncope.common.to.RoleTO;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.console.commons.Constants;
 import org.apache.syncope.console.commons.XMLRolesReader;
 import org.apache.syncope.console.pages.ResultStatusModalPage;
@@ -140,7 +140,7 @@ public class TreeActionLinkPanel extends
                         });
 
                         window.show(target);
-                    } catch (SyncopeClientCompositeException scce) {
+                    } catch (SyncopeClientException scce) {
                         error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage());
                         target.add(((Roles) pageRef.getPage()).getFeedbackPanel());
                     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/RoleDAO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/RoleDAO.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/RoleDAO.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/RoleDAO.java Mon Oct 28 10:24:47 2013
@@ -39,6 +39,8 @@ public interface RoleDAO extends Attribu
 
     List<SyncopeRole> findOwned(SyncopeUser owner);
 
+    List<SyncopeRole> findOwned(SyncopeRole owner);
+
     List<SyncopeRole> findByEntitlement(final Entitlement entitlement);
 
     List<SyncopeRole> findAncestors(SyncopeRole role);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RoleDAOImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RoleDAOImpl.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RoleDAOImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RoleDAOImpl.java Mon Oct 28 10:24:47 2013
@@ -103,8 +103,8 @@ public class RoleDAOImpl extends Abstrac
 
     @Override
     public List<SyncopeRole> find(final String name) {
-        TypedQuery<SyncopeRole> query =
-                entityManager.createQuery("SELECT e FROM SyncopeRole e WHERE e.name = :name", SyncopeRole.class);
+        TypedQuery<SyncopeRole> query = entityManager.createQuery("SELECT e FROM SyncopeRole e WHERE e.name = :name",
+                SyncopeRole.class);
         query.setParameter("name", name);
 
         return query.getResultList();
@@ -164,9 +164,25 @@ public class RoleDAOImpl extends Abstrac
     }
 
     @Override
+    public List<SyncopeRole> findOwned(final SyncopeRole owner) {
+        StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(SyncopeRole.class.getSimpleName()).
+                append(" e WHERE e.roleOwner=:owner ");
+
+        TypedQuery<SyncopeRole> query = entityManager.createQuery(queryString.toString(), SyncopeRole.class);
+        query.setParameter("owner", owner);
+
+        List<SyncopeRole> result = new ArrayList<SyncopeRole>();
+        for (SyncopeRole role : query.getResultList()) {
+            findSameOwnerDescendants(result, role);
+        }
+
+        return result;
+    }
+
+    @Override
     public List<SyncopeRole> findByEntitlement(final Entitlement entitlement) {
-        TypedQuery<SyncopeRole> query =
-                entityManager.createQuery("SELECT e FROM " + SyncopeRole.class.getSimpleName() + " e "
+        TypedQuery<SyncopeRole> query = entityManager.createQuery("SELECT e FROM " + SyncopeRole.class.getSimpleName()
+                + " e "
                 + "WHERE :entitlement MEMBER OF e.entitlements", SyncopeRole.class);
         query.setParameter("entitlement", entitlement);
 
@@ -189,8 +205,8 @@ public class RoleDAOImpl extends Abstrac
 
     @Override
     public List<SyncopeRole> findChildren(final SyncopeRole role) {
-        TypedQuery<SyncopeRole> query =
-                entityManager.createQuery("SELECT r FROM SyncopeRole r WHERE " + "r.parent=:role", SyncopeRole.class);
+        TypedQuery<SyncopeRole> query = entityManager.createQuery("SELECT r FROM SyncopeRole r WHERE "
+                + "r.parent=:role", SyncopeRole.class);
         query.setParameter("role", role);
 
         return query.getResultList();
@@ -256,8 +272,8 @@ public class RoleDAOImpl extends Abstrac
 
     @Override
     public List<Membership> findMemberships(final SyncopeRole role) {
-        TypedQuery<Membership> query =
-                entityManager.createQuery("SELECT e FROM " + Membership.class.getSimpleName() + " e"
+        TypedQuery<Membership> query = entityManager.createQuery("SELECT e FROM " + Membership.class.getSimpleName()
+                + " e"
                 + " WHERE e.syncopeRole=:role", Membership.class);
         query.setParameter("role", role);
 
@@ -348,9 +364,9 @@ public class RoleDAOImpl extends Abstrac
         for (RVirAttr attr : rVirToBeDeleted) {
             role.removeVirAttr(attr);
         }
-        
+
         SyncopeRole merged = entityManager.merge(role);
-        
+
         // Now the same process for any exising membership of the role being saved
         if (role.getId() != null) {
             for (Long id : unmatched(role.getId(), MAttr.class, MAttrTemplate.class)) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/ParsingValidationException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/ParsingValidationException.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/ParsingValidationException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/ParsingValidationException.java Mon Oct 28 10:24:47 2013
@@ -24,7 +24,7 @@ public class ParsingValidationException 
 
     private static final long serialVersionUID = 5669262895008285522L;
 
-    public ParsingValidationException(String message, Throwable cause) {
+    public ParsingValidationException(final String message, final Throwable cause) {
         super(message, cause);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationException.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationException.java Mon Oct 28 10:24:47 2013
@@ -37,7 +37,6 @@ public class PropagationException extend
      * @param stackTrace original stacktrace
      */
     public PropagationException(final String resourceName, final String stackTrace) {
-
         super("Exception during provision on resource " + resourceName + "\n" + stackTrace);
 
         this.resourceName = resourceName;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java Mon Oct 28 10:24:47 2013
@@ -34,7 +34,7 @@ import org.apache.syncope.common.types.A
 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.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -43,6 +43,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.dao.ResourceDAO;
+import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.apache.syncope.core.propagation.Connector;
 import org.apache.syncope.core.propagation.ConnectorFactory;
 import org.apache.syncope.core.rest.data.ConnInstanceDataBinder;
@@ -85,19 +86,14 @@ public class ConnectorController extends
             connInstance = connInstanceDAO.save(connInstance);
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.success,
                     "Successfully created connector instance: " + connInstance.getDisplayName());
-        } catch (Exception e) {
+        } catch (InvalidEntityException e) {
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
                     "Could not create connector instance: " + connInstanceTO.getDisplayName(), e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException invalidConnInstance = new SyncopeClientException(
-                    SyncopeClientExceptionType.InvalidConnInstance);
-            invalidConnInstance.addElement(e.getMessage());
-
-            scce.addException(invalidConnInstance);
-            throw scce;
+            SyncopeClientException invalidConnInstance = SyncopeClientException.build(
+                    ClientExceptionType.InvalidConnInstance);
+            invalidConnInstance.getElements().add(e.getMessage());
+            throw invalidConnInstance;
         }
 
         return binder.getConnInstanceTO(connInstance);
@@ -112,19 +108,14 @@ public class ConnectorController extends
             connInstance = connInstanceDAO.save(connInstance);
             auditManager.audit(Category.connector, ConnectorSubCategory.update, Result.success,
                     "Successfully update connector instance: " + connInstance.getDisplayName());
-        } catch (Exception e) {
+        } catch (InvalidEntityException e) {
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
                     "Could not update connector instance: " + connInstanceTO.getDisplayName(), e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException invalidConnInstance = new SyncopeClientException(
-                    SyncopeClientExceptionType.InvalidConnInstance);
-            invalidConnInstance.addElement(e.getMessage());
-
-            scce.addException(invalidConnInstance);
-            throw scce;
+            SyncopeClientException invalidConnInstance = SyncopeClientException.build(
+                    ClientExceptionType.InvalidConnInstance);
+            invalidConnInstance.getElements().add(e.getMessage());
+            throw invalidConnInstance;
         }
 
         return binder.getConnInstanceTO(connInstance);
@@ -138,17 +129,12 @@ public class ConnectorController extends
         }
 
         if (!connInstance.getResources().isEmpty()) {
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException associatedResources =
-                    new SyncopeClientException(SyncopeClientExceptionType.AssociatedResources);
+            SyncopeClientException associatedResources = SyncopeClientException.build(
+                    ClientExceptionType.AssociatedResources);
             for (ExternalResource resource : connInstance.getResources()) {
-                associatedResources.addElement(resource.getName());
+                associatedResources.getElements().add(resource.getName());
             }
-
-            scce.addException(associatedResources);
-            throw scce;
+            throw associatedResources;
         }
 
         ConnInstanceTO connToDelete = binder.getConnInstanceTO(connInstance);
@@ -228,8 +214,8 @@ public class ConnectorController extends
                 for (String propName : properties.getPropertyNames()) {
                     ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema();
 
-                    ConfigurationPropertyImpl configurationProperty =
-                            (ConfigurationPropertyImpl) properties.getProperty(propName);
+                    ConfigurationPropertyImpl configurationProperty = (ConfigurationPropertyImpl) properties.
+                            getProperty(propName);
 
                     connConfPropSchema.setName(configurationProperty.getName());
                     connConfPropSchema.setDisplayName(configurationProperty.getDisplayName(propName));
@@ -269,8 +255,8 @@ public class ConnectorController extends
         // We cannot use Spring bean because this method could be used during resource definition or modification:
         // bean couldn't exist or couldn't be updated.
         // This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
-        final List<String> result =
-                new ArrayList<String>(connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial));
+        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() + ") "
@@ -329,8 +315,8 @@ public class ConnectorController extends
     @PreAuthorize("hasRole('CONNECTOR_READ')")
     @Transactional(readOnly = true)
     public boolean check(final ConnInstanceTO connInstanceTO) {
-        final Connector connector =
-                connFactory.createConnector(binder.getConnInstance(connInstanceTO), connInstanceTO.getConfiguration());
+        final Connector connector = connFactory.createConnector(binder.getConnInstance(connInstanceTO), connInstanceTO.
+                getConfiguration());
 
         boolean result;
         try {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/LoggerController.java Mon Oct 28 10:24:47 2013
@@ -32,7 +32,7 @@ import org.apache.syncope.common.types.A
 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.ClientExceptionType;
 import org.apache.syncope.common.types.LoggerLevel;
 import org.apache.syncope.common.types.LoggerType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
@@ -93,13 +93,10 @@ public class LoggerController extends Ab
     }
 
     private void throwInvalidLogger(final LoggerType type) {
-        SyncopeClientCompositeException sccee = 
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+        sce.getElements().add("Expected " + type.name());
 
-        SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidLogger);
-        sce.addElement("Expected " + type.name());
-
-        throw sccee;
+        throw sce;
     }
 
     private LoggerTO setLevel(final String name, final Level level, final LoggerType expectedType) {
@@ -147,14 +144,9 @@ public class LoggerController extends Ab
         try {
             setLevel(auditLoggerName.toLoggerName(), Level.DEBUG, LoggerType.AUDIT);
         } catch (IllegalArgumentException e) {
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidLogger);
-            sce.addElement(e.getMessage());
-            sccee.addException(sce);
-
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
     }
 
@@ -197,14 +189,9 @@ public class LoggerController extends Ab
         } catch (NotFoundException e) {
             LOG.debug("Ignoring disable of non existing logger {}", auditLoggerName.toLoggerName());
         } catch (IllegalArgumentException e) {
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidLogger);
-            sce.addElement(e.getMessage());
-            sccee.addException(sce);
-
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java Mon Oct 28 10:24:47 2013
@@ -45,7 +45,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.ReportExecExportFormat;
 import org.apache.syncope.common.types.ReportExecStatus;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -100,12 +100,9 @@ public class ReportController extends Ab
         } catch (Exception e) {
             LOG.error("While registering quartz job for report " + report.getId(), e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-            sce.addElement(e.getMessage());
-            scce.addException(sce);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
 
         auditManager.audit(Category.report, ReportSubCategory.create, Result.success,
@@ -131,12 +128,9 @@ public class ReportController extends Ab
         } catch (Exception e) {
             LOG.error("While registering quartz job for report " + report.getId(), e);
 
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-            sce.addElement(e.getMessage());
-            sccee.addException(sce);
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
 
         auditManager.audit(Category.report, ReportSubCategory.update, Result.success,
@@ -294,14 +288,11 @@ public class ReportController extends Ab
             throw new NotFoundException("Report execution " + executionId);
         }
         if (!ReportExecStatus.SUCCESS.name().equals(reportExec.getStatus()) || reportExec.getExecResult() == null) {
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidReportExec);
-            sce.addElement(reportExec.getExecResult() == null
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidReportExec);
+            sce.getElements().add(reportExec.getExecResult() == null
                     ? "No report data produced"
                     : "Report did not run successfully");
-            sccee.addException(sce);
-            throw sccee;
+            throw sce;
         }
         return reportExec;
     }
@@ -331,12 +322,9 @@ public class ReportController extends Ab
             auditManager.audit(Category.report, ReportSubCategory.execute, Result.failure,
                     "Could not start execution for report: " + report.getId(), e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-            sce.addElement(e.getMessage());
-            scce.addException(sce);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
 
         result = new ReportExecTO();

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java Mon Oct 28 10:24:47 2013
@@ -37,7 +37,7 @@ import org.apache.syncope.common.types.A
 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.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -112,12 +112,9 @@ public class ResourceController extends 
         LOG.debug("Resource creation: {}", resourceTO);
 
         if (StringUtils.isBlank(resourceTO.getName())) {
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
-            sce.addElement("Resource name");
-            sccee.addException(sce);
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
+            sce.getElements().add("Resource name");
+            throw sce;
         }
 
         if (resourceDAO.find(resourceTO.getName()) != null) {
@@ -357,12 +354,9 @@ public class ResourceController extends 
         } catch (Exception e) {
             LOG.error("Error retrieving {} method", methodName, e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Unknown);
-            sce.addElement("Operation execution failed");
-            scce.addException(sce);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
+            sce.getElements().add("Operation execution failed");
+            throw sce;
         }
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java Mon Oct 28 10:24:47 2013
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 import javax.annotation.Resource;
+import javax.ws.rs.core.Response;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
@@ -33,6 +34,9 @@ import org.apache.syncope.common.types.A
 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.common.types.ClientExceptionType;
+import org.apache.syncope.common.validation.SyncopeClientCompositeException;
+import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
@@ -189,7 +193,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<RoleTO> search(final NodeCond searchCondition)
             throws InvalidSearchConditionException {
 
@@ -197,7 +201,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<RoleTO> search(final NodeCond searchCondition, final int page, final int size)
             throws InvalidSearchConditionException {
 
@@ -224,7 +228,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_READ')")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public int searchCount(final NodeCond searchCondition)
             throws InvalidSearchConditionException {
 
@@ -270,14 +274,13 @@ public class RoleController {
         /*
          * Actual operations: workflow, propagation
          */
-
         WorkflowResult<Long> created = rwfAdapter.create(actual);
 
         EntitlementUtil.extendAuthContext(created.getResult());
 
         List<PropagationTask> tasks = propagationManager.getRoleCreateTaskIds(created, actual.getVirAttrs());
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
+                PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -310,13 +313,12 @@ public class RoleController {
         /*
          * Actual operations: workflow, propagation
          */
-
         WorkflowResult<Long> updated = rwfAdapter.update(actual);
 
         List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
                 actual.getVirAttrsToRemove(), actual.getVirAttrsToUpdate());
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
+                PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -338,6 +340,21 @@ public class RoleController {
     public RoleTO delete(final Long roleId) {
         LOG.debug("Role delete called for {}", roleId);
 
+        List<SyncopeRole> ownedRoles = roleDAO.findOwned(binder.getRoleFromId(roleId));
+        if (!ownedRoles.isEmpty()) {
+            List<String> owned = new ArrayList<String>(ownedRoles.size());
+            for (SyncopeRole role : ownedRoles) {
+                owned.add(role.getId() + " " + role.getName());
+            }
+
+            auditManager.audit(Category.role, AuditElements.UserSubCategory.delete, Result.failure,
+                    "Could not delete role: " + roleId + " because of role(s) ownership " + owned);
+
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RoleOwnership);
+            sce.getElements().addAll(owned);
+            throw sce;
+        }
+
         // Generate propagation tasks for deleting users from role resources, if they are on those resources only
         // because of the reason being deleted (see SYNCOPE-357)
         List<PropagationTask> tasks = new ArrayList<PropagationTask>();
@@ -351,8 +368,8 @@ public class RoleController {
         RoleTO roleTO = new RoleTO();
         roleTO.setId(roleId);
 
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
+                PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {
@@ -372,7 +389,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
     public RoleTO unlink(final Long roleId, final Collection<String> resources) {
         LOG.debug("About to unlink role({}) and resources {}", roleId, resources);
 
@@ -394,7 +411,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
     public RoleTO unassign(final Long roleId, final Collection<String> resources) {
         LOG.debug("About to unassign role({}) and resources {}", roleId, resources);
 
@@ -406,7 +423,7 @@ public class RoleController {
     }
 
     @PreAuthorize("hasRole('ROLE_UPDATE')")
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
     public RoleTO deprovision(final Long roleId, final Collection<String> resources) {
         LOG.debug("About to deprovision role({}) from resources {}", roleId, resources);
 
@@ -416,8 +433,8 @@ public class RoleController {
         noPropResourceName.removeAll(resources);
 
         final List<PropagationTask> tasks = propagationManager.getRoleDeleteTaskIds(roleId, noPropResourceName);
-        PropagationReporter propagationReporter =
-                ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
+        PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(
+                PropagationReporter.class);
         try {
             taskExecutor.execute(tasks, propagationReporter);
         } catch (PropagationException e) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java Mon Oct 28 10:24:47 2013
@@ -30,7 +30,7 @@ import org.apache.syncope.common.to.VirS
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.AuditElements;
 import org.apache.syncope.common.types.SchemaType;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -94,12 +94,9 @@ public class SchemaController extends Ab
             final T schemaTO) {
 
         if (StringUtils.isBlank(schemaTO.getName())) {
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
-            sce.addElement("Schema name");
-            sccee.addException(sce);
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
+            sce.getElements().add("Schema name");
+            throw sce;
         }
 
         final AttributableUtil attrUtil = AttributableUtil.getInstance(attrType);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java Mon Oct 28 10:24:47 2013
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
-import javax.ws.rs.core.Response;
 import org.apache.syncope.common.to.BulkAction;
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.SchedTaskTO;
@@ -34,7 +33,7 @@ import org.apache.syncope.common.types.A
 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.types.ClientExceptionType;
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -106,12 +105,9 @@ public class TaskController extends Abst
         } catch (Exception e) {
             LOG.error("While registering quartz job for task " + task.getId(), e);
 
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-            sce.addElement(e.getMessage());
-            scce.addException(sce);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
 
         auditManager.audit(Category.task, TaskSubCategory.create, Result.success,
@@ -136,9 +132,6 @@ public class TaskController extends Abst
 
         TaskUtil taskUtil = TaskUtil.getInstance(task);
 
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
         binder.updateSchedTask(task, taskTO, taskUtil);
         task = taskDAO.save(task);
 
@@ -147,10 +140,9 @@ public class TaskController extends Abst
         } catch (Exception e) {
             LOG.error("While registering quartz job for task " + task.getId(), e);
 
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-            sce.addElement(e.getMessage());
-            scce.addException(sce);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+            sce.getElements().add(e.getMessage());
+            throw sce;
         }
 
         auditManager.audit(Category.task, TaskSubCategory.update, Result.success,
@@ -285,12 +277,9 @@ public class TaskController extends Abst
                     auditManager.audit(Category.task, TaskSubCategory.execute, Result.failure,
                             "Could not start execution for task: " + task.getId() + "/" + taskUtil, e);
 
-                    SyncopeClientCompositeException scce =
-                            new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-                    SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
-                    sce.addElement(e.getMessage());
-                    scce.addException(sce);
-                    throw scce;
+                    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
+                    sce.getElements().add(e.getMessage());
+                    throw sce;
                 }
 
                 result = new TaskExecTO();
@@ -317,17 +306,17 @@ public class TaskController extends Abst
             throw new NotFoundException("Task execution " + executionId);
         }
 
-        SyncopeClientException sce = new SyncopeClientException(
-                SyncopeClientExceptionType.InvalidPropagationTaskExecReport);
+        SyncopeClientException sce = SyncopeClientException.build(
+                ClientExceptionType.InvalidPropagationTaskExecReport);
 
         TaskUtil taskUtil = TaskUtil.getInstance(exec.getTask());
         if (TaskType.PROPAGATION == taskUtil.getType()) {
             PropagationTask task = (PropagationTask) exec.getTask();
             if (task.getPropagationMode() != PropagationMode.TWO_PHASES) {
-                sce.addElement("Propagation mode: " + task.getPropagationMode());
+                sce.getElements().add("Propagation mode: " + task.getPropagationMode());
             }
         } else {
-            sce.addElement("Task type: " + taskUtil);
+            sce.getElements().add("Task type: " + taskUtil);
         }
 
         switch (status) {
@@ -338,21 +327,16 @@ public class TaskController extends Abst
             case CREATED:
             case SUBMITTED:
             case UNSUBMITTED:
-                sce.addElement("Execution status to be set: " + status);
+                sce.getElements().add("Execution status to be set: " + status);
                 break;
 
             default:
         }
 
         if (!sce.isEmpty()) {
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-            scce.addException(sce);
-
             auditManager.audit(Category.task, TaskSubCategory.report, Result.failure,
-                    "Could not reported execution status: " + exec.getId() + "/" + taskUtil, scce);
-
-            throw scce;
+                    "Could not reported execution status: " + exec.getId() + "/" + taskUtil, sce);
+            throw sce;
         }
 
         exec.setStatus(status.toString());

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Mon Oct 28 10:24:47 2013
@@ -25,7 +25,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import javax.ws.rs.core.Response;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.search.NodeCond;
 import org.apache.syncope.common.services.InvalidSearchConditionException;
@@ -40,7 +39,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.AuditElements.UserSubCategory;
 import org.apache.syncope.common.types.ResourceOperation;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -530,6 +529,8 @@ public class UserController {
     }
 
     protected UserTO doDelete(final Long userId) {
+        LOG.debug("User delete called for {}", userId);
+
         List<SyncopeRole> ownedRoles = roleDAO.findOwned(binder.getUserFromId(userId));
         if (!ownedRoles.isEmpty()) {
             List<String> owned = new ArrayList<String>(ownedRoles.size());
@@ -540,14 +541,9 @@ public class UserController {
             auditManager.audit(Category.user, UserSubCategory.delete, Result.failure,
                     "Could not delete user: " + userId + " because of role(s) ownership " + owned);
 
-            SyncopeClientCompositeException sccee =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.RoleOwnership);
-            sce.setElements(owned);
-            sccee.addException(sce);
-
-            throw sccee;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RoleOwnership);
+            sce.getElements().addAll(owned);
+            throw sce;
         }
 
         // Note here that we can only notify about "delete", not any other

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserRequestController.java Mon Oct 28 10:24:47 2013
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import javax.persistence.RollbackException;
-import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.UserRequestTO;
@@ -30,7 +29,7 @@ import org.apache.syncope.common.to.User
 import org.apache.syncope.common.types.AuditElements.Category;
 import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.AuditElements.UserRequestSubCategory;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.audit.AuditManager;
@@ -263,10 +262,7 @@ public class UserRequestController {
         if (StringUtils.isBlank(request.getOwner())
                 || !request.getOwner().equalsIgnoreCase(EntitlementUtil.getAuthenticatedUsername())) {
 
-            final SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.UNAUTHORIZED.getStatusCode());
-            scce.addException(new SyncopeClientException(SyncopeClientExceptionType.Unauthorized));
-            throw scce;
+            throw SyncopeClientException.build(ClientExceptionType.Unauthorized);
         }
 
         final UserTO res;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java Mon Oct 28 10:24:47 2013
@@ -25,7 +25,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import javax.validation.ValidationException;
 import org.apache.commons.jexl2.JexlContext;
 import org.apache.commons.jexl2.MapContext;
 import org.apache.commons.lang3.StringUtils;
@@ -37,7 +36,7 @@ import org.apache.syncope.common.types.A
 import org.apache.syncope.common.types.IntMappingType;
 import org.apache.syncope.common.types.MappingPurpose;
 import org.apache.syncope.common.types.ResourceOperation;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.persistence.beans.AbstractAttr;
@@ -84,6 +83,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.UserDAO;
 import org.apache.syncope.core.persistence.dao.VirAttrDAO;
 import org.apache.syncope.core.persistence.dao.VirSchemaDAO;
+import org.apache.syncope.core.persistence.validation.attrvalue.InvalidAttrValueException;
 import org.apache.syncope.core.propagation.PropagationByResource;
 import org.apache.syncope.core.util.AttributableUtil;
 import org.apache.syncope.core.util.JexlUtil;
@@ -230,11 +230,10 @@ public abstract class AbstractAttributab
             } else {
                 try {
                     attr.addValue(value, attributableUtil);
-                } catch (ValidationException e) {
+                } catch (InvalidAttrValueException e) {
                     LOG.error("Invalid value for attribute " + schema.getName() + ": " + value, e);
 
-                    invalidValues.addElement(schema.getName() + ": " + value
-                            + " - " + e.getMessage());
+                    invalidValues.getElements().add(schema.getName() + ": " + value + " - " + e.getMessage());
                 }
             }
         }
@@ -284,8 +283,8 @@ public abstract class AbstractAttributab
     private SyncopeClientException checkMandatory(final AttributableUtil attrUtil,
             final AbstractAttributable attributable) {
 
-        SyncopeClientException reqValMissing = new SyncopeClientException(
-                SyncopeClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException reqValMissing = SyncopeClientException.build(
+                ClientExceptionType.RequiredValuesMissing);
 
         LOG.debug("Check mandatory constraint among resources {}", attributable.getResources());
 
@@ -314,7 +313,7 @@ public abstract class AbstractAttributab
 
                 LOG.error("Mandatory schema " + schema.getName() + " not provided with values");
 
-                reqValMissing.addElement(schema.getName());
+                reqValMissing.getElements().add(schema.getName());
             }
         }
 
@@ -340,7 +339,7 @@ public abstract class AbstractAttributab
 
                 LOG.error("Mandatory derived schema " + derSchema.getName() + " does not evaluate to any value");
 
-                reqValMissing.addElement(derSchema.getName());
+                reqValMissing.getElements().add(derSchema.getName());
             }
         }
 
@@ -367,7 +366,7 @@ public abstract class AbstractAttributab
 
                 LOG.error("Mandatory virtual schema " + virSchema.getName() + " not provided with values");
 
-                reqValMissing.addElement(virSchema.getName());
+                reqValMissing.getElements().add(virSchema.getName());
             }
         }
 
@@ -524,7 +523,7 @@ public abstract class AbstractAttributab
 
         PropagationByResource propByRes = new PropagationByResource();
 
-        SyncopeClientException invalidValues = new SyncopeClientException(SyncopeClientExceptionType.InvalidValues);
+        SyncopeClientException invalidValues = SyncopeClientException.build(ClientExceptionType.InvalidValues);
 
         // 1. resources to be removed
         for (String resourceToBeRemoved : attributableMod.getResourcesToRemove()) {
@@ -783,7 +782,7 @@ public abstract class AbstractAttributab
             final AttributableUtil attributableUtil, final SyncopeClientCompositeException scce) {
 
         // 1. attributes
-        SyncopeClientException invalidValues = new SyncopeClientException(SyncopeClientExceptionType.InvalidValues);
+        SyncopeClientException invalidValues = SyncopeClientException.build(ClientExceptionType.InvalidValues);
 
         // Only consider attributeTO with values
         for (AttributeTO attributeTO : attributableTO.getAttrs()) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java Mon Oct 28 10:24:47 2013
@@ -21,13 +21,11 @@ package org.apache.syncope.core.rest.dat
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import javax.ws.rs.core.Response;
 import org.apache.syncope.common.to.ConnInstanceTO;
 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.types.ClientExceptionType;
 import org.apache.syncope.common.util.BeanUtils;
-import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.persistence.beans.ConnInstance;
 import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
@@ -80,30 +78,26 @@ public class ConnInstanceDataBinder {
     }
 
     public ConnInstance getConnInstance(final ConnInstanceTO connInstanceTO) {
-        SyncopeClientCompositeException scee =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-        SyncopeClientException requiredValuesMissing = new SyncopeClientException(
-                SyncopeClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
 
         if (connInstanceTO.getLocation() == null) {
-            requiredValuesMissing.addElement("location");
+            sce.getElements().add("location");
         }
 
         if (connInstanceTO.getBundleName() == null) {
-            requiredValuesMissing.addElement("bundlename");
+            sce.getElements().add("bundlename");
         }
 
         if (connInstanceTO.getVersion() == null) {
-            requiredValuesMissing.addElement("bundleversion");
+            sce.getElements().add("bundleversion");
         }
 
         if (connInstanceTO.getConnectorName() == null) {
-            requiredValuesMissing.addElement("connectorname");
+            sce.getElements().add("connectorname");
         }
 
         if (connInstanceTO.getConfiguration() == null || connInstanceTO.getConfiguration().isEmpty()) {
-            requiredValuesMissing.addElement("configuration");
+            sce.getElements().add("configuration");
         }
 
         ConnInstance connInstance = new ConnInstance();
@@ -114,28 +108,18 @@ public class ConnInstanceDataBinder {
         }
 
         // Throw composite exception if there is at least one element set
-        // in the composing exceptions
-
-        if (!requiredValuesMissing.isEmpty()) {
-            scee.addException(requiredValuesMissing);
-        }
-
-        if (scee.hasExceptions()) {
-            throw scee;
+        if (!sce.isEmpty()) {
+            throw sce;
         }
 
         return connInstance;
     }
 
     public ConnInstance updateConnInstance(final long connInstanceId, final ConnInstanceTO connInstanceTO) {
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-        SyncopeClientException requiredValuesMissing = new SyncopeClientException(
-                SyncopeClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
 
         if (connInstanceId == 0) {
-            requiredValuesMissing.addElement("connector id");
+            sce.getElements().add("connector id");
         }
 
         ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
@@ -170,14 +154,8 @@ public class ConnInstanceDataBinder {
 
         connInstance.setCapabilities(connInstanceTO.getCapabilities());
 
-        if (!requiredValuesMissing.isEmpty()) {
-            scce.addException(requiredValuesMissing);
-        }
-
-        // Throw composite exception if there is at least one element set
-        // in the composing exceptions
-        if (scce.hasExceptions()) {
-            throw scce;
+        if (!sce.isEmpty()) {
+            throw sce;
         }
 
         return connInstance;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java Mon Oct 28 10:24:47 2013
@@ -25,14 +25,13 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.syncope.common.to.MappingItemTO;
 import org.apache.syncope.common.to.MappingTO;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.IntMappingType;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.util.BeanUtils;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -184,17 +183,16 @@ public class ResourceDataBinder {
             return null;
         }
 
-        SyncopeClientCompositeException scce = 
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
 
-        SyncopeClientException requiredValuesMissing = new SyncopeClientException(
-                SyncopeClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException requiredValuesMissing = SyncopeClientException.build(
+                ClientExceptionType.RequiredValuesMissing);
 
         if (itemTO.getIntAttrName() == null) {
             if (IntMappingType.getEmbedded().contains(itemTO.getIntMappingType())) {
                 itemTO.setIntAttrName(itemTO.getIntMappingType().toString());
             } else {
-                requiredValuesMissing.addElement("intAttrName");
+                requiredValuesMissing.getElements().add("intAttrName");
             }
         }
 
@@ -208,10 +206,10 @@ public class ResourceDataBinder {
         if (!jexlUtil.isExpressionValid(itemTO.getMandatoryCondition() == null
                 ? "false" : itemTO.getMandatoryCondition())) {
 
-            SyncopeClientException invalidMandatoryCondition = new SyncopeClientException(
-                    SyncopeClientExceptionType.InvalidValues);
+            SyncopeClientException invalidMandatoryCondition = SyncopeClientException.build(
+                    ClientExceptionType.InvalidValues);
 
-            invalidMandatoryCondition.addElement(itemTO.getMandatoryCondition());
+            invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition());
 
             scce.addException(invalidMandatoryCondition);
         }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/RoleDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/RoleDataBinder.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/RoleDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/RoleDataBinder.java Mon Oct 28 10:24:47 2013
@@ -22,12 +22,11 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import javax.ws.rs.core.Response;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.ResourceOperation;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.connid.ConnObjectUtil;
@@ -159,15 +158,14 @@ public class RoleDataBinder extends Abst
         role.setInheritPasswordPolicy(roleTO.isInheritPasswordPolicy());
         role.setInheritAccountPolicy(roleTO.isInheritAccountPolicy());
 
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
 
         // name and parent
-        SyncopeClientException invalidRoles = new SyncopeClientException(SyncopeClientExceptionType.InvalidRoles);
+        SyncopeClientException invalidRoles = SyncopeClientException.build(ClientExceptionType.InvalidRoles);
         if (roleTO.getName() == null) {
             LOG.error("No name specified for this role");
 
-            invalidRoles.addElement("No name specified for this role");
+            invalidRoles.getElements().add("No name specified for this role");
         } else {
             role.setName(roleTO.getName());
         }
@@ -177,7 +175,7 @@ public class RoleDataBinder extends Abst
             if (parentRole == null) {
                 LOG.error("Could not find role with id " + roleTO.getParent());
 
-                invalidRoles.addElement(String.valueOf(roleTO.getParent()));
+                invalidRoles.getElements().add(String.valueOf(roleTO.getParent()));
                 scce.addException(invalidRoles);
             } else {
                 role.setParent(parentRole);
@@ -189,7 +187,7 @@ public class RoleDataBinder extends Abst
         if (otherRole != null) {
             LOG.error("Another role exists with the same name " + "and the same parent role: " + otherRole);
 
-            invalidRoles.addElement(roleTO.getName());
+            invalidRoles.getElements().add(roleTO.getName());
         }
 
         // attribute templates
@@ -245,13 +243,12 @@ public class RoleDataBinder extends Abst
     public PropagationByResource update(final SyncopeRole role, final RoleMod roleMod) {
         PropagationByResource propByRes = new PropagationByResource();
 
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
 
         Set<String> currentResources = role.getResourceNames();
 
         // name
-        SyncopeClientException invalidRoles = new SyncopeClientException(SyncopeClientExceptionType.InvalidRoles);
+        SyncopeClientException invalidRoles = SyncopeClientException.build(ClientExceptionType.InvalidRoles);
         if (roleMod.getName() != null) {
             SyncopeRole otherRole = roleDAO.find(roleMod.getName(),
                     role.getParent() == null ? null : role.getParent().getId());
@@ -267,7 +264,7 @@ public class RoleDataBinder extends Abst
             } else {
                 LOG.error("Another role exists with the same name and the same parent role: " + otherRole);
 
-                invalidRoles.addElement(roleMod.getName());
+                invalidRoles.getElements().add(roleMod.getName());
                 scce.addException(invalidRoles);
             }
         }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/SchemaDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/SchemaDataBinder.java?rev=1536304&r1=1536303&r2=1536304&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/SchemaDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/SchemaDataBinder.java Mon Oct 28 10:24:47 2013
@@ -19,12 +19,11 @@
 package org.apache.syncope.core.rest.data;
 
 import java.util.List;
-import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.to.DerSchemaTO;
 import org.apache.syncope.common.to.SchemaTO;
 import org.apache.syncope.common.to.VirSchemaTO;
-import org.apache.syncope.common.types.SyncopeClientExceptionType;
+import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.util.BeanUtils;
 import org.apache.syncope.common.validation.SyncopeClientCompositeException;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -50,15 +49,9 @@ public class SchemaDataBinder {
     // --------------- NORMAL -----------------
     private <T extends AbstractNormalSchema> void fill(final T schema, final SchemaTO schemaTO) {
         if (!jexlUtil.isExpressionValid(schemaTO.getMandatoryCondition())) {
-            SyncopeClientCompositeException scce =
-                    new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
-
-            SyncopeClientException invalidMandatoryCondition = new SyncopeClientException(
-                    SyncopeClientExceptionType.InvalidValues);
-            invalidMandatoryCondition.addElement(schemaTO.getMandatoryCondition());
-
-            scce.addException(invalidMandatoryCondition);
-            throw scce;
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidValues);
+            sce.getElements().add(schemaTO.getMandatoryCondition());
+            throw sce;
         }
 
         BeanUtils.copyProperties(schemaTO, schema);
@@ -71,22 +64,21 @@ public class SchemaDataBinder {
     public <T extends AbstractNormalSchema> void update(final SchemaTO schemaTO, final T schema,
             final AttributableUtil attributableUtil) {
 
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
 
         List<AbstractAttr> attrs = schemaDAO.findAttrs(schema, attributableUtil.attrClass());
         if (!attrs.isEmpty()) {
             if (schema.getType() != schemaTO.getType()) {
-                SyncopeClientException e = new SyncopeClientException(SyncopeClientExceptionType.valueOf("Invalid"
+                SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.valueOf("Invalid"
                         + schema.getClass().getSimpleName()));
-                e.addElement("Cannot change type since " + schema.getName() + " has attributes");
+                e.getElements().add("Cannot change type since " + schema.getName() + " has attributes");
 
                 scce.addException(e);
             }
             if (schema.isUniqueConstraint() != schemaTO.isUniqueConstraint()) {
-                SyncopeClientException e = new SyncopeClientException(SyncopeClientExceptionType.valueOf("Invalid"
+                SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.valueOf("Invalid"
                         + schema.getClass().getSimpleName()));
-                e.addElement("Cannot alter unique contraint since " + schema.getName() + " has attributes");
+                e.getElements().add("Cannot alter unique contraint since " + schema.getName() + " has attributes");
 
                 scce.addException(e);
             }
@@ -108,19 +100,18 @@ public class SchemaDataBinder {
 
     // --------------- DERIVED -----------------
     private <T extends AbstractDerSchema> T populate(final T derSchema, final DerSchemaTO derSchemaTO) {
-        SyncopeClientCompositeException scce =
-                new SyncopeClientCompositeException(Response.Status.BAD_REQUEST.getStatusCode());
+        SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
 
         if (StringUtils.isBlank(derSchemaTO.getExpression())) {
             SyncopeClientException requiredValuesMissing =
-                    new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
-            requiredValuesMissing.addElement("expression");
+                    SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
+            requiredValuesMissing.getElements().add("expression");
 
             scce.addException(requiredValuesMissing);
         } else if (!jexlUtil.isExpressionValid(derSchemaTO.getExpression())) {
-            SyncopeClientException invalidMandatoryCondition = new SyncopeClientException(
-                    SyncopeClientExceptionType.InvalidValues);
-            invalidMandatoryCondition.addElement(derSchemaTO.getExpression());
+            SyncopeClientException invalidMandatoryCondition = SyncopeClientException.build(
+                    ClientExceptionType.InvalidValues);
+            invalidMandatoryCondition.getElements().add(derSchemaTO.getExpression());
 
             scce.addException(invalidMandatoryCondition);
         }



Mime
View raw message