syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1440904 - in /syncope/trunk: build-tools/src/main/resources/org/apache/syncope/ 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...
Date Thu, 31 Jan 2013 10:58:31 GMT
Author: ashakirin
Date: Thu Jan 31 10:58:31 2013
New Revision: 1440904

URL: http://svn.apache.org/viewvc?rev=1440904&view=rev
Log:
[SYNCOPE-231] Added WorkflowServiceImpl and Test

Modified:
    syncope/trunk/build-tools/src/main/resources/org/apache/syncope/checkstyle.xml
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.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/NotificationRestClient.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java
    syncope/trunk/core/src/main/resources/restContext.xml
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java

Modified: syncope/trunk/build-tools/src/main/resources/org/apache/syncope/checkstyle.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/build-tools/src/main/resources/org/apache/syncope/checkstyle.xml?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/build-tools/src/main/resources/org/apache/syncope/checkstyle.xml (original)
+++ syncope/trunk/build-tools/src/main/resources/org/apache/syncope/checkstyle.xml Thu Jan
31 10:58:31 2013
@@ -177,7 +177,7 @@ under the License.
         <!-- Checks for common coding problems               -->
         <!-- See http://checkstyle.sf.net/config_coding.html -->
 <!--        <module name="AvoidInlineConditionals"/>-->
-    <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
+    <!--module name="DoubleCheckedLocking"/-->    <!-- MY FAVOURITE -->
     <module name="EmptyStatement"/>
     <module name="EqualsHashCode"/>
     <module name="HiddenField">

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java
(original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/WorkflowServiceProxy.java
Thu Jan 31 10:58:31 2013
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.List;
 import org.apache.syncope.common.services.WorkflowService;
 import org.apache.syncope.common.to.WorkflowDefinitionTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.springframework.web.client.RestTemplate;
 
 public class WorkflowServiceProxy extends SpringServiceProxy implements WorkflowService {
@@ -31,17 +32,19 @@ public class WorkflowServiceProxy extend
     }
 
     @Override
-    public WorkflowDefinitionTO getDefinition(final String type) {
-        return getRestTemplate().getForObject(baseUrl + "workflow/definition/" + type, WorkflowDefinitionTO.class);
+    public WorkflowDefinitionTO getDefinition(final AttributableType type) {
+        return getRestTemplate().getForObject(baseUrl + "workflow/definition/" + type.name().toLowerCase(),
+                WorkflowDefinitionTO.class);
     }
 
     @Override
-    public void updateDefinition(final String type, final WorkflowDefinitionTO definition)
{
-        getRestTemplate().put(baseUrl + "workflow/definition/" + type, definition);
+    public void updateDefinition(final AttributableType type, final WorkflowDefinitionTO
definition) {
+        getRestTemplate().put(baseUrl + "workflow/definition/" + type.name().toLowerCase(),
definition);
     }
 
     @Override
-    public List<String> getDefinedTasks(final String type) {
-        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "workflow/tasks/{type}",
String[].class, type));
+    public List<String> getDefinedTasks(final AttributableType type) {
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "workflow/tasks/{type}",
String[].class,
+                type.name().toLowerCase()));
     }
 }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/WorkflowService.java
Thu Jan 31 10:58:31 2013
@@ -25,19 +25,20 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 
 import org.apache.syncope.common.to.WorkflowDefinitionTO;
+import org.apache.syncope.common.types.AttributableType;
 
 @Path("workflows")
 public interface WorkflowService {
 
     @GET
     @Path("{kind}")
-    WorkflowDefinitionTO getDefinition(@PathParam("kind") String kind);
+    WorkflowDefinitionTO getDefinition(@PathParam("kind") AttributableType kind);
 
     @PUT
     @Path("{kind}")
-    void updateDefinition(@PathParam("kind") String kind, WorkflowDefinitionTO definition);
+    void updateDefinition(@PathParam("kind") AttributableType kind, WorkflowDefinitionTO
definition);
 
     @GET
     @Path("{kind}/tasks")
-    List<String> getDefinedTasks(@PathParam("kind") String kind);
+    List<String> getDefinedTasks(@PathParam("kind") AttributableType kind);
 }

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=1440904&r1=1440903&r2=1440904&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
Thu Jan 31 10:58:31 2013
@@ -185,4 +185,9 @@ public final class CollectionWrapper {
         }
         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/NotificationRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java
Thu Jan 31 10:58:31 2013
@@ -26,6 +26,7 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.services.WorkflowService;
 import org.apache.syncope.common.to.MailTemplateTO;
 import org.apache.syncope.common.to.NotificationTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.util.CollectionWrapper;
 import org.springframework.stereotype.Component;
 
@@ -60,6 +61,6 @@ public class NotificationRestClient exte
     }
 
     public List<String> getEvents() {
-        return getService(WorkflowService.class).getDefinedTasks("user");
+        return getService(WorkflowService.class).getDefinedTasks(AttributableType.USER);
     }
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java
(original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/WorkflowRestClient.java
Thu Jan 31 10:58:31 2013
@@ -20,6 +20,7 @@ package org.apache.syncope.console.rest;
 
 import org.apache.syncope.common.services.WorkflowService;
 import org.apache.syncope.common.to.WorkflowDefinitionTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.springframework.stereotype.Component;
 
@@ -29,10 +30,10 @@ public class WorkflowRestClient extends 
     private static final long serialVersionUID = 5049285686167071017L;
 
     public WorkflowDefinitionTO getDefinition() throws SyncopeClientCompositeErrorException
{
-        return getService(WorkflowService.class).getDefinition("user");
+        return getService(WorkflowService.class).getDefinition(AttributableType.USER);
     }
 
     public void updateDefinition(final WorkflowDefinitionTO workflowDef) throws SyncopeClientCompositeErrorException
{
-        getService(WorkflowService.class).updateDefinition("user", workflowDef);
+        getService(WorkflowService.class).updateDefinition(AttributableType.USER, workflowDef);
     }
 }

Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Thu Jan 31 10:58:31 2013
@@ -78,6 +78,7 @@ under the License.
       <ref bean="schemaServiceImpl"/>
       <ref bean="userRequestServiceImpl"/>
       <ref bean="userServiceImpl"/>
+      <ref bean="workflowServiceImpl"/>
     </jaxrs:serviceBeans>
     <jaxrs:resourceComparator>
       <bean id="myServiceComparator" class="org.apache.syncope.core.rest.utils.QueryResourceInfoComperator"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java?rev=1440904&r1=1440903&r2=1440904&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java
(original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/WorkflowTestITCase.java
Thu Jan 31 10:58:31 2013
@@ -24,25 +24,22 @@ import static org.junit.Assert.assertNot
 import java.util.List;
 
 import org.apache.syncope.common.to.WorkflowDefinitionTO;
+import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.core.workflow.ActivitiDetector;
 import org.junit.Assume;
 import org.junit.Test;
 
 public class WorkflowTestITCase extends AbstractTest {
 
-    public static final String ROLE_TYPE = "role";
-
-    public static final String USER_TYPE = "user";
-
     @Test //TODO TestCase needs to be extended
     public void testGetUserDefinition() {
-        WorkflowDefinitionTO definition = workflowService.getDefinition(USER_TYPE);
+        WorkflowDefinitionTO definition = workflowService.getDefinition(AttributableType.USER);
         assertNotNull(definition);
     }
 
     @Test //TODO TestCase needs to be extended
     public void testGetRoleDefinition() {
-        WorkflowDefinitionTO definition = workflowService.getDefinition(ROLE_TYPE);
+        WorkflowDefinitionTO definition = workflowService.getDefinition(AttributableType.ROLE);
         assertNotNull(definition);
     }
 
@@ -50,11 +47,11 @@ public class WorkflowTestITCase extends 
     public void testUpdateUserDefinition() {
         Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
 
-        WorkflowDefinitionTO definition = workflowService.getDefinition(USER_TYPE);
+        WorkflowDefinitionTO definition = workflowService.getDefinition(AttributableType.USER);
         assertNotNull(definition);
 
-        workflowService.updateDefinition(USER_TYPE, definition);
-        WorkflowDefinitionTO newDefinition = workflowService.getDefinition(USER_TYPE);
+        workflowService.updateDefinition(AttributableType.USER, definition);
+        WorkflowDefinitionTO newDefinition = workflowService.getDefinition(AttributableType.USER);
         assertNotNull(newDefinition);
     }
 
@@ -62,25 +59,25 @@ public class WorkflowTestITCase extends 
     public void testUpdateRoleDefinition() {
         Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForRoles());
 
-        WorkflowDefinitionTO definition = workflowService.getDefinition(ROLE_TYPE);
+        WorkflowDefinitionTO definition = workflowService.getDefinition(AttributableType.ROLE);
         assertNotNull(definition);
 
-        workflowService.updateDefinition(ROLE_TYPE, definition);
-        WorkflowDefinitionTO newDefinition = workflowService.getDefinition(ROLE_TYPE);
+        workflowService.updateDefinition(AttributableType.ROLE, definition);
+        WorkflowDefinitionTO newDefinition = workflowService.getDefinition(AttributableType.ROLE);
         assertNotNull(newDefinition);
     }
 
     @Test
     public void testGetUserTasks() {
-        List<String> tasks = workflowService.getDefinedTasks(USER_TYPE);
+        List<String> tasks = workflowService.getDefinedTasks(AttributableType.USER);
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
     }
 
     @Test
     public void testGetRoleTasks() {
-        List<String> tasks = workflowService.getDefinedTasks(ROLE_TYPE);
+        List<String> tasks = workflowService.getDefinedTasks(AttributableType.ROLE);
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
     }
-}
\ No newline at end of file
+}



Mime
View raw message