syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1300882 [18/22] - in /incubator/syncope/trunk: build-tools/src/main/java/org/syncope/buildtools/ client/src/main/java/org/syncope/annotation/ client/src/main/java/org/syncope/client/ client/src/main/java/org/syncope/client/http/ client/src...
Date Thu, 15 Mar 2012 10:17:24 GMT
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserRequestDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserRequestDataBinder.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserRequestDataBinder.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserRequestDataBinder.java Thu Mar 15 10:17:12 2012
@@ -42,9 +42,8 @@ public class UserRequestDataBinder {
     @Autowired
     private UserDAO userDAO;
 
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
-    public SyncopeUser getUserFromId(final Long userId)
-            throws NotFoundException, UnauthorizedRoleException {
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+    public SyncopeUser getUserFromId(final Long userId) throws NotFoundException, UnauthorizedRoleException {
 
         if (userId == null) {
             throw new NotFoundException("Null user id");
@@ -55,9 +54,7 @@ public class UserRequestDataBinder {
             throw new NotFoundException("User " + userId);
         }
 
-        SyncopeUser authUser = userDAO.find(
-                SecurityContextHolder.getContext().
-                getAuthentication().getName());
+        SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
 
         if (authUser == null || !authUser.equals(user)) {
             throw new UnauthorizedRoleException(-1L);
@@ -66,9 +63,8 @@ public class UserRequestDataBinder {
         return user;
     }
 
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
-    public UserTO getAuthUserTO()
-            throws NotFoundException {
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
+    public UserTO getAuthUserTO() throws NotFoundException {
 
         SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
         return userDataBinder.getUserTO(authUser);
@@ -81,7 +77,7 @@ public class UserRequestDataBinder {
         return result;
     }
 
-    @Transactional(rollbackFor = {Throwable.class})
+    @Transactional(rollbackFor = { Throwable.class })
     public void testCreate(final UserTO userTO) {
         SyncopeUser user = new SyncopeUser();
         userDataBinder.create(user, userTO);
@@ -90,9 +86,8 @@ public class UserRequestDataBinder {
         throw new RollbackException();
     }
 
-    @Transactional(rollbackFor = {Throwable.class})
-    public void testUpdate(final UserMod userMod)
-            throws NotFoundException, UnauthorizedRoleException {
+    @Transactional(rollbackFor = { Throwable.class })
+    public void testUpdate(final UserMod userMod) throws NotFoundException, UnauthorizedRoleException {
 
         SyncopeUser user = getUserFromId(userMod.getId());
         userDataBinder.update(user, userMod);
@@ -101,9 +96,8 @@ public class UserRequestDataBinder {
         throw new RollbackException();
     }
 
-    @Transactional(rollbackFor = {Throwable.class})
-    public void testDelete(final Long userId)
-            throws NotFoundException, UnauthorizedRoleException {
+    @Transactional(rollbackFor = { Throwable.class })
+    public void testDelete(final Long userId) throws NotFoundException, UnauthorizedRoleException {
 
         SyncopeUser user = getUserFromId(userId);
         userDAO.delete(user);

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/VirtualSchemaDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/VirtualSchemaDataBinder.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/VirtualSchemaDataBinder.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/VirtualSchemaDataBinder.java Thu Mar 15 10:17:12 2012
@@ -35,51 +35,37 @@ public class VirtualSchemaDataBinder {
     /**
      * Logger.
      */
-    private static final Logger LOG = LoggerFactory.getLogger(
-            VirtualSchemaDataBinder.class);
+    private static final Logger LOG = LoggerFactory.getLogger(VirtualSchemaDataBinder.class);
 
-    private static final String[] ignoreVirtualSchemaProperties = {
-        "schemas", "virtualAttributes"};
+    private static final String[] ignoreVirtualSchemaProperties = { "schemas", "virtualAttributes" };
 
-    private <T extends AbstractSchema> AbstractVirSchema populate(
-            AbstractVirSchema virtualSchema,
-            final VirtualSchemaTO virtualSchemaTO,
-            final Class<T> reference,
-            final SyncopeClientCompositeErrorException scce)
-            throws SyncopeClientCompositeErrorException {
+    private <T extends AbstractSchema> AbstractVirSchema populate(AbstractVirSchema virtualSchema,
+            final VirtualSchemaTO virtualSchemaTO, final Class<T> reference,
+            final SyncopeClientCompositeErrorException scce) throws SyncopeClientCompositeErrorException {
 
-        BeanUtils.copyProperties(virtualSchemaTO, virtualSchema,
-                ignoreVirtualSchemaProperties);
+        BeanUtils.copyProperties(virtualSchemaTO, virtualSchema, ignoreVirtualSchemaProperties);
 
         return virtualSchema;
     }
 
-    public <T extends AbstractSchema> AbstractVirSchema create(
-            final VirtualSchemaTO virtualSchemaTO,
-            AbstractVirSchema virtualSchema,
-            final Class<T> reference) {
+    public <T extends AbstractSchema> AbstractVirSchema create(final VirtualSchemaTO virtualSchemaTO,
+            AbstractVirSchema virtualSchema, final Class<T> reference) {
 
-        return populate(virtualSchema, virtualSchemaTO, reference,
-                new SyncopeClientCompositeErrorException(
+        return populate(virtualSchema, virtualSchemaTO, reference, new SyncopeClientCompositeErrorException(
                 HttpStatus.BAD_REQUEST));
     }
 
-    public <K extends AbstractSchema> AbstractVirSchema update(
-            final VirtualSchemaTO virtualSchemaTO,
-            AbstractVirSchema virtualSchema,
-            final Class<K> reference) {
+    public <K extends AbstractSchema> AbstractVirSchema update(final VirtualSchemaTO virtualSchemaTO,
+            AbstractVirSchema virtualSchema, final Class<K> reference) {
 
-        return populate(virtualSchema, virtualSchemaTO, reference,
-                new SyncopeClientCompositeErrorException(
+        return populate(virtualSchema, virtualSchemaTO, reference, new SyncopeClientCompositeErrorException(
                 HttpStatus.BAD_REQUEST));
     }
 
-    public <T extends AbstractVirSchema> VirtualSchemaTO getVirtualSchemaTO(
-            final T virtualSchema) {
+    public <T extends AbstractVirSchema> VirtualSchemaTO getVirtualSchemaTO(final T virtualSchema) {
 
         VirtualSchemaTO virtualSchemaTO = new VirtualSchemaTO();
-        BeanUtils.copyProperties(virtualSchema, virtualSchemaTO,
-                ignoreVirtualSchemaProperties);
+        BeanUtils.copyProperties(virtualSchema, virtualSchemaTO, ignoreVirtualSchemaProperties);
 
         return virtualSchemaTO;
     }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/AbstractTaskJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/AbstractTaskJob.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/AbstractTaskJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/AbstractTaskJob.java Thu Mar 15 10:17:12 2012
@@ -54,8 +54,7 @@ public abstract class AbstractTaskJob im
     /**
      * Logger.
      */
-    protected static final Logger LOG = LoggerFactory.getLogger(
-            AbstractTaskJob.class);
+    protected static final Logger LOG = LoggerFactory.getLogger(AbstractTaskJob.class);
 
     /**
      * Task DAO.
@@ -89,8 +88,7 @@ public abstract class AbstractTaskJob im
     }
 
     @Override
-    public final void execute(final JobExecutionContext context)
-            throws JobExecutionException {
+    public final void execute(final JobExecutionContext context) throws JobExecutionException {
 
         task = taskDAO.find(taskId);
         if (task == null) {
@@ -102,9 +100,7 @@ public abstract class AbstractTaskJob im
         execution.setTask(task);
 
         try {
-            execution.setMessage(doExecute(
-                    context.getMergedJobDataMap().
-                    getBoolean(DRY_RUN_JOBDETAIL_KEY)));
+            execution.setMessage(doExecute(context.getMergedJobDataMap().getBoolean(DRY_RUN_JOBDETAIL_KEY)));
 
             execution.setStatus(Status.SUCCESS.name());
         } catch (JobExecutionException e) {
@@ -130,8 +126,7 @@ public abstract class AbstractTaskJob im
      * @return the task execution status to be set
      * @throws JobExecutionException if anything goes wrong
      */
-    protected abstract String doExecute(boolean dryRun)
-            throws JobExecutionException;
+    protected abstract String doExecute(boolean dryRun) throws JobExecutionException;
 
     /**
      * Template method to determine whether this job's task execution has

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/DefaultSyncJobActions.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/DefaultSyncJobActions.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/DefaultSyncJobActions.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/DefaultSyncJobActions.java Thu Mar 15 10:17:12 2012
@@ -33,13 +33,11 @@ import org.syncope.core.persistence.bean
 public class DefaultSyncJobActions implements SyncJobActions {
 
     @Override
-    public void beforeAll(final SyncTask task)
-            throws JobExecutionException {
+    public void beforeAll(final SyncTask task) throws JobExecutionException {
     }
 
     @Override
-    public SyncDelta beforeCreate(final SyncDelta delta, final UserTO user)
-            throws JobExecutionException {
+    public SyncDelta beforeCreate(final SyncDelta delta, final UserTO user) throws JobExecutionException {
         return delta;
     }
 
@@ -50,22 +48,17 @@ public class DefaultSyncJobActions imple
     }
 
     @Override
-    public SyncDelta beforeDelete(final SyncDelta delta, final UserTO user)
-            throws JobExecutionException {
+    public SyncDelta beforeDelete(final SyncDelta delta, final UserTO user) throws JobExecutionException {
         return delta;
     }
 
     @Override
-    public SyncDelta after(final SyncDelta delta, final UserTO user,
-            final SyncResult result)
+    public SyncDelta after(final SyncDelta delta, final UserTO user, final SyncResult result)
             throws JobExecutionException {
         return delta;
     }
 
     @Override
-    public void afterAll(
-            final SyncTask task,
-            final List<SyncResult> results)
-            throws JobExecutionException {
+    public void afterAll(final SyncTask task, final List<SyncResult> results) throws JobExecutionException {
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/NotificationJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/NotificationJob.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/NotificationJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/NotificationJob.java Thu Mar 15 10:17:12 2012
@@ -55,8 +55,7 @@ public class NotificationJob implements 
     /**
      * Logger.
      */
-    private static final Logger LOG = LoggerFactory.getLogger(
-            NotificationJob.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NotificationJob.class);
 
     /**
      * Task DAO.
@@ -88,16 +87,15 @@ public class NotificationJob implements 
         smtpHost = confDAO.find("smtp.host", "").getValue();
         smtpPort = 25;
         try {
-            smtpPort = Integer.valueOf(
-                    confDAO.find("smtp.port", "25").getValue());
+            smtpPort = Integer.valueOf(confDAO.find("smtp.port", "25").getValue());
         } catch (NumberFormatException e) {
             LOG.error("Invalid SMTP port, reverting to 25", e);
         }
         smtpUsername = confDAO.find("smtp.username", "").getValue();
         smtpPassword = confDAO.find("smtp.password", "").getValue();
 
-        LOG.debug("SMTP details fetched: {}:{} / {}:[PASSWORD_NOT_SHOWN]",
-                new Object[]{smtpHost, smtpPort, smtpUsername});
+        LOG.debug("SMTP details fetched: {}:{} / {}:[PASSWORD_NOT_SHOWN]", new Object[] { smtpHost, smtpPort,
+                smtpUsername });
     }
 
     public TaskExec executeSingle(final NotificationTask task) {
@@ -107,38 +105,25 @@ public class NotificationJob implements 
         execution.setTask(task);
         execution.setStartDate(new Date());
 
-        if (StringUtils.isBlank(smtpHost)
-                || StringUtils.isBlank(task.getSender())
-                || StringUtils.isBlank(task.getSubject())
-                || task.getRecipients().isEmpty()
-                || StringUtils.isBlank(task.getHtmlBody())
-                || StringUtils.isBlank(task.getTextBody())) {
-
-            String message = "Could not fetch all required information for "
-                    + "sending e-mails:\n"
-                    + smtpHost + ":" + smtpPort + "\n"
-                    + task.getRecipients() + "\n"
-                    + task.getSender() + "\n"
-                    + task.getSubject() + "\n"
-                    + task.getHtmlBody() + "\n"
-                    + task.getTextBody();
+        if (StringUtils.isBlank(smtpHost) || StringUtils.isBlank(task.getSender())
+                || StringUtils.isBlank(task.getSubject()) || task.getRecipients().isEmpty()
+                || StringUtils.isBlank(task.getHtmlBody()) || StringUtils.isBlank(task.getTextBody())) {
+
+            String message = "Could not fetch all required information for " + "sending e-mails:\n" + smtpHost + ":"
+                    + smtpPort + "\n" + task.getRecipients() + "\n" + task.getSender() + "\n" + task.getSubject()
+                    + "\n" + task.getHtmlBody() + "\n" + task.getTextBody();
             LOG.error(message);
 
             execution.setStatus(Status.NOT_SENT.name());
 
-            if (task.getTraceLevel().ordinal()
-                    >= TraceLevel.FAILURES.ordinal()) {
+            if (task.getTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) {
 
                 execution.setMessage(message);
             }
         } else {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("About to send e-mails:\n"
-                        + smtpHost + ":" + smtpPort + "\n"
-                        + task.getRecipients() + "\n"
-                        + task.getSender() + "\n"
-                        + task.getSubject() + "\n"
-                        + task.getHtmlBody() + "\n"
+                LOG.debug("About to send e-mails:\n" + smtpHost + ":" + smtpPort + "\n" + task.getRecipients() + "\n"
+                        + task.getSender() + "\n" + task.getSubject() + "\n" + task.getHtmlBody() + "\n"
                         + task.getTextBody() + "\n");
             }
 
@@ -155,8 +140,7 @@ public class NotificationJob implements 
                     }
 
                     MimeMessage message = sender.createMimeMessage();
-                    MimeMessageHelper helper =
-                            new MimeMessageHelper(message, true);
+                    MimeMessageHelper helper = new MimeMessageHelper(message, true);
 
                     helper.setTo(to);
                     helper.setFrom(task.getSender());
@@ -170,20 +154,14 @@ public class NotificationJob implements 
                     StringBuilder report = new StringBuilder();
                     switch (task.getTraceLevel()) {
                         case ALL:
-                            report.append("FROM: ").
-                                    append(task.getSender()).append('\n').
-                                    append("TO: ").append(to).append('\n').
-                                    append("SUBJECT: ").
-                                    append(task.getSubject()).append('\n').
-                                    append('\n').
-                                    append(task.getTextBody()).append('\n').
-                                    append('\n').
-                                    append(task.getHtmlBody()).append('\n');
+                            report.append("FROM: ").append(task.getSender()).append('\n').append("TO: ").append(to)
+                                    .append('\n').append("SUBJECT: ").append(task.getSubject()).append('\n').append(
+                                            '\n').append(task.getTextBody()).append('\n').append('\n').append(
+                                            task.getHtmlBody()).append('\n');
                             break;
 
                         case SUMMARY:
-                            report.append("E-mail sent to ").
-                                    append(to).append('\n');
+                            report.append("E-mail sent to ").append(to).append('\n');
                             break;
 
                         case FAILURES:
@@ -201,8 +179,7 @@ public class NotificationJob implements 
                     exceptionWriter.write(t.getMessage() + "\n\n");
                     t.printStackTrace(new PrintWriter(exceptionWriter));
 
-                    if (task.getTraceLevel().ordinal()
-                            >= TraceLevel.FAILURES.ordinal()) {
+                    if (task.getTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) {
 
                         execution.setMessage(exceptionWriter.toString());
                     }
@@ -220,13 +197,11 @@ public class NotificationJob implements 
     }
 
     @Override
-    public void execute(final JobExecutionContext context)
-            throws JobExecutionException {
+    public void execute(final JobExecutionContext context) throws JobExecutionException {
 
         LOG.debug("Waking up...");
 
-        for (NotificationTask task : taskDAO.findWithoutExecs(
-                NotificationTask.class)) {
+        for (NotificationTask task : taskDAO.findWithoutExecs(NotificationTask.class)) {
 
             executeSingle(task);
         }
@@ -239,9 +214,8 @@ public class NotificationJob implements 
 
         // True if either failed and failures have to be registered, or if ALL
         // has to be registered.
-        return (Status.valueOf(execution.getStatus()) == Status.NOT_SENT
-                && task.getTraceLevel().ordinal()
-                >= TraceLevel.FAILURES.ordinal())
+        return (Status.valueOf(execution.getStatus()) == Status.NOT_SENT && task.getTraceLevel().ordinal() >= TraceLevel.FAILURES
+                .ordinal())
                 || task.getTraceLevel() == TraceLevel.ALL;
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java Thu Mar 15 10:17:12 2012
@@ -94,8 +94,7 @@ public class ReportJob implements Statef
     }
 
     @Override
-    public void execute(final JobExecutionContext context)
-            throws JobExecutionException {
+    public void execute(final JobExecutionContext context) throws JobExecutionException {
 
         Report report = reportDAO.find(reportId);
         if (report == null) {
@@ -128,14 +127,14 @@ public class ReportJob implements Statef
             // streaming SAX handler in a compressed byte array stream
             handler.setResult(new StreamResult(zos));
         } catch (Exception e) {
-            throw new JobExecutionException(
-                    "While configuring for SAX generation", e, true);
+            throw new JobExecutionException("While configuring for SAX generation", e, true);
         }
 
         execution.setStatus(ReportExecStatus.RUNNING);
         execution = reportExecDAO.save(execution);
 
-        ConfigurableListableBeanFactory beanFactory = ApplicationContextManager.getApplicationContext().getBeanFactory();
+        ConfigurableListableBeanFactory beanFactory = ApplicationContextManager.getApplicationContext()
+                .getBeanFactory();
 
         // 3. actual report execution
         StringBuilder reportExecutionMessage = new StringBuilder();
@@ -149,7 +148,8 @@ public class ReportJob implements Statef
 
             // iterate over reportlet instances defined for this report
             for (ReportletConf reportletConf : report.getReportletConfs()) {
-                Class<Reportlet> reportletClass = dataBinder.findReportletClassHavingConfClass(reportletConf.getClass());
+                Class<Reportlet> reportletClass = dataBinder
+                        .findReportletClassHavingConfClass(reportletConf.getClass());
                 if (reportletClass != null) {
                     Reportlet autowired = (Reportlet) beanFactory.createBean(reportletClass,
                             AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
@@ -162,12 +162,11 @@ public class ReportJob implements Statef
                         execution.setStatus(ReportExecStatus.FAILURE);
 
                         Throwable t = e instanceof ReportException
-                                ? e.getCause() : e;
+                                ? e.getCause()
+                                : e;
                         exceptionWriter.write(t.getMessage() + "\n\n");
                         t.printStackTrace(new PrintWriter(exceptionWriter));
-                        reportExecutionMessage.append(
-                                exceptionWriter.toString()).
-                                append("\n==================\n");
+                        reportExecutionMessage.append(exceptionWriter.toString()).append("\n==================\n");
                     }
                 }
             }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SampleJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SampleJob.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SampleJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SampleJob.java Thu Mar 15 10:17:12 2012
@@ -30,19 +30,20 @@ import org.syncope.core.persistence.bean
 public class SampleJob extends AbstractTaskJob {
 
     @Override
-    protected String doExecute(final boolean dryRun)
-            throws JobExecutionException {
+    protected String doExecute(final boolean dryRun) throws JobExecutionException {
 
         if (!(task instanceof SchedTask)) {
-            throw new JobExecutionException("Task " + taskId
-                    + " isn't a SchedTask");
+            throw new JobExecutionException("Task " + taskId + " isn't a SchedTask");
         }
         final SchedTask schedTask = (SchedTask) this.task;
 
-        LOG.info("SampleJob {}running [SchedTask {}]",
-                (dryRun ? "dry " : ""), schedTask.getId());
+        LOG.info("SampleJob {}running [SchedTask {}]", (dryRun
+                ? "dry "
+                : ""), schedTask.getId());
 
-        return (dryRun ? "DRY " : "") + "RUNNING";
+        return (dryRun
+                ? "DRY "
+                : "") + "RUNNING";
     }
 
     @Override

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SpringBeanJobFactory.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SpringBeanJobFactory.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SpringBeanJobFactory.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SpringBeanJobFactory.java Thu Mar 15 10:17:12 2012
@@ -31,16 +31,14 @@ import org.syncope.core.persistence.bean
 import org.syncope.core.persistence.dao.ReportDAO;
 import org.syncope.core.persistence.dao.TaskDAO;
 
-public class SpringBeanJobFactory
-        extends org.springframework.scheduling.quartz.SpringBeanJobFactory {
+public class SpringBeanJobFactory extends org.springframework.scheduling.quartz.SpringBeanJobFactory {
 
     private String[] ignoredUnknownProperties;
 
     private SchedulerContext schedulerContext;
 
     @Override
-    public void setIgnoredUnknownProperties(
-            final String[] ignoredUnknownProperties) {
+    public void setIgnoredUnknownProperties(final String[] ignoredUnknownProperties) {
 
         super.setIgnoredUnknownProperties(ignoredUnknownProperties);
         this.ignoredUnknownProperties = ignoredUnknownProperties;
@@ -59,43 +57,34 @@ public class SpringBeanJobFactory
      * {@inheritDoc}
      */
     @Override
-    protected Object createJobInstance(final TriggerFiredBundle bundle)
-            throws Exception {
+    protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
 
-        final ApplicationContext ctx =
-                ((ConfigurableApplicationContext) schedulerContext.get(
-                "applicationContext"));
+        final ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext"));
 
         // Try to re-create job bean from underlying task (useful for managing
         // failover scenarios)
         if (!ctx.containsBean(bundle.getJobDetail().getName())) {
-            Long taskId = JobInstanceLoader.getTaskIdFromJobName(
-                    bundle.getJobDetail().getName());
+            Long taskId = JobInstanceLoader.getTaskIdFromJobName(bundle.getJobDetail().getName());
             if (taskId != null) {
                 TaskDAO taskDAO = ctx.getBean(TaskDAO.class);
                 SchedTask task = taskDAO.find(taskId);
 
-                JobInstanceLoader jobInstanceLoader =
-                        ctx.getBean(JobInstanceLoader.class);
-                jobInstanceLoader.registerJob(task,
-                        task.getJobClassName(), task.getCronExpression());
+                JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class);
+                jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
             }
 
-            Long reportId = JobInstanceLoader.getReportIdFromJobName(
-                    bundle.getJobDetail().getName());
+            Long reportId = JobInstanceLoader.getReportIdFromJobName(bundle.getJobDetail().getName());
             if (reportId != null) {
                 ReportDAO reportDAO = ctx.getBean(ReportDAO.class);
                 Report report = reportDAO.find(reportId);
 
-                JobInstanceLoader jobInstanceLoader =
-                        ctx.getBean(JobInstanceLoader.class);
+                JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class);
                 jobInstanceLoader.registerJob(report);
             }
         }
 
         final Object job = ctx.getBean(bundle.getJobDetail().getName());
-        final BeanWrapper wrapper =
-                PropertyAccessorFactory.forBeanPropertyAccess(job);
+        final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(job);
         if (isEligibleForPropertyPopulation(wrapper.getWrappedInstance())) {
             final MutablePropertyValues pvs = new MutablePropertyValues();
             if (this.schedulerContext != null) {
@@ -107,8 +96,7 @@ public class SpringBeanJobFactory
                 wrapper.setPropertyValues(pvs, true);
             } else {
                 for (String propName : this.ignoredUnknownProperties) {
-                    if (pvs.contains(propName)
-                            && !wrapper.isWritableProperty(propName)) {
+                    if (pvs.contains(propName) && !wrapper.isWritableProperty(propName)) {
 
                         pvs.removePropertyValue(propName);
                     }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJob.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJob.java Thu Mar 15 10:17:12 2012
@@ -154,14 +154,17 @@ public class SyncJob extends AbstractTas
     private List<Long> findExistingUsers(final SyncDelta delta) {
         final SyncTask syncTask = (SyncTask) this.task;
 
-        final String uid =
-                delta.getPreviousUid() == null ? delta.getUid().getUidValue() : delta.getPreviousUid().getUidValue();
+        final String uid = delta.getPreviousUid() == null
+                ? delta.getUid().getUidValue()
+                : delta.getPreviousUid().getUidValue();
 
         // ---------------------------------
         // Get sync policy specification
         // ---------------------------------
         final SyncPolicy policy = syncTask.getResource().getSyncPolicy();
-        final SyncPolicySpec policySpec = policy != null ? (SyncPolicySpec) policy.getSpecification() : null;
+        final SyncPolicySpec policySpec = policy != null
+                ? (SyncPolicySpec) policy.getSpecification()
+                : null;
         // ---------------------------------
 
         final List<Long> result = new ArrayList<Long>();
@@ -175,9 +178,8 @@ public class SyncJob extends AbstractTas
             final Map<String, Attribute> extValues = new HashMap<String, Attribute>();
 
             for (SchemaMapping mapping : syncTask.getResource().getMappings()) {
-                extValues.put(
-                        SchemaMappingUtil.getIntAttrName(mapping),
-                        object.getAttributeByName(SchemaMappingUtil.getExtAttrName(mapping)));
+                extValues.put(SchemaMappingUtil.getIntAttrName(mapping), object.getAttributeByName(SchemaMappingUtil
+                        .getExtAttrName(mapping)));
             }
 
             // search user by attributes specified into the policy
@@ -194,7 +196,8 @@ public class SyncJob extends AbstractTas
                 } else {
                     type = AttributeCond.Type.EQ;
                     expression = value.getValue().size() > 1
-                            ? value.getValue().toString() : value.getValue().get(0).toString();
+                            ? value.getValue().toString()
+                            : value.getValue().get(0).toString();
                 }
 
                 NodeCond nodeCond;
@@ -218,11 +221,13 @@ public class SyncJob extends AbstractTas
                     nodeCond = NodeCond.getLeafCond(cond);
                 }
 
-                searchCondition = searchCondition != null ? NodeCond.getAndCond(searchCondition, nodeCond) : nodeCond;
+                searchCondition = searchCondition != null
+                        ? NodeCond.getAndCond(searchCondition, nodeCond)
+                        : nodeCond;
             }
 
-            List<SyncopeUser> users =
-                    userSearchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCondition);
+            List<SyncopeUser> users = userSearchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()),
+                    searchCondition);
             for (SyncopeUser user : users) {
                 result.add(user.getId());
             }
@@ -230,8 +235,8 @@ public class SyncJob extends AbstractTas
             final SyncopeUser found;
             List<SyncopeUser> users;
 
-            final SchemaMapping accountIdMap =
-                    SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());
+            final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource()
+                    .getMappings());
 
             switch (accountIdMap.getIntMappingType()) {
                 case Username:
@@ -276,8 +281,7 @@ public class SyncJob extends AbstractTas
         return result;
     }
 
-    private SyncResult createUser(SyncDelta delta, final boolean dryRun)
-            throws JobExecutionException {
+    private SyncResult createUser(SyncDelta delta, final boolean dryRun) throws JobExecutionException {
 
         final SyncResult result = new SyncResult();
         result.setOperation(Operation.CREATE);
@@ -298,24 +302,21 @@ public class SyncJob extends AbstractTas
                 // Check for status synchronization ...
                 // --------------------------
                 if (((SyncTask) this.task).isSyncStatus()) {
-                    Attribute status =
-                            AttributeUtil.find(OperationalAttributes.ENABLE_NAME, delta.getObject().getAttributes());
+                    Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, delta.getObject()
+                            .getAttributes());
 
                     if (status != null) {
-                        enabled = status != null
-                                && status.getValue() != null
-                                && !status.getValue().isEmpty() ? (Boolean) status.getValue().get(0) : null;
+                        enabled = status != null && status.getValue() != null && !status.getValue().isEmpty()
+                                ? (Boolean) status.getValue().get(0)
+                                : null;
                     }
                 }
                 // --------------------------
 
                 WorkflowResult<Map.Entry<Long, Boolean>> created = wfAdapter.create(userTO, true, enabled);
 
-                List<PropagationTask> tasks = propagationManager.getCreateTaskIds(
-                        created,
-                        userTO.getPassword(),
-                        userTO.getVirtualAttributes(),
-                        Collections.singleton(((SyncTask) this.task).getResource().getName()));
+                List<PropagationTask> tasks = propagationManager.getCreateTaskIds(created, userTO.getPassword(), userTO
+                        .getVirtualAttributes(), Collections.singleton(((SyncTask) this.task).getResource().getName()));
 
                 propagationManager.execute(tasks);
 
@@ -338,9 +339,8 @@ public class SyncJob extends AbstractTas
         return result;
     }
 
-    private void updateUsers(
-            SyncDelta delta, final List<Long> users, final boolean dryRun, final List<SyncResult> results)
-            throws JobExecutionException {
+    private void updateUsers(SyncDelta delta, final List<Long> users, final boolean dryRun,
+            final List<SyncResult> results) throws JobExecutionException {
 
         if (!((SyncTask) task).isPerformUpdate()) {
             LOG.debug("SyncTask not configured for update");
@@ -367,12 +367,10 @@ public class SyncJob extends AbstractTas
                     if (!dryRun) {
                         WorkflowResult<Map.Entry<Long, Boolean>> updated = wfAdapter.update(userMod);
 
-                        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(
-                                updated,
-                                userMod.getPassword(),
-                                userMod.getVirtualAttributesToBeRemoved(),
-                                userMod.getVirtualAttributesToBeUpdated(),
-                                Collections.singleton(((SyncTask) this.task).getResource().getName()));
+                        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(updated, userMod
+                                .getPassword(), userMod.getVirtualAttributesToBeRemoved(), userMod
+                                .getVirtualAttributesToBeUpdated(), Collections.singleton(((SyncTask) this.task)
+                                .getResource().getName()));
 
                         propagationManager.execute(tasks);
                         userTO = userDataBinder.getUserTO(updated.getResult().getKey());
@@ -395,9 +393,8 @@ public class SyncJob extends AbstractTas
         }
     }
 
-    private void deleteUsers(
-            SyncDelta delta, final List<Long> users, final boolean dryRun, final List<SyncResult> results)
-            throws JobExecutionException {
+    private void deleteUsers(SyncDelta delta, final List<Long> users, final boolean dryRun,
+            final List<SyncResult> results) throws JobExecutionException {
 
         if (!((SyncTask) task).isPerformDelete()) {
             LOG.debug("SyncTask not configured for delete");
@@ -419,8 +416,8 @@ public class SyncJob extends AbstractTas
 
                 if (!dryRun) {
                     try {
-                        List<PropagationTask> tasks = propagationManager.getDeleteTaskIds(
-                                userId, ((SyncTask) this.task).getResource().getName());
+                        List<PropagationTask> tasks = propagationManager.getDeleteTaskIds(userId,
+                                ((SyncTask) this.task).getResource().getName());
                         propagationManager.execute(tasks);
                     } catch (Exception e) {
                         LOG.error("Could not propagate user " + userId, e);
@@ -453,8 +450,8 @@ public class SyncJob extends AbstractTas
      * @param dryRun dry run?
      * @return report as string
      */
-    private String createReport(final List<SyncResult> syncResults,
-            final TraceLevel syncTraceLevel, final boolean dryRun) {
+    private String createReport(final List<SyncResult> syncResults, final TraceLevel syncTraceLevel,
+            final boolean dryRun) {
 
         if (syncTraceLevel == TraceLevel.NONE) {
             return null;
@@ -517,14 +514,10 @@ public class SyncJob extends AbstractTas
 
         // Summary, also to be included for FAILURE and ALL, so create it
         // anyway.
-        report.append("Users [created/failures]: ").
-                append(created.size()).append('/').append(createdFailed.size()).
-                append(' ').
-                append("[updated/failures]: ").
-                append(updated.size()).append('/').append(updatedFailed.size()).
-                append(' ').
-                append("[deleted/ failures]: ").
-                append(deleted.size()).append('/').append(deletedFailed.size());
+        report.append("Users [created/failures]: ").append(created.size()).append('/').append(createdFailed.size())
+                .append(' ').append("[updated/failures]: ").append(updated.size()).append('/').append(
+                        updatedFailed.size()).append(' ').append("[deleted/ failures]: ").append(deleted.size())
+                .append('/').append(deletedFailed.size());
 
         // Failures
         if (syncTraceLevel == TraceLevel.FAILURES || syncTraceLevel == TraceLevel.ALL) {
@@ -545,10 +538,12 @@ public class SyncJob extends AbstractTas
 
         // Succeeded, only if on 'ALL' level
         if (syncTraceLevel == TraceLevel.ALL) {
-            report.append("\n\nCreated:\n").
-                    append(SyncResult.reportSetOfSynchronizationResult(created, syncTraceLevel)).
-                    append("\nUpdated:\n").append(SyncResult.reportSetOfSynchronizationResult(updated, syncTraceLevel)).
-                    append("\nDeleted:\n").append(SyncResult.reportSetOfSynchronizationResult(deleted, syncTraceLevel));
+            report.append("\n\nCreated:\n")
+                    .append(SyncResult.reportSetOfSynchronizationResult(created, syncTraceLevel))
+                    .append("\nUpdated:\n")
+                    .append(SyncResult.reportSetOfSynchronizationResult(updated, syncTraceLevel))
+                    .append("\nDeleted:\n")
+                    .append(SyncResult.reportSetOfSynchronizationResult(deleted, syncTraceLevel));
         }
 
         return report.toString();
@@ -558,8 +553,7 @@ public class SyncJob extends AbstractTas
      * Used to simulate authentication in order to perform updates through AbstractUserWorkflowAdapter.
      */
     private void setupSecurity() {
-        final List<GrantedAuthority> authorities =
-                new ArrayList<GrantedAuthority>();
+        final List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
 
         for (Entitlement entitlement : entitlementDAO.findAll()) {
             authorities.add(new SimpleGrantedAuthority(entitlement.getName()));
@@ -572,8 +566,7 @@ public class SyncJob extends AbstractTas
     }
 
     @Override
-    protected String doExecute(final boolean dryRun)
-            throws JobExecutionException {
+    protected String doExecute(final boolean dryRun) throws JobExecutionException {
 
         // get all entitlements to perform updates
         if (EntitlementUtil.getOwnedEntitlementNames().isEmpty()) {
@@ -590,8 +583,7 @@ public class SyncJob extends AbstractTas
         try {
             connector = connInstanceLoader.getConnector(syncTask.getResource());
         } catch (Exception e) {
-            final String msg = String.format(
-                    "Connector instance bean for resource %s and connInstance %s not found",
+            final String msg = String.format("Connector instance bean for resource %s and connInstance %s not found",
                     syncTask.getResource(), syncTask.getResource().getConnector());
 
             throw new JobExecutionException(msg, e);
@@ -603,9 +595,9 @@ public class SyncJob extends AbstractTas
             throw new JobExecutionException("Invalid account id mapping for resource " + syncTask.getResource());
         }
 
-        LOG.debug("Execute synchronization with token {}",
-                syncTask.getResource().getSyncToken() != null
-                ? syncTask.getResource().getSyncToken().getValue() : null);
+        LOG.debug("Execute synchronization with token {}", syncTask.getResource().getSyncToken() != null
+                ? syncTask.getResource().getSyncToken().getValue()
+                : null);
 
         final List<SyncResult> results = new ArrayList<SyncResult>();
 
@@ -614,49 +606,41 @@ public class SyncJob extends AbstractTas
         try {
             final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();
 
-            final ConflictResolutionAction conflictResolutionAction =
-                    syncPolicy != null && syncPolicy.getSpecification() != null
+            final ConflictResolutionAction conflictResolutionAction = syncPolicy != null
+                    && syncPolicy.getSpecification() != null
                     ? ((SyncPolicySpec) syncPolicy.getSpecification()).getConflictResolutionAction()
                     : ConflictResolutionAction.IGNORE;
 
             if (syncTask.isFullReconciliation()) {
-                connector.getAllObjects(
-                        ObjectClass.ACCOUNT,
-                        new SyncResultsHandler() {
-
-                            @Override
-                            public boolean handle(final SyncDelta delta) {
-                                try {
-
-                                    return results.addAll(
-                                            handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
-
-                                } catch (JobExecutionException e) {
-                                    LOG.error("Reconciliation failed", e);
-                                    return false;
-                                }
-                            }
-                        },
-                        connector.getOperationOptions(syncTask.getResource()));
+                connector.getAllObjects(ObjectClass.ACCOUNT, new SyncResultsHandler() {
+
+                    @Override
+                    public boolean handle(final SyncDelta delta) {
+                        try {
+
+                            return results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
+
+                        } catch (JobExecutionException e) {
+                            LOG.error("Reconciliation failed", e);
+                            return false;
+                        }
+                    }
+                }, connector.getOperationOptions(syncTask.getResource()));
             } else {
-                connector.sync(
-                        syncTask.getResource().getSyncToken(),
-                        new SyncResultsHandler() {
-
-                            @Override
-                            public boolean handle(final SyncDelta delta) {
-                                try {
-
-                                    return results.addAll(
-                                            handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
-
-                                } catch (JobExecutionException e) {
-                                    LOG.error("Synchronization failed", e);
-                                    return false;
-                                }
-                            }
-                        },
-                        connector.getOperationOptions(syncTask.getResource()));
+                connector.sync(syncTask.getResource().getSyncToken(), new SyncResultsHandler() {
+
+                    @Override
+                    public boolean handle(final SyncDelta delta) {
+                        try {
+
+                            return results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));
+
+                        } catch (JobExecutionException e) {
+                            LOG.error("Synchronization failed", e);
+                            return false;
+                        }
+                    }
+                }, connector.getOperationOptions(syncTask.getResource()));
             }
 
             if (!dryRun && !syncTask.isFullReconciliation()) {
@@ -692,12 +676,8 @@ public class SyncJob extends AbstractTas
      * @return list of synchronization results.
      * @throws JobExecutionException in case of synchronization failure.
      */
-    protected final List<SyncResult> handleDelta(
-            final SyncTask syncTask,
-            final SyncDelta delta,
-            final ConflictResolutionAction conflictResolutionAction,
-            final boolean dryRun)
-            throws JobExecutionException {
+    protected final List<SyncResult> handleDelta(final SyncTask syncTask, final SyncDelta delta,
+            final ConflictResolutionAction conflictResolutionAction, final boolean dryRun) throws JobExecutionException {
 
         final List<SyncResult> results = new ArrayList<SyncResult>();
 
@@ -782,8 +762,8 @@ public class SyncJob extends AbstractTas
 
         // True if either failed and failures have to be registered, or if ALL
         // has to be registered.
-        return (Status.valueOf(execution.getStatus()) == Status.FAILURE
-                && syncTask.getResource().getSyncTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal())
+        return (Status.valueOf(execution.getStatus()) == Status.FAILURE && syncTask.getResource().getSyncTraceLevel()
+                .ordinal() >= TraceLevel.FAILURES.ordinal())
                 || syncTask.getResource().getSyncTraceLevel() == TraceLevel.ALL;
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJobActions.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJobActions.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJobActions.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncJobActions.java Thu Mar 15 10:17:12 2012
@@ -36,8 +36,7 @@ public interface SyncJobActions {
      * @param task synchronization task to be executed.
      * @throws JobExecutionException in case of generic failure.
      */
-    void beforeAll(final SyncTask task)
-            throws JobExecutionException;
+    void beforeAll(final SyncTask task) throws JobExecutionException;
 
     /**
      * Action to be executed before to create a synchronized user locally.
@@ -47,8 +46,7 @@ public interface SyncJobActions {
      * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
      * @throws JobExecutionException in case of generic failure.
      */
-    SyncDelta beforeCreate(final SyncDelta delta, final UserTO user)
-            throws JobExecutionException;
+    SyncDelta beforeCreate(final SyncDelta delta, final UserTO user) throws JobExecutionException;
 
     /**
      * Action to be executed before to update a synchronized user locally.
@@ -70,8 +68,7 @@ public interface SyncJobActions {
      * @return synchronization information used for logging and to be passed to the 'after' method.
      * @throws JobExecutionException in case of generic failure.
      */
-    SyncDelta beforeDelete(final SyncDelta delta, final UserTO user)
-            throws JobExecutionException;
+    SyncDelta beforeDelete(final SyncDelta delta, final UserTO user) throws JobExecutionException;
 
     /**
      * Action to be executed after each local user synchronization.
@@ -82,8 +79,7 @@ public interface SyncJobActions {
      * @return synchronization information.
      * @throws JobExecutionException in case of generic failure.
      */
-    SyncDelta after(final SyncDelta delta, final UserTO user, final SyncResult result)
-            throws JobExecutionException;
+    SyncDelta after(final SyncDelta delta, final UserTO user, final SyncResult result) throws JobExecutionException;
 
     /**
      * Action to be executed after the synchronization task completion.
@@ -92,6 +88,5 @@ public interface SyncJobActions {
      * @param results synchronization result.
      * @throws JobExecutionException in case of generic failure.
      */
-    void afterAll(final SyncTask task, final List<SyncResult> results)
-            throws JobExecutionException;
+    void afterAll(final SyncTask task, final List<SyncResult> results) throws JobExecutionException;
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncResult.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncResult.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncResult.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/SyncResult.java Thu Mar 15 10:17:12 2012
@@ -88,8 +88,7 @@ public class SyncResult {
 
     @Override
     public String toString() {
-        return new ReflectionToStringBuilder(this,
-                ToStringStyle.SHORT_PREFIX_STYLE).toString();
+        return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
     }
 
     /**
@@ -101,19 +100,16 @@ public class SyncResult {
         if (level == TraceLevel.SUMMARY) {
             // No per entry log in this case.
             return null;
-        } else if (level == TraceLevel.FAILURES
-                && status == Status.FAILURE) {
+        } else if (level == TraceLevel.FAILURES && status == Status.FAILURE) {
 
             // only report failures
-            return String.format("Failed %s (id/name): %d/%s with message: %s",
-                    operation, userId, username, message);
+            return String.format("Failed %s (id/name): %d/%s with message: %s", operation, userId, username, message);
         } else {
             // All
-            return String.format("%s %s (id/ name): %d/ %s %s", operation,
-                    status,
-                    userId, username,
-                    StringUtils.isEmpty(message) ? "" : "with message: "
-                    + message);
+            return String.format("%s %s (id/ name): %d/ %s %s", operation, status, userId, username, StringUtils
+                    .isEmpty(message)
+                    ? ""
+                    : "with message: " + message);
         }
     }
 
@@ -124,9 +120,7 @@ public class SyncResult {
      * @param level trace level
      * @return report as string
      */
-    public static String reportSetOfSynchronizationResult(
-            final Collection<SyncResult> results,
-            final TraceLevel level) {
+    public static String reportSetOfSynchronizationResult(final Collection<SyncResult> results, final TraceLevel level) {
 
         StringBuilder sb = new StringBuilder();
         for (SyncResult sr : results) {

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/package-info.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/package-info.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/package-info.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/package-info.java Thu Mar 15 10:17:12 2012
@@ -17,3 +17,4 @@
  * under the License.
  */
 package org.syncope.core.scheduling;
+

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/AsymmetricCipher.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/AsymmetricCipher.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/AsymmetricCipher.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/AsymmetricCipher.java Thu Mar 15 10:17:12 2012
@@ -36,16 +36,14 @@ public class AsymmetricCipher {
     final private static String xform = "RSA/NONE/PKCS1Padding";
     final private static String algorithm = "RSA";
 
-    public static byte[] encrypt(byte[] inpBytes, PublicKey key)
-            throws Exception {
+    public static byte[] encrypt(byte[] inpBytes, PublicKey key) throws Exception {
 
         Cipher cipher = Cipher.getInstance(xform);
         cipher.init(Cipher.ENCRYPT_MODE, key);
         return cipher.doFinal(inpBytes);
     }
 
-    public static byte[] decrypt(byte[] inpBytes, PrivateKey key)
-            throws Exception {
+    public static byte[] decrypt(byte[] inpBytes, PrivateKey key) throws Exception {
 
         Cipher cipher = Cipher.getInstance(xform);
         cipher.init(Cipher.DECRYPT_MODE, key);
@@ -68,8 +66,7 @@ public class AsymmetricCipher {
         return baos.toByteArray();
     }
 
-    public static KeyPair deserializeKeyPair(byte[] serializedKeyPair)
-            throws IOException, ClassNotFoundException {
+    public static KeyPair deserializeKeyPair(byte[] serializedKeyPair) throws IOException, ClassNotFoundException {
 
         ByteArrayInputStream bais = new ByteArrayInputStream(serializedKeyPair);
         ObjectInputStream ois = new ObjectInputStream(bais);

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/NullSecurityContextRepository.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/NullSecurityContextRepository.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/NullSecurityContextRepository.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/NullSecurityContextRepository.java Thu Mar 15 10:17:12 2012
@@ -29,19 +29,16 @@ import org.springframework.security.web.
  * To be used until switching to Spring Security 3.1 which provides a similar
  * class by default.
  */
-public class NullSecurityContextRepository
-        implements SecurityContextRepository {
+public class NullSecurityContextRepository implements SecurityContextRepository {
 
     @Override
-    public final SecurityContext loadContext(
-            final HttpRequestResponseHolder requestResponseHolder) {
+    public final SecurityContext loadContext(final HttpRequestResponseHolder requestResponseHolder) {
 
         return SecurityContextHolder.createEmptyContext();
     }
 
     @Override
-    public void saveContext(final SecurityContext context,
-            final HttpServletRequest request,
+    public void saveContext(final SecurityContext context, final HttpServletRequest request,
             final HttpServletResponse response) {
     }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeAuthenticationProvider.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeAuthenticationProvider.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeAuthenticationProvider.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeAuthenticationProvider.java Thu Mar 15 10:17:12 2012
@@ -78,16 +78,14 @@ public class SyncopeAuthenticationProvid
         return userDetailsService;
     }
 
-    public void setSyncopeUserDetailsService(
-            SyncopeUserDetailsService syncopeUserDetailsService) {
+    public void setSyncopeUserDetailsService(SyncopeUserDetailsService syncopeUserDetailsService) {
 
         this.userDetailsService = syncopeUserDetailsService;
     }
 
     @Override
-    @Transactional(noRollbackFor = {BadCredentialsException.class})
-    public Authentication authenticate(final Authentication authentication)
-            throws AuthenticationException {
+    @Transactional(noRollbackFor = { BadCredentialsException.class })
+    public Authentication authenticate(final Authentication authentication) throws AuthenticationException {
 
         boolean authenticated;
         SyncopeUser passwordUser = new SyncopeUser();
@@ -118,17 +116,17 @@ public class SyncopeAuthenticationProvid
         Authentication result;
 
         if ((user == null || !user.getSuspended()) && authenticated) {
-            UsernamePasswordAuthenticationToken token =
-                    new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), null,
-                    userDetailsService.loadUserByUsername(authentication.getPrincipal().toString()).getAuthorities());
+            UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(authentication
+                    .getPrincipal(), null, userDetailsService.loadUserByUsername(
+                    authentication.getPrincipal().toString()).getAuthorities());
             token.setDetails(authentication.getDetails());
 
             result = token;
 
             auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.success,
                     "Successfully authenticated, with roles: " + token.getAuthorities());
-            LOG.debug("User {} successfully authenticated, with roles {}",
-                    authentication.getPrincipal(), token.getAuthorities());
+            LOG.debug("User {} successfully authenticated, with roles {}", authentication.getPrincipal(), token
+                    .getAuthorities());
 
             if (user != null) {
                 user.setLastLoginDate(new Date());
@@ -142,8 +140,8 @@ public class SyncopeAuthenticationProvid
                 userDAO.save(user);
             }
 
-            auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.failure,
-                    "User " + authentication.getPrincipal() + " not authenticated");
+            auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.failure, "User "
+                    + authentication.getPrincipal() + " not authenticated");
             LOG.debug("User {} not authenticated", authentication.getPrincipal());
 
             throw new BadCredentialsException("User " + authentication.getPrincipal() + " not authenticated");

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeUserDetailsService.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeUserDetailsService.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeUserDetailsService.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/security/SyncopeUserDetailsService.java Thu Mar 15 10:17:12 2012
@@ -58,22 +58,18 @@ public class SyncopeUserDetailsService i
     }
 
     @Override
-    public UserDetails loadUserByUsername(final String username)
-            throws UsernameNotFoundException, DataAccessException {
+    public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException, DataAccessException {
 
-        Set<SimpleGrantedAuthority> authorities =
-                new HashSet<SimpleGrantedAuthority>();
+        Set<SimpleGrantedAuthority> authorities = new HashSet<SimpleGrantedAuthority>();
         if (adminUser.equals(username)) {
             for (Entitlement entitlement : entitlementDAO.findAll()) {
-                authorities.add(
-                        new SimpleGrantedAuthority(entitlement.getName()));
+                authorities.add(new SimpleGrantedAuthority(entitlement.getName()));
             }
         } else {
             final SyncopeUser user = userDAO.find(username);
 
             if (user == null) {
-                throw new UsernameNotFoundException(
-                        "Could not find any user with id " + username);
+                throw new UsernameNotFoundException("Could not find any user with id " + username);
             }
 
             // Give entitlements based on roles owned by user,
@@ -84,13 +80,11 @@ public class SyncopeUserDetailsService i
             }
             for (SyncopeRole role : roles) {
                 for (Entitlement entitlement : role.getEntitlements()) {
-                    authorities.add(
-                            new SimpleGrantedAuthority(entitlement.getName()));
+                    authorities.add(new SimpleGrantedAuthority(entitlement.getName()));
                 }
             }
         }
 
-        return new User(username, "<PASSWORD_PLACEHOLDER>",
-                true, true, true, true, authorities);
+        return new User(username, "<PASSWORD_PLACEHOLDER>", true, true, true, true, authorities);
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ApplicationContextProvider.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ApplicationContextProvider.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ApplicationContextProvider.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ApplicationContextProvider.java Thu Mar 15 10:17:12 2012
@@ -32,8 +32,7 @@ public class ApplicationContextProvider 
      * @throws BeansException if thrown by application context methods
      */
     @Override
-    public void setApplicationContext(final ApplicationContext ctx)
-            throws BeansException {
+    public void setApplicationContext(final ApplicationContext ctx) throws BeansException {
 
         ApplicationContextManager.setApplicationContext((ConfigurableApplicationContext) ctx);
     }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnBundleManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnBundleManager.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnBundleManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnBundleManager.java Thu Mar 15 10:17:12 2012
@@ -41,25 +41,21 @@ import org.syncope.core.persistence.dao.
 @Component
 public class ConnBundleManager {
 
-    private static final Logger LOG = LoggerFactory.getLogger(
-            ConnBundleManager.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ConnBundleManager.class);
 
     @Autowired
     private ConfDAO confDAO;
 
-    public ConnectorInfoManager getConnectorManager()
-            throws NotFoundException, MissingConfKeyException {
+    public ConnectorInfoManager getConnectorManager() throws NotFoundException, MissingConfKeyException {
 
         // 1. Bundles directory
-        SyncopeConf connectorBundleDir =
-                confDAO.find("connid.bundles.directory");
+        SyncopeConf connectorBundleDir = confDAO.find("connid.bundles.directory");
 
         // 2. Find bundles inside that directory
         File bundleDirectory = new File(connectorBundleDir.getValue());
         String[] bundleFiles = bundleDirectory.list();
         if (bundleFiles == null) {
-            throw new NotFoundException("Bundles from dir "
-                    + connectorBundleDir.getValue());
+            throw new NotFoundException("Bundles from dir " + connectorBundleDir.getValue());
         }
 
         List<URL> bundleFileURLs = new ArrayList<URL>();
@@ -69,20 +65,18 @@ public class ConnBundleManager {
             } catch (Exception ignore) {
                 // ignore exception and don't add bundle
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug(bundleDirectory.toString() + "/" + file + "\""
-                            + " is not a valid connector bundle.", ignore);
+                    LOG.debug(bundleDirectory.toString() + "/" + file + "\"" + " is not a valid connector bundle.",
+                            ignore);
                 }
             }
         }
         if (bundleFileURLs.isEmpty()) {
-            throw new NotFoundException("Bundles from dir "
-                    + connectorBundleDir.getValue());
+            throw new NotFoundException("Bundles from dir " + connectorBundleDir.getValue());
         }
         LOG.debug("Bundle file URLs: {}", bundleFileURLs);
 
         // 3. Get connector info manager
-        ConnectorInfoManager manager =
-                ConnectorInfoManagerFactory.getInstance().getLocalManager(
+        ConnectorInfoManager manager = ConnectorInfoManagerFactory.getInstance().getLocalManager(
                 bundleFileURLs.toArray(new URL[0]));
         if (manager == null) {
             throw new NotFoundException("Connector Info Manager");
@@ -91,23 +85,18 @@ public class ConnBundleManager {
         return manager;
     }
 
-    public ConfigurationProperties getConfigurationProperties(
-            final String bundleName,
-            final String version,
-            final String connectorName)
-            throws NotFoundException {
+    public ConfigurationProperties getConfigurationProperties(final String bundleName, final String version,
+            final String connectorName) throws NotFoundException {
 
         //Create key for search all properties
-        final ConnectorKey key =
-                new ConnectorKey(bundleName, version, connectorName);
+        final ConnectorKey key = new ConnectorKey(bundleName, version, connectorName);
 
         if (key == null) {
             throw new NotFoundException("Connector Key");
         }
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("\nBundle name: " + key.getBundleName()
-                    + "\nBundle version: " + key.getBundleVersion()
+            LOG.debug("\nBundle name: " + key.getBundleName() + "\nBundle version: " + key.getBundleVersion()
                     + "\nBundle class: " + key.getConnectorName());
         }
 
@@ -125,9 +114,7 @@ public class ConnBundleManager {
         return getConfigurationProperties(info);
     }
 
-    public ConfigurationProperties getConfigurationProperties(
-            final ConnectorInfo info)
-            throws NotFoundException {
+    public ConfigurationProperties getConfigurationProperties(final ConnectorInfo info) throws NotFoundException {
 
         if (info == null) {
             throw new NotFoundException("Invalid connector info " + info);
@@ -141,8 +128,7 @@ public class ConnBundleManager {
         }
 
         // retrieve the ConfigurationProperties.
-        final ConfigurationProperties properties =
-                apiConfig.getConfigurationProperties();
+        final ConfigurationProperties properties = apiConfig.getConfigurationProperties();
 
         if (properties == null) {
             throw new NotFoundException("Configuration properties");
@@ -151,9 +137,7 @@ public class ConnBundleManager {
         // Print out what the properties are (not necessary)
         if (LOG.isDebugEnabled()) {
             for (String propName : properties.getPropertyNames()) {
-                LOG.debug("\nProperty Name: "
-                        + properties.getProperty(propName).getName()
-                        + "\nProperty Type: "
+                LOG.debug("\nProperty Name: " + properties.getProperty(propName).getName() + "\nProperty Type: "
                         + properties.getProperty(propName).getType());
             }
         }

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnObjectUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnObjectUtil.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnObjectUtil.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ConnObjectUtil.java Thu Mar 15 10:17:12 2012
@@ -105,7 +105,8 @@ public class ConnObjectUtil {
 
                 case Username:
                     userTO.setUsername(attribute == null || attribute.getValue().isEmpty()
-                            ? null : attribute.getValue().get(0).toString());
+                            ? null
+                            : attribute.getValue().get(0).toString());
                     break;
 
                 case UserSchema:
@@ -113,7 +114,8 @@ public class ConnObjectUtil {
                     attributeTO.setSchema(mapping.getIntAttrName());
 
                     for (Object value : attribute == null || attribute.getValue() == null
-                            ? Collections.EMPTY_LIST : attribute.getValue()) {
+                            ? Collections.EMPTY_LIST
+                            : attribute.getValue()) {
                         attributeTO.addValue(value.toString());
                     }
 
@@ -131,7 +133,8 @@ public class ConnObjectUtil {
                     attributeTO.setSchema(mapping.getIntAttrName());
 
                     for (Object value : attribute == null || attribute.getValue() == null
-                            ? Collections.EMPTY_LIST : attribute.getValue()) {
+                            ? Collections.EMPTY_LIST
+                            : attribute.getValue()) {
                         attributeTO.addValue(value.toString());
                     }
 
@@ -203,7 +206,8 @@ public class ConnObjectUtil {
             Attribute attribute = obj.getAttributeByName(SchemaMappingUtil.getExtAttrName(mapping));
 
             List<Object> values = attribute == null
-                    ? Collections.EMPTY_LIST : attribute.getValue();
+                    ? Collections.EMPTY_LIST
+                    : attribute.getValue();
 
             AttributeMod attributeMod;
             switch (mapping.getIntMappingType()) {
@@ -211,19 +215,15 @@ public class ConnObjectUtil {
                     break;
 
                 case Password:
-                    attribute = obj.getAttributeByName(
-                            OperationalAttributes.PASSWORD_NAME);
+                    attribute = obj.getAttributeByName(OperationalAttributes.PASSWORD_NAME);
 
-                    if (attribute != null && attribute.getValue() != null
-                            && !attribute.getValue().isEmpty()) {
+                    if (attribute != null && attribute.getValue() != null && !attribute.getValue().isEmpty()) {
 
-                        String password =
-                                getPassword(attribute.getValue().get(0));
+                        String password = getPassword(attribute.getValue().get(0));
                         // update password if and only if password has really 
                         // changed
                         try {
-                            if (!userDataBinder.verifyPassword(userId,
-                                    password)) {
+                            if (!userDataBinder.verifyPassword(userId, password)) {
 
                                 userMod.setPassword(password);
                             }
@@ -339,16 +339,15 @@ public class ConnObjectUtil {
         final ConfigurableApplicationContext context = ApplicationContextManager.getApplicationContext();
         final ConnInstanceLoader connInstanceLoader = context.getBean(ConnInstanceLoader.class);
 
-        final Map<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject> remoteObjects =
-                new HashMap<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject>();
+        final Map<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject> remoteObjects = new HashMap<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject>();
 
         for (ExternalResource resource : owner.getResources()) {
             LOG.debug("Retrieve remote object from '{}'", resource.getName());
             try {
                 final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);
 
-                final SchemaMappingUtil.SchemaMappingsWrapper mappings =
-                        new SchemaMappingUtil.SchemaMappingsWrapper(resource.getMappings());
+                final SchemaMappingUtil.SchemaMappingsWrapper mappings = new SchemaMappingUtil.SchemaMappingsWrapper(
+                        resource.getMappings());
 
                 final String accountId = SchemaMappingUtil.getAccountIdValue(owner, mappings.getAccountIdMapping());
 
@@ -369,8 +368,8 @@ public class ConnObjectUtil {
                         final OperationOptionsBuilder oob = new OperationOptionsBuilder();
                         oob.setAttributesToGet(extAttrNames);
 
-                        final ConnectorObject connectorObject =
-                                connector.getObject(ObjectClass.ACCOUNT, new Uid(accountId), oob.build());
+                        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(
+                                accountId), oob.build());
 
                         if (connectorObject != null) {
                             remoteObjects.put(mappings, connectorObject);
@@ -388,8 +387,8 @@ public class ConnObjectUtil {
             LOG.debug("Provide value for virtual attribute '{}'", virAttr.getVirtualSchema().getName());
 
             for (SchemaMappingUtil.SchemaMappingsWrapper mappings : remoteObjects.keySet()) {
-                Collection<SchemaMapping> virAttrMappings =
-                        mappings.getuVirMappings().get(virAttr.getVirtualSchema().getName());
+                Collection<SchemaMapping> virAttrMappings = mappings.getuVirMappings().get(
+                        virAttr.getVirtualSchema().getName());
 
                 if (virAttrMappings != null) {
                     for (SchemaMapping virAttrMapping : virAttrMappings) {
@@ -413,8 +412,7 @@ public class ConnObjectUtil {
 
     private void fillFromTemplate(final AbstractAttributableTO attributableTO, final AbstractAttributableTO template) {
 
-        Map<String, AttributeTO> currentAttrMap =
-                attributableTO.getAttributeMap();
+        Map<String, AttributeTO> currentAttrMap = attributableTO.getAttributeMap();
         for (AttributeTO attrTO : template.getAttributes()) {
             if (!currentAttrMap.containsKey(attrTO.getSchema())) {
                 attributableTO.addAttribute(evaluateAttrTemplate(attributableTO, attrTO));
@@ -436,9 +434,7 @@ public class ConnObjectUtil {
         }
     }
 
-    private AttributeTO evaluateAttrTemplate(
-            final AbstractAttributableTO attributableTO,
-            final AttributeTO template) {
+    private AttributeTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO, final AttributeTO template) {
 
         AttributeTO result = new AttributeTO();
         result.setSchema(template.getSchema());

Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ImportExport.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ImportExport.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ImportExport.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/ImportExport.java Thu Mar 15 10:17:12 2012
@@ -67,8 +67,7 @@ public class ImportExport extends Defaul
     /**
      * Logger.
      */
-    private static final Logger LOG = LoggerFactory.getLogger(
-            ImportExport.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ImportExport.class);
 
     private final static String ROOT_ELEMENT = "dataset";
 
@@ -106,8 +105,7 @@ public class ImportExport extends Defaul
         return schema;
     }
 
-    private void setParameters(final String tableName, final Attributes atts,
-            final Query query) {
+    private void setParameters(final String tableName, final Attributes atts, final Query query) {
 
         Map<String, Integer> colTypes = new HashMap<String, Integer>();
 
@@ -118,9 +116,8 @@ public class ImportExport extends Defaul
             stmt = conn.createStatement();
             rs = stmt.executeQuery("SELECT * FROM " + tableName);
             for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
-                colTypes.put(
-                        rs.getMetaData().getColumnName(i + 1).toUpperCase(),
-                        rs.getMetaData().getColumnType(i + 1));
+                colTypes
+                        .put(rs.getMetaData().getColumnName(i + 1).toUpperCase(), rs.getMetaData().getColumnType(i + 1));
             }
         } catch (SQLException e) {
             LOG.error("While", e);
@@ -145,8 +142,7 @@ public class ImportExport extends Defaul
         for (int i = 0; i < atts.getLength(); i++) {
             Integer colType = colTypes.get(atts.getQName(i).toUpperCase());
             if (colType == null) {
-                LOG.warn("No column type found for {}",
-                        atts.getQName(i).toUpperCase());
+                LOG.warn("No column type found for {}", atts.getQName(i).toUpperCase());
                 colType = Types.VARCHAR;
             }
 
@@ -157,8 +153,7 @@ public class ImportExport extends Defaul
                 case Types.TINYINT:
                 case Types.SMALLINT:
                     try {
-                        query.setParameter(i + 1,
-                                Integer.valueOf(atts.getValue(i)));
+                        query.setParameter(i + 1, Integer.valueOf(atts.getValue(i)));
                     } catch (NumberFormatException e) {
                         LOG.error("Unparsable Integer '{}'", atts.getValue(i));
                         query.setParameter(i + 1, atts.getValue(i));
@@ -168,8 +163,7 @@ public class ImportExport extends Defaul
                 case Types.DECIMAL:
                 case Types.BIGINT:
                     try {
-                        query.setParameter(i + 1,
-                                Long.valueOf(atts.getValue(i)));
+                        query.setParameter(i + 1, Long.valueOf(atts.getValue(i)));
                     } catch (NumberFormatException e) {
                         LOG.error("Unparsable Long '{}'", atts.getValue(i));
                         query.setParameter(i + 1, atts.getValue(i));
@@ -178,8 +172,7 @@ public class ImportExport extends Defaul
 
                 case Types.DOUBLE:
                     try {
-                        query.setParameter(i + 1,
-                                Double.valueOf(atts.getValue(i)));
+                        query.setParameter(i + 1, Double.valueOf(atts.getValue(i)));
                     } catch (NumberFormatException e) {
                         LOG.error("Unparsable Double '{}'", atts.getValue(i));
                         query.setParameter(i + 1, atts.getValue(i));
@@ -188,8 +181,7 @@ public class ImportExport extends Defaul
 
                 case Types.FLOAT:
                     try {
-                        query.setParameter(i + 1,
-                                Float.valueOf(atts.getValue(i)));
+                        query.setParameter(i + 1, Float.valueOf(atts.getValue(i)));
                     } catch (NumberFormatException e) {
                         LOG.error("Unparsable Float '{}'", atts.getValue(i));
                         query.setParameter(i + 1, atts.getValue(i));
@@ -201,8 +193,7 @@ public class ImportExport extends Defaul
                 case Types.TIMESTAMP:
                     try {
                         query.setParameter(i + 1,
-                                DateUtils.parseDate(atts.getValue(i),
-                                SyncopeConstants.DATE_PATTERNS),
+                                DateUtils.parseDate(atts.getValue(i), SyncopeConstants.DATE_PATTERNS),
                                 TemporalType.TIMESTAMP);
                     } catch (ParseException e) {
                         LOG.error("Unparsable Date '{}'", atts.getValue(i));
@@ -213,7 +204,8 @@ public class ImportExport extends Defaul
                 case Types.BIT:
                 case Types.BOOLEAN:
                     query.setParameter(i + 1, "1".equals(atts.getValue(i))
-                            ? Boolean.TRUE : Boolean.FALSE);
+                            ? Boolean.TRUE
+                            : Boolean.FALSE);
                     break;
 
                 default:
@@ -223,8 +215,7 @@ public class ImportExport extends Defaul
     }
 
     @Override
-    public void startElement(final String uri, final String localName,
-            final String qName, final Attributes atts)
+    public void startElement(final String uri, final String localName, final String qName, final Attributes atts)
             throws SAXException {
 
         // skip root element
@@ -232,8 +223,7 @@ public class ImportExport extends Defaul
             return;
         }
 
-        StringBuilder queryString =
-                new StringBuilder("INSERT INTO ").append(qName).append('(');
+        StringBuilder queryString = new StringBuilder("INSERT INTO ").append(qName).append('(');
 
         StringBuilder values = new StringBuilder();
 
@@ -252,8 +242,7 @@ public class ImportExport extends Defaul
         query.executeUpdate();
     }
 
-    private void doExportTable(final TransformerHandler handler,
-            final Connection conn, final String tableName)
+    private void doExportTable(final TransformerHandler handler, final Connection conn, final String tableName)
             throws SQLException, SAXException {
 
         AttributesImpl atts = new AttributesImpl();
@@ -296,16 +285,13 @@ public class ImportExport extends Defaul
         }
     }
 
-    private List<String> sortByForeignKeys(final Connection conn,
-            final Set<String> tableNames)
+    private List<String> sortByForeignKeys(final Connection conn, final Set<String> tableNames)
             throws SQLException, CycleInMultiParentTreeException {
 
-        MultiParentNode<String> root =
-                new MultiParentNode<String>(ROOT_ELEMENT);
+        MultiParentNode<String> root = new MultiParentNode<String>(ROOT_ELEMENT);
 
         for (String tableName : tableNames) {
-            MultiParentNode<String> node =
-                    MultiParentNodeOp.findInTree(root, tableName);
+            MultiParentNode<String> node = MultiParentNodeOp.findInTree(root, tableName);
             if (node == null) {
                 node = new MultiParentNode<String>(tableName);
                 root.addChild(node);
@@ -313,13 +299,11 @@ public class ImportExport extends Defaul
 
             ResultSet rs = null;
             try {
-                rs = conn.getMetaData().getExportedKeys(
-                        conn.getCatalog(), readSchema(), tableName);
+                rs = conn.getMetaData().getExportedKeys(conn.getCatalog(), readSchema(), tableName);
                 while (rs.next()) {
                     String fkTableName = rs.getString("FKTABLE_NAME");
                     if (!tableName.equals(fkTableName)) {
-                        MultiParentNode<String> fkNode =
-                                MultiParentNodeOp.findInTree(root, fkTableName);
+                        MultiParentNode<String> fkNode = MultiParentNodeOp.findInTree(root, fkTableName);
                         if (fkNode == null) {
                             fkNode = new MultiParentNode<String>(fkTableName);
                             root.addChild(fkNode);
@@ -347,12 +331,10 @@ public class ImportExport extends Defaul
     }
 
     public void export(final OutputStream os)
-            throws SAXException, TransformerConfigurationException,
-            CycleInMultiParentTreeException {
+            throws SAXException, TransformerConfigurationException, CycleInMultiParentTreeException {
 
         StreamResult streamResult = new StreamResult(os);
-        SAXTransformerFactory transformerFactory =
-                (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+        SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
 
         TransformerHandler handler = transformerFactory.newTransformerHandler();
         Transformer serializer = handler.getTransformer();
@@ -366,21 +348,18 @@ public class ImportExport extends Defaul
         ResultSet rs = null;
         try {
             // first read all tables...
-            rs = conn.getMetaData().getTables(
-                    null, null, null, new String[]{"TABLE"});
+            rs = conn.getMetaData().getTables(null, null, null, new String[] { "TABLE" });
             Set<String> tableNames = new HashSet<String>();
             while (rs.next()) {
                 String tableName = rs.getString("TABLE_NAME");
                 // these tables must be ignored
-                if (!tableName.toUpperCase().startsWith("QRTZ_")
-                        && !tableName.toUpperCase().equals("ACT_GE_PROPERTY")) {
+                if (!tableName.toUpperCase().startsWith("QRTZ_") && !tableName.toUpperCase().equals("ACT_GE_PROPERTY")) {
 
                     tableNames.add(tableName);
                 }
             }
             // then sort tables based on foreign keys and dump
-            for (String tableName :
-                    sortByForeignKeys(conn, tableNames)) {
+            for (String tableName : sortByForeignKeys(conn, tableNames)) {
 
                 doExportTable(handler, conn, tableName);
             }



Mime
View raw message