syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1605386 [2/3] - in /syncope/trunk: ./ build-tools/src/main/java/org/apache/syncope/buildtools/ build-tools/src/main/resources/ common/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/org/apache/syncope/common/...
Date Wed, 25 Jun 2014 13:22:19 GMT
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=1605386&r1=1605385&r2=1605386&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
Wed Jun 25 13:22:17 2014
@@ -95,6 +95,8 @@ public class PolicyServiceImpl extends A
 
     @Override
     public <T extends AbstractPolicyTO> void update(final Long policyId, final T policyTO)
{
+        policyTO.setId(policyId);
+        
         switch (policyTO.getType()) {
             case ACCOUNT:
             case GLOBAL_ACCOUNT:

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -56,6 +56,7 @@ public class ReportServiceImpl extends A
 
     @Override
     public void update(final Long reportId, final ReportTO reportTO) {
+        reportTO.setId(reportId);
         controller.update(reportTO);
     }
 
@@ -70,13 +71,12 @@ public class ReportServiceImpl extends A
     }
 
     @Override
-    public PagedResult<ReportTO> list(final int page, final int size) {
+    public PagedResult<ReportTO> list(final Integer page, final Integer size) {
         return list(page, size, null);
     }
 
     @Override
-    public PagedResult<ReportTO> list(final int page, final int size, final String
orderBy) {
-        checkPageSize(page, size);
+    public PagedResult<ReportTO> list(final Integer page, final Integer size, final
String orderBy) {
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return buildPagedResult(controller.list(page, size, orderByClauses), page, size,
controller.count());
     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ResourceServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -22,7 +22,6 @@ import java.net.URI;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.reqres.BulkAction;
 import org.apache.syncope.common.reqres.BulkActionResult;
@@ -30,7 +29,6 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.to.AbstractAttributableTO;
 import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.ResourceTO;
-import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.RESTHeaders;
 import org.apache.syncope.common.types.ResourceDeassociationActionType;
 import org.apache.syncope.common.types.SubjectType;
@@ -67,6 +65,7 @@ public class ResourceServiceImpl extends
 
     @Override
     public void update(final String resourceName, final ResourceTO resourceTO) {
+        resourceTO.setName(resourceName);
         controller.update(resourceTO);
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -81,13 +81,12 @@ public class RoleServiceImpl extends Abs
     }
 
     @Override
-    public PagedResult<RoleTO> list(final int page, final int size) {
+    public PagedResult<RoleTO> list(final Integer page, final Integer size) {
         return list(page, size, null);
     }
 
     @Override
-    public PagedResult<RoleTO> list(final int page, final int size, final String orderBy)
{
-        checkPageSize(page, size);
+    public PagedResult<RoleTO> list(final Integer page, final Integer size, final String
orderBy) {
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return buildPagedResult(controller.list(page, size, orderByClauses), page, size,
controller.count());
     }
@@ -113,13 +112,12 @@ public class RoleServiceImpl extends Abs
     }
 
     @Override
-    public PagedResult<RoleTO> search(final String fiql, final int page, final int
size) {
+    public PagedResult<RoleTO> search(final String fiql, final Integer page, final
Integer size) {
         return search(fiql, page, size, null);
     }
 
     @Override
-    public PagedResult<RoleTO> search(final String fiql, final int page, final int
size, final String orderBy) {
-        checkPageSize(page, size);
+    public PagedResult<RoleTO> search(final String fiql, final Integer page, final
Integer size, final String orderBy) {
         SearchCond cond = getSearchCond(fiql);
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return buildPagedResult(

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/SchemaServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -71,6 +71,7 @@ public class SchemaServiceImpl extends A
     public <T extends AbstractSchemaTO> void update(final AttributableType attrType,
final SchemaType schemaType,
             final String schemaName, final T schemaTO) {
 
-        controller.update(attrType, schemaType, schemaName, schemaTO);
+        schemaTO.setName(schemaName);
+        controller.update(attrType, schemaType, schemaTO);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -106,16 +106,17 @@ public class TaskServiceImpl extends Abs
     }
 
     @Override
-    public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType taskType,
final int page, final int size) {
+    public <T extends AbstractTaskTO> PagedResult<T> list(
+            final TaskType taskType, final Integer page, final Integer size) {
+
         return list(taskType, page, size, null);
     }
 
     @Override
     @SuppressWarnings("unchecked")
     public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType taskType,
-            final int page, final int size, final String orderBy) {
+            final Integer page, final Integer size, final String orderBy) {
 
-        checkPageSize(page, size);
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return (PagedResult<T>) buildPagedResult(
                 controller.list(taskType, page, size, orderByClauses), page, size, controller.count(taskType));
@@ -132,13 +133,15 @@ public class TaskServiceImpl extends Abs
     }
 
     @Override
-    public void report(final Long executionId, final ReportExecTO report) {
-        controller.report(executionId, PropagationTaskExecStatus.fromString(report.getStatus()),
-                report.getMessage());
+    public void report(final Long executionId, final ReportExecTO reportExec) {
+        reportExec.setId(executionId);
+        controller.report(
+                executionId, PropagationTaskExecStatus.fromString(reportExec.getStatus()),
reportExec.getMessage());
     }
 
     @Override
     public void update(final Long taskId, final AbstractTaskTO taskTO) {
+        taskTO.setId(taskId);
         if (taskTO instanceof SyncTaskTO) {
             controller.updateSync((SyncTaskTO) taskTO);
         } else if (taskTO instanceof SchedTaskTO) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -93,13 +93,12 @@ public class UserServiceImpl extends Abs
     }
 
     @Override
-    public PagedResult<UserTO> list(final int page, final int size) {
+    public PagedResult<UserTO> list(final Integer page, final Integer size) {
         return list(page, size, null);
     }
 
     @Override
-    public PagedResult<UserTO> list(final int page, final int size, final String orderBy)
{
-        checkPageSize(page, size);
+    public PagedResult<UserTO> list(final Integer page, final Integer size, final String
orderBy) {
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return buildPagedResult(controller.list(page, size, orderByClauses), page, size,
controller.count());
     }
@@ -120,13 +119,12 @@ public class UserServiceImpl extends Abs
     }
 
     @Override
-    public PagedResult<UserTO> search(final String fiql, final int page, final int
size) {
+    public PagedResult<UserTO> search(final String fiql, final Integer page, final
Integer size) {
         return search(fiql, page, size, null);
     }
 
     @Override
-    public PagedResult<UserTO> search(final String fiql, final int page, final int
size, final String orderBy) {
-        checkPageSize(page, size);
+    public PagedResult<UserTO> search(final String fiql, final Integer page, final
Integer size, final String orderBy) {
         SearchCond cond = getSearchCond(fiql);
         List<OrderByClause> orderByClauses = getOrderByClauses(orderBy);
         return buildPagedResult(

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/WorkflowServiceImpl.java
Wed Jun 25 13:22:17 2014
@@ -20,7 +20,6 @@ package org.apache.syncope.core.services
 
 import java.io.IOException;
 import java.io.OutputStream;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -41,19 +40,14 @@ public class WorkflowServiceImpl extends
 
     @Override
     public Response getOptions(final SubjectType kind) {
-        String key = null;
-        String value = null;
-        switch (kind) {
-            case USER:
-            default:
-                key = RESTHeaders.ACTIVITI_USER_ENABLED;
-                value = Boolean.toString(ActivitiDetector.isActivitiEnabledForUsers());
-                break;
-
-            case ROLE:
-                key = RESTHeaders.ACTIVITI_ROLE_ENABLED;
-                value = Boolean.toString(ActivitiDetector.isActivitiEnabledForRoles());
-                break;
+        String key;
+        String value;
+        if (kind == SubjectType.USER) {
+            key = RESTHeaders.ACTIVITI_USER_ENABLED;
+            value = Boolean.toString(ActivitiDetector.isActivitiEnabledForUsers());
+        } else {
+            key = RESTHeaders.ACTIVITI_ROLE_ENABLED;
+            value = Boolean.toString(ActivitiDetector.isActivitiEnabledForRoles());
         }
 
         Response.ResponseBuilder builder = Response.ok().header(HttpHeaders.ALLOW, OPTIONS_ALLOW);
@@ -74,17 +68,10 @@ public class WorkflowServiceImpl extends
 
             @Override
             public void write(final OutputStream os) throws IOException {
-                switch (kind) {
-                    case USER:
-                        controller.exportUserDefinition(accept, os);
-                        break;
-
-                    case ROLE:
-                        controller.exportRoleDefinition(accept, os);
-                        break;
-
-                    default:
-                        throw new BadRequestException();
+                if (kind == SubjectType.USER) {
+                    controller.exportUserDefinition(accept, os);
+                } else {
+                    controller.exportRoleDefinition(accept, os);
                 }
             }
         };
@@ -100,15 +87,10 @@ public class WorkflowServiceImpl extends
 
             @Override
             public void write(final OutputStream os) throws IOException {
-                switch (kind) {
-                    case USER:
-                    default:
-                        controller.exportUserDiagram(os);
-                        break;
-
-                    case ROLE:
-                        controller.exportRoleDiagram(os);
-                        break;
+                if (kind == SubjectType.USER) {
+                    controller.exportUserDiagram(os);
+                } else {
+                    controller.exportRoleDiagram(os);
                 }
             }
         };
@@ -125,15 +107,10 @@ public class WorkflowServiceImpl extends
                 ? MediaType.APPLICATION_JSON_TYPE
                 : MediaType.APPLICATION_XML_TYPE;
 
-        switch (kind) {
-            case USER:
-            default:
-                controller.importUserDefinition(contentType, definition);
-                break;
-
-            case ROLE:
-                controller.importRoleDefinition(contentType, definition);
-                break;
+        if (kind == SubjectType.USER) {
+            controller.importUserDefinition(contentType, definition);
+        } else {
+            controller.importRoleDefinition(contentType, definition);
         }
     }
 }

Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Wed Jun 25 13:22:17 2014
@@ -75,6 +75,14 @@ under the License.
 
   <bean id="exceptionMapper" class="org.apache.syncope.core.rest.utils.RestServiceExceptionMapper"/>
 
+  <bean id="validationProvider" class="org.apache.cxf.validation.BeanValidationProvider"/>
+  <bean id="validationInInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor">
+    <property name="provider" ref="validationProvider"/>
+  </bean>
+  <bean id="validationOutInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor">
+    <property name="provider" ref="validationProvider"/>
+  </bean>   
+  
   <bean id="searchContextProvider" class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider"/>
   
   <bean id="wadlGenerator" class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
@@ -89,13 +97,21 @@ under the License.
   
   <bean id="addETagFilter" class="org.apache.syncope.core.services.AddETagFilter"/>
 
-  <jaxrs:server id="restContainer" address="/" basePackages="org.apache.syncope.common.services,
org.apache.syncope.core.services" staticSubresourceResolution="true">
+  <jaxrs:server id="restContainer" address="/" 
+                basePackages="org.apache.syncope.common.services, org.apache.syncope.core.services"

+                staticSubresourceResolution="true">
     <jaxrs:resourceComparator>
       <bean id="queryResourceInfoComparator" class="org.apache.syncope.core.rest.utils.QueryResourceInfoComparator"/>
     </jaxrs:resourceComparator>
     <jaxrs:properties> 
       <entry key="search.lax.property.match" value="true"/> 
     </jaxrs:properties> 
+    <jaxrs:inInterceptors>
+      <ref bean="validationInInterceptor"/>
+    </jaxrs:inInterceptors>         
+    <jaxrs:outInterceptors>
+      <ref bean="validationOutInterceptor"/>
+    </jaxrs:outInterceptors>
     <jaxrs:providers>
       <ref bean="jaxbProvider"/>
       <ref bean="jsonProvider"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java
(original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnectorTestITCase.java
Wed Jun 25 13:22:17 2014
@@ -67,6 +67,8 @@ public class ConnectorTestITCase extends
 
     private static String connidDbTableVersion;
 
+    private static String testJDBCURL;
+
     @BeforeClass
     public static void setUpConnIdBundles() throws IOException {
         InputStream propStream = null;
@@ -77,6 +79,8 @@ public class ConnectorTestITCase extends
 
             connidSoapVersion = props.getProperty("connid.soap.version");
             connidDbTableVersion = props.getProperty("connid.db.table.version");
+
+            testJDBCURL = props.getProperty("testdb.url");
         } catch (Exception e) {
             LOG.error("Could not load {}", ConnIdBundleManager.CONNID_PROPS, e);
         } finally {
@@ -84,6 +88,7 @@ public class ConnectorTestITCase extends
         }
         assertNotNull(connidSoapVersion);
         assertNotNull(connidDbTableVersion);
+        assertNotNull(testJDBCURL);
     }
 
     @Test(expected = SyncopeClientException.class)
@@ -458,7 +463,7 @@ public class ConnectorTestITCase extends
         jdbcUrlTemplateSchema.setRequired(true);
         ConnConfProperty jdbcUrlTemplate = new ConnConfProperty();
         jdbcUrlTemplate.setSchema(jdbcUrlTemplateSchema);
-        jdbcUrlTemplate.getValues().add("jdbc:h2:tcp://localhost:9092/testdb");
+        jdbcUrlTemplate.getValues().add(testJDBCURL);
         conf.add(jdbcUrlTemplate);
 
         ConnConfPropSchema userSchema = new ConnConfPropSchema();

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SearchTestITCase.java Wed
Jun 25 13:22:17 2014
@@ -25,12 +25,10 @@ import static org.junit.Assert.assertTru
 
 import java.util.HashSet;
 import java.util.Set;
-
 import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.common.reqres.PagedResult;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
-
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -131,7 +129,7 @@ public class SearchTestITCase extends Ab
     }
 
     @Test
-    public void searchByBooleanAttributableCond() {
+    public void searchByBooleanSubjectCond() {
         final PagedResult<RoleTO> matchingRoles = roleService.search(
                 SyncopeClient.getRoleSearchConditionBuilder().is("inheritAttrs").equalTo("true").query());
         assertNotNull(matchingRoles);
@@ -147,7 +145,7 @@ public class SearchTestITCase extends Ab
     }
 
     @Test
-    public void searchByRelationshipAttributableCond() {
+    public void searchByRelationshipSubjectCond() {
         final PagedResult<RoleTO> matchingRoles = roleService.search(SyncopeClient.getRoleSearchConditionBuilder().
                 isNotNull("passwordPolicy").and("userOwner").equalTo(5).query());
 

Modified: syncope/trunk/core/src/test/resources/connid.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/connid.properties?rev=1605386&r1=1605385&r2=1605386&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/connid.properties (original)
+++ syncope/trunk/core/src/test/resources/connid.properties Wed Jun 25 13:22:17 2014
@@ -16,5 +16,8 @@
 # under the License.
 connid.locations=${connid.location},\
 connid://${testconnectorserver.key}@localhost:${testconnectorserver.port}
+
+## for test only
+testdb.url=${testdb.url}
 connid.soap.version=${connid.soap.version}
-connid.db.table.version=${connid.db.table.version}
+connid.db.table.version=${connid.db.table.version}
\ No newline at end of file



Mime
View raw message