syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1459902 - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/services/proxy/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/org/apache/syncope/common/util/ console/src/main/java/org/apache/sync...
Date Fri, 22 Mar 2013 17:05:42 GMT
Author: ilgrosso
Date: Fri Mar 22 17:05:41 2013
New Revision: 1459902

URL: http://svn.apache.org/r1459902
Log:
[SYNCOPE-343] Introduced a dedicated handler for (possibly empty) string collections

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java
      - copied, changed from r1459775, syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncRule.java
Removed:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncRule.java
Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ConfigurationServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/PolicyServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/PolicyService.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/AuthRestClient.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ImplementationClassNamesLoader.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ConfigurationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ConfigurationServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ConfigurationServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ConfigurationServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -22,7 +22,6 @@ import java.io.UnsupportedEncodingExcept
 import java.net.URI;
 import java.net.URLEncoder;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import javax.ws.rs.InternalServerErrorException;
@@ -81,16 +80,14 @@ public class ConfigurationServiceProxy e
 
     @Override
     public Set<ValidatorTO> getValidators() {
-        Set<String> response = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "configuration/validators.json", String[].class)));
-        return CollectionWrapper.wrapValidator(response);
+        return CollectionWrapper.wrapValidators(
+                handlePossiblyEmptyStringCollection(baseUrl + "configuration/validators.json"));
     }
 
     @Override
     public Set<MailTemplateTO> getMailTemplates() {
-        Set<String> response = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "configuration/mailTemplates.json", String[].class)));
-        return CollectionWrapper.wrapMailTemplates(response);
+        return CollectionWrapper.wrapMailTemplates(
+                handlePossiblyEmptyStringCollection(baseUrl + "configuration/mailTemplates.json"));
     }
 
     @Override

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/PolicyServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/PolicyServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/PolicyServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/PolicyServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -20,7 +20,7 @@ package org.apache.syncope.client.servic
 
 import java.net.URI;
 import java.util.Arrays;
-import java.util.HashSet;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 import javax.ws.rs.NotFoundException;
@@ -137,16 +137,15 @@ public class PolicyServiceProxy extends 
     }
 
     @Override
-    public Set<CorrelationRuleClassTO> getCorrelationRuleClasses(final PolicyType type)
{
-        Set<CorrelationRuleClassTO> result = null;
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public Set<CorrelationRuleClassTO> getSyncCorrelationRuleClasses(final PolicyType
type) {
+        Set<CorrelationRuleClassTO> result = Collections.<CorrelationRuleClassTO>emptySet();
 
         switch (type) {
             case SYNC:
             case GLOBAL_SYNC:
-                final Set<String> classes = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                        baseUrl + "policy/correlationRuleClasses.json", String[].class)));
-
-                result = CollectionWrapper.wrapCorrelationRuleClasses(classes);
+                result = CollectionWrapper.wrapSyncCorrelationRuleClasses(
+                        handlePossiblyEmptyStringCollection(baseUrl + "policy/syncCorrelationRuleClasses.json"));
                 break;
 
             default:

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -66,9 +66,8 @@ public class ReportServiceProxy extends 
 
     @Override
     public ReportletConfClasses getReportletConfClasses() {
-        List<String> confClasses = Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "report/reportletConfClasses.json", String[].class));
-        return new ReportletConfClasses(confClasses);
+        return new ReportletConfClasses(
+                handlePossiblyEmptyStringCollection(baseUrl + "report/reportletConfClasses.json"));
     }
 
     @Override

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ResourceServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -22,7 +22,6 @@ import java.io.UnsupportedEncodingExcept
 import java.net.URI;
 import java.net.URLEncoder;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -82,10 +81,8 @@ public class ResourceServiceProxy extend
 
     @Override
     public Set<PropagationActionClassTO> getPropagationActionsClasses() {
-        Set<String> classes = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "resource/propagationActionsClasses.json", String[].class)));
-
-        return CollectionWrapper.wrapPropagationActionClasses(classes);
+        return CollectionWrapper.wrapPropagationActionClasses(
+                handlePossiblyEmptyStringCollection(baseUrl + "resource/propagationActionsClasses.json"));
     }
 
     @Override

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SchemaServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -65,7 +65,6 @@ public class SchemaServiceProxy extends 
 
     @Override
     public void delete(final AttributableType kind, final SchemaType type, final String schemaName)
{
-
         getRestTemplate().getForObject(baseUrl + type.toSpringURL() + "/{kind}/delete/{name}.json",
getTOClass(type),
                 kind, schemaName);
     }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/SpringServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -19,6 +19,8 @@
 package org.apache.syncope.client.services.proxy;
 
 import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
 import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.core.Response;
 import org.apache.http.HttpEntity;
@@ -87,4 +89,19 @@ public abstract class SpringServiceProxy
             throw new InternalServerErrorException(e);
         }
     }
+
+    @SuppressWarnings("unchecked")
+    protected Collection<String> handlePossiblyEmptyStringCollection(final String url)
{
+        Collection<String> result = Collections.<String>emptySet();
+
+        final Object object = getRestTemplate().getForObject(url, Object.class);
+        if (object instanceof String) {
+            String string = (String) object;
+            result = Collections.singleton(string);
+        } else if (object instanceof Collection) {
+            result = (Collection<String>) object;
+        }
+
+        return result;
+    }
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java
Fri Mar 22 17:05:41 2013
@@ -21,7 +21,6 @@ package org.apache.syncope.client.servic
 import java.io.IOException;
 import java.net.URI;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import javax.ws.rs.core.Response;
@@ -106,18 +105,14 @@ public class TaskServiceProxy extends Sp
 
     @Override
     public Set<JobClassTO> getJobClasses() {
-        Set<String> classes = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "task/jobClasses.json", String[].class)));
-
-        return CollectionWrapper.wrapJobClasses(classes);
+        return CollectionWrapper.wrapJobClasses(
+                handlePossiblyEmptyStringCollection(baseUrl + "task/jobClasses.json"));
     }
 
     @Override
     public Set<SyncActionClassTO> getSyncActionsClasses() {
-        Set<String> classes = new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
-                baseUrl + "task/syncActionsClasses.json", String[].class)));
-
-        return CollectionWrapper.wrapSyncActionClasses(classes);
+        return CollectionWrapper.wrapSyncActionClasses(
+                handlePossiblyEmptyStringCollection(baseUrl + "task/syncActionsClasses.json"));
     }
 
     @Override

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/PolicyService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/PolicyService.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/PolicyService.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/PolicyService.java
Fri Mar 22 17:05:41 2013
@@ -101,6 +101,6 @@ public interface PolicyService {
      * @return Returns correlation rules java classes.
      */
     @GET
-    @Path("correlationRuleClasses")
-    Set<CorrelationRuleClassTO> getCorrelationRuleClasses(@PathParam("type") PolicyType
type);
+    @Path("syncCorrelationRuleClasses")
+    Set<CorrelationRuleClassTO> getSyncCorrelationRuleClasses(@PathParam("type") PolicyType
type);
 }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
Fri Mar 22 17:05:41 2013
@@ -19,11 +19,11 @@
 package org.apache.syncope.common.util;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import org.apache.syncope.common.to.CorrelationRuleClassTO;
-
 import org.apache.syncope.common.to.EntitlementTO;
 import org.apache.syncope.common.to.JobClassTO;
 import org.apache.syncope.common.to.LoggerTO;
@@ -38,25 +38,23 @@ import org.springframework.web.servlet.M
 public final class CollectionWrapper {
 
     private CollectionWrapper() {
+        // empty constructor for static utility class
     }
 
-    public static Set<EntitlementTO> wrap(final Set<String> collection) {
-        Set<EntitlementTO> respons = new HashSet<EntitlementTO>();
-        for (String e : collection) {
-            respons.add(EntitlementTO.instance(e));
-        }
-        return respons;
+    @SuppressWarnings("unchecked")
+    public static List<String> wrapStrings(final ModelAndView modelAndView) {
+        return (List<String>) modelAndView.getModel().values().iterator().next();
     }
 
-    public static List<EntitlementTO> wrap(final List<String> collection) {
-        List<EntitlementTO> respons = new ArrayList<EntitlementTO>();
+    public static Set<EntitlementTO> wrap(final Collection<String> collection)
{
+        Set<EntitlementTO> respons = new HashSet<EntitlementTO>();
         for (String e : collection) {
             respons.add(EntitlementTO.instance(e));
         }
         return respons;
     }
 
-    public static Set<String> unwrap(final Set<EntitlementTO> collection) {
+    public static Set<String> unwrap(final Collection<EntitlementTO> collection)
{
         Set<String> respons = new HashSet<String>();
         for (EntitlementTO e : collection) {
             respons.add(e.getName());
@@ -64,21 +62,7 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static List<String> unwrap(final List<EntitlementTO> collection) {
-        List<String> respons = new ArrayList<String>();
-        for (EntitlementTO e : collection) {
-            respons.add(e.getName());
-        }
-        return respons;
-    }
-
-    public static Set<MailTemplateTO> wrapMailTemplates(final ModelAndView mailTemplates)
{
-        @SuppressWarnings("unchecked")
-        Set<String> collection = (Set<String>) mailTemplates.getModel().values().iterator().next();
-        return wrapMailTemplates(collection);
-    }
-
-    public static Set<MailTemplateTO> wrapMailTemplates(final Set<String> collection)
{
+    public static Set<MailTemplateTO> wrapMailTemplates(final Collection<String>
collection) {
         Set<MailTemplateTO> respons = new HashSet<MailTemplateTO>();
         for (String e : collection) {
             respons.add(MailTemplateTO.instance(e));
@@ -86,37 +70,43 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static Set<ValidatorTO> wrapValidator(final ModelAndView validators) {
-        @SuppressWarnings("unchecked")
-        Set<String> collection = (Set<String>) validators.getModel().values().iterator().next();
-        return wrapValidator(collection);
-    }
-
-    public static List<String> unwrapValidator(final List<ValidatorTO> collection)
{
+    public static List<String> unwrapMailTemplates(final Collection<MailTemplateTO>
collection) {
         List<String> respons = new ArrayList<String>();
-        for (ValidatorTO e : collection) {
+        for (MailTemplateTO e : collection) {
             respons.add(e.getName());
         }
         return respons;
     }
 
-    public static List<String> unwrapMailTemplates(final List<MailTemplateTO>
collection) {
+    public static Set<ValidatorTO> wrapValidators(final Collection<String> validators)
{
+        Set<ValidatorTO> respons = new HashSet<ValidatorTO>();
+        for (String validator : validators) {
+            respons.add(ValidatorTO.instance(validator));
+        }
+        return respons;
+    }
+
+    public static List<String> unwrapValidator(final Collection<ValidatorTO>
collection) {
         List<String> respons = new ArrayList<String>();
-        for (MailTemplateTO e : collection) {
+        for (ValidatorTO e : collection) {
             respons.add(e.getName());
         }
         return respons;
     }
 
-    public static Set<ValidatorTO> wrapValidator(final Set<String> collection)
{
-        Set<ValidatorTO> respons = new HashSet<ValidatorTO>();
-        for (String e : collection) {
-            respons.add(ValidatorTO.instance(e));
+    public static List<AuditLoggerName> wrapLogger(final Collection<LoggerTO>
logger) {
+        List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
+        for (LoggerTO l : logger) {
+            try {
+                respons.add(AuditLoggerName.fromLoggerName(l.getName()));
+            } catch (Exception e) {
+                //TODO log event
+            }
         }
         return respons;
     }
 
-    public static List<LoggerTO> unwrapLogger(List<AuditLoggerName> auditNames)
{
+    public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName>
auditNames) {
         List<LoggerTO> respons = new ArrayList<LoggerTO>();
         for (AuditLoggerName l : auditNames) {
             LoggerTO loggerTO = new LoggerTO();
@@ -127,7 +117,7 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static Set<JobClassTO> wrapJobClasses(Set<String> classes) {
+    public static Set<JobClassTO> wrapJobClasses(final Collection<String> classes)
{
         Set<JobClassTO> respons = new HashSet<JobClassTO>();
         for (String cl : classes) {
             respons.add(JobClassTO.instance(cl));
@@ -135,35 +125,23 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static Set<SyncActionClassTO> wrapSyncActionClasses(Set<String> classes)
{
-        Set<SyncActionClassTO> respons = new HashSet<SyncActionClassTO>();
-        for (String cl : classes) {
-            respons.add(SyncActionClassTO.instance(cl));
-        }
-        return respons;
-    }
-
-    public static List<AuditLoggerName> wrapLogger(List<LoggerTO> logger) {
-        List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
-        for (LoggerTO l : logger) {
-            try {
-                respons.add(AuditLoggerName.fromLoggerName(l.getName()));
-            } catch (Exception e) {
-                //TODO log event
-            }
+    public static List<String> unwrapJobClasses(final Collection<JobClassTO>
jobClasses) {
+        List<String> respons = new ArrayList<String>();
+        for (JobClassTO e : jobClasses) {
+            respons.add(e.getName());
         }
         return respons;
     }
 
-    public static List<String> unwrapJobClasses(List<JobClassTO> jobClasses)
{
-        List<String> respons = new ArrayList<String>();
-        for (JobClassTO e : jobClasses) {
-            respons.add(e.getName());
+    public static Set<SyncActionClassTO> wrapSyncActionClasses(final Collection<String>
classes) {
+        Set<SyncActionClassTO> respons = new HashSet<SyncActionClassTO>();
+        for (String cl : classes) {
+            respons.add(SyncActionClassTO.instance(cl));
         }
         return respons;
     }
 
-    public static List<String> unwrapSyncActionClasses(List<SyncActionClassTO>
actions) {
+    public static List<String> unwrapSyncActionClasses(final Collection<SyncActionClassTO>
actions) {
         List<String> respons = new ArrayList<String>();
         for (SyncActionClassTO e : actions) {
             respons.add(e.getName());
@@ -171,7 +149,7 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static Set<PropagationActionClassTO> wrapPropagationActionClasses(Set<String>
classes) {
+    public static Set<PropagationActionClassTO> wrapPropagationActionClasses(final
Collection<String> classes) {
         Set<PropagationActionClassTO> respons = new HashSet<PropagationActionClassTO>();
         for (String cl : classes) {
             respons.add(PropagationActionClassTO.instance(cl));
@@ -179,7 +157,7 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static List<String> unwrapPropagationActionClasses(Set<PropagationActionClassTO>
actions) {
+    public static List<String> unwrapPropagationActionClasses(final Collection<PropagationActionClassTO>
actions) {
         List<String> respons = new ArrayList<String>();
         for (PropagationActionClassTO e : actions) {
             respons.add(e.getName());
@@ -187,7 +165,7 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static Set<CorrelationRuleClassTO> wrapCorrelationRuleClasses(Set<String>
classes) {
+    public static Set<CorrelationRuleClassTO> wrapSyncCorrelationRuleClasses(final
Collection<String> classes) {
         Set<CorrelationRuleClassTO> respons = new HashSet<CorrelationRuleClassTO>();
         for (String cl : classes) {
             respons.add(CorrelationRuleClassTO.instance(cl));
@@ -195,16 +173,11 @@ public final class CollectionWrapper {
         return respons;
     }
 
-    public static List<String> unwrapCorrelationRuleClasses(Set<CorrelationRuleClassTO>
actions) {
+    public static List<String> unwrapSyncCorrelationRuleClasses(final Collection<CorrelationRuleClassTO>
actions) {
         List<String> respons = new ArrayList<String>();
         for (CorrelationRuleClassTO e : actions) {
             respons.add(e.getName());
         }
         return respons;
     }
-
-    @SuppressWarnings("unchecked")
-    public static List<String> wrapStrings(final ModelAndView modelAndView) {
-        return (List<String>) modelAndView.getModel().values().iterator().next();
-    }
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/AuthRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/AuthRestClient.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/AuthRestClient.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/AuthRestClient.java
Fri Mar 22 17:05:41 2013
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.syncope.common.services.EntitlementService;
-import org.apache.syncope.common.to.EntitlementTO;
 import org.apache.syncope.common.util.CollectionWrapper;
 import org.springframework.stereotype.Component;
 
@@ -40,9 +39,8 @@ public class AuthRestClient extends Base
      * @return List<String>
      */
     public List<String> getAllEntitlements() {
-        List<EntitlementTO> entitlemens = new ArrayList<EntitlementTO>(getService(EntitlementService.class)
-                .getAllEntitlements());
-        return CollectionWrapper.unwrap(entitlemens);
+        return new ArrayList<String>(
+                CollectionWrapper.unwrap(getService(EntitlementService.class).getAllEntitlements()));
     }
 
     /**
@@ -51,8 +49,7 @@ public class AuthRestClient extends Base
      * @return List<String>
      */
     public List<String> getOwnedEntitlements() {
-        List<EntitlementTO> entitlemens = new ArrayList<EntitlementTO>(getService(EntitlementService.class)
-                .getMyEntitlements());
-        return CollectionWrapper.unwrap(entitlemens);
+        return new ArrayList<String>(
+                CollectionWrapper.unwrap(getService(EntitlementService.class).getMyEntitlements()));
     }
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
Fri Mar 22 17:05:41 2013
@@ -89,8 +89,8 @@ public class PolicyRestClient extends Ba
         List<String> rules = null;
 
         try {
-            rules = CollectionWrapper.unwrapCorrelationRuleClasses(
-                    getService(PolicyService.class).getCorrelationRuleClasses(PolicyType.SYNC));
+            rules = CollectionWrapper.unwrapSyncCorrelationRuleClasses(
+                    getService(PolicyService.class).getSyncCorrelationRuleClasses(PolicyType.SYNC));
         } catch (Exception e) {
             LOG.error("While getting all correlation rule classes", e);
         }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ImplementationClassNamesLoader.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ImplementationClassNamesLoader.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ImplementationClassNamesLoader.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ImplementationClassNamesLoader.java
Fri Mar 22 17:05:41 2013
@@ -31,7 +31,7 @@ import org.apache.syncope.core.propagati
 import org.apache.syncope.core.report.ReportJob;
 import org.apache.syncope.core.report.Reportlet;
 import org.apache.syncope.core.sync.SyncActions;
-import org.apache.syncope.core.sync.SyncRule;
+import org.apache.syncope.core.sync.SyncCorrelationRule;
 import org.apache.syncope.core.sync.impl.SyncJob;
 import org.quartz.Job;
 import org.slf4j.Logger;
@@ -103,7 +103,7 @@ public class ImplementationClassNamesLoa
                         classNames.get(Type.SYNC_ACTIONS).add(metadata.getClassName());
                     }
 
-                    if (interfaces.contains(SyncRule.class) && !metadata.isAbstract())
{
+                    if (interfaces.contains(SyncCorrelationRule.class) && !metadata.isAbstract())
{
                         classNames.get(Type.SYNC_CORRELATION_RULES).add(metadata.getClassName());
                     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
Fri Mar 22 17:05:41 2013
@@ -237,8 +237,8 @@ public class PolicyController extends Ab
     }
 
     @PreAuthorize("hasRole('POLICY_LIST')")
-    @RequestMapping(method = RequestMethod.GET, value = "/correlationRuleClasses")
-    public ModelAndView getCorrelationRuleClasses() {
+    @RequestMapping(method = RequestMethod.GET, value = "/syncCorrelationRuleClasses")
+    public ModelAndView getSyncCorrelationRuleClasses() {
         final Set<String> correlationRules =
                 classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.SYNC_CORRELATION_RULES);
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
Fri Mar 22 17:05:41 2013
@@ -79,13 +79,17 @@ public class ConfigurationServiceImpl im
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public Set<MailTemplateTO> getMailTemplates() {
-        return CollectionWrapper.wrapMailTemplates(configurationController.getMailTemplates());
+        return CollectionWrapper.wrapMailTemplates(
+                (Set<String>) configurationController.getMailTemplates().getModel().values().iterator().next());
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public Set<ValidatorTO> getValidators() {
-        return CollectionWrapper.wrapValidator(configurationController.getValidators());
+        return CollectionWrapper.wrapValidators(
+                (Set<String>) configurationController.getValidators().getModel().values().iterator().next());
     }
 
     @Override

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/PolicyServiceImpl.java
Fri Mar 22 17:05:41 2013
@@ -125,7 +125,7 @@ public class PolicyServiceImpl implement
     }
 
     @Override
-    public Set<CorrelationRuleClassTO> getCorrelationRuleClasses(final PolicyType type)
{
+    public Set<CorrelationRuleClassTO> getSyncCorrelationRuleClasses(final PolicyType
type) {
         Set<CorrelationRuleClassTO> result = null;
 
         switch (type) {
@@ -133,9 +133,9 @@ public class PolicyServiceImpl implement
             case GLOBAL_SYNC:
 
                 @SuppressWarnings("unchecked")
-                final Set<String> classes = (Set<String>) policyController.getCorrelationRuleClasses().getModel().
+                final Set<String> classes = (Set<String>) policyController.getSyncCorrelationRuleClasses().getModel().
                         values().iterator().next();
-                result = CollectionWrapper.wrapCorrelationRuleClasses(classes);
+                result = CollectionWrapper.wrapSyncCorrelationRuleClasses(classes);
                 break;
 
             default:
@@ -144,4 +144,4 @@ public class PolicyServiceImpl implement
 
         return result;
     }
-}
\ No newline at end of file
+}

Copied: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java
(from r1459775, syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncRule.java)
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java?p2=syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java&p1=syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncRule.java&r1=1459775&r2=1459902&rev=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncRule.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncCorrelationRule.java
Fri Mar 22 17:05:41 2013
@@ -24,7 +24,7 @@ import org.identityconnectors.framework.
 /**
  * Interface for correlation rule to be evaluated during SyncJob execution.
  */
-public interface SyncRule {
+public interface SyncCorrelationRule {
 
     /**
      * Return a search condition.
@@ -32,5 +32,5 @@ public interface SyncRule {
      * @param connObj connector object.
      * @return search condition.
      */
-    NodeCond getSearchCond(final ConnectorObject connObj);
+    NodeCond getSearchCond(ConnectorObject connObj);
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
Fri Mar 22 17:05:41 2013
@@ -72,7 +72,7 @@ import org.apache.syncope.core.rest.data
 import org.apache.syncope.core.rest.data.UserDataBinder;
 import org.apache.syncope.core.sync.SyncActions;
 import org.apache.syncope.core.sync.SyncResult;
-import org.apache.syncope.core.sync.SyncRule;
+import org.apache.syncope.core.sync.SyncCorrelationRule;
 import org.apache.syncope.core.util.AttributableUtil;
 import org.apache.syncope.core.util.EntitlementUtil;
 import org.apache.syncope.core.workflow.WorkflowResult;
@@ -343,7 +343,7 @@ public class SyncopeSyncResultHandler im
     }
 
     private List<Long> findByCorrelationRule(
-            final ConnectorObject connObj, final SyncRule rule, final AttributableUtil attrUtil)
{
+            final ConnectorObject connObj, final SyncCorrelationRule rule, final AttributableUtil
attrUtil) {
         return search(rule.getSearchCond(connObj), attrUtil);
     }
 
@@ -441,7 +441,7 @@ public class SyncopeSyncResultHandler im
             syncPolicySpec = syncTask.getResource().getSyncPolicy().<SyncPolicySpec>getSpecification();
         }
 
-        SyncRule syncRule = null;
+        SyncCorrelationRule syncRule = null;
         List<String> altSearchSchemas = null;
 
         if (syncPolicySpec != null) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributableUtil.java Fri
Mar 22 17:05:41 2013
@@ -69,7 +69,7 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.beans.user.USchema;
 import org.apache.syncope.core.persistence.beans.user.UVirAttr;
 import org.apache.syncope.core.persistence.beans.user.UVirSchema;
-import org.apache.syncope.core.sync.SyncRule;
+import org.apache.syncope.core.sync.SyncCorrelationRule;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 import org.slf4j.LoggerFactory;
 
@@ -625,7 +625,7 @@ public class AttributableUtil {
         return result;
     }
 
-    public SyncRule getCorrelationRule(final SyncPolicySpec policySpec) {
+    public SyncCorrelationRule getCorrelationRule(final SyncPolicySpec policySpec) {
 
         String clazz;
 
@@ -641,11 +641,11 @@ public class AttributableUtil {
                 clazz = null;
         }
 
-        SyncRule res = null;
+        SyncCorrelationRule res = null;
 
         if (StringUtils.isNotBlank(clazz)) {
             try {
-                res = (SyncRule) Class.forName(clazz).newInstance();
+                res = (SyncCorrelationRule) Class.forName(clazz).newInstance();
             } catch (Exception e) {
                 LOG.error("Failure instantiating correlation rule class '{}'", clazz, e);
             }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java Fri
Mar 22 17:05:41 2013
@@ -165,7 +165,7 @@ public class PolicyTestITCase extends Ab
 
     @Test
     public void getCorrelationRules() {
-        assertEquals(1, policyService.getCorrelationRuleClasses(PolicyType.SYNC).size());
+        assertEquals(1, policyService.getSyncCorrelationRuleClasses(PolicyType.SYNC).size());
     }
 
     private SyncPolicyTO buildSyncPolicyTO() {

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java?rev=1459902&r1=1459901&r2=1459902&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncRule.java Fri Mar
22 17:05:41 2013
@@ -22,7 +22,7 @@ import org.apache.syncope.common.search.
 import org.apache.syncope.common.search.NodeCond;
 import org.identityconnectors.framework.common.objects.ConnectorObject;
 
-public class TestSyncRule implements SyncRule {
+public class TestSyncRule implements SyncCorrelationRule {
 
     @Override
     public NodeCond getSearchCond(ConnectorObject connObj) {



Mime
View raw message