You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/15 17:27:50 UTC

svn commit: r1433497 - in /syncope/trunk/client/src/main/java/org/apache/syncope/services: ReportService.java proxy/ConfigurationServiceProxy.java proxy/ReportServiceProxy.java proxy/UserRequestServiceProxy.java

Author: jbernhardt
Date: Tue Jan 15 16:27:50 2013
New Revision: 1433497

URL: http://svn.apache.org/viewvc?rev=1433497&view=rev
Log:
Complete[SYNCOPE-259]
Completed missing Proxy methods

Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/services/ReportService.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java
    syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/ReportService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/ReportService.java?rev=1433497&r1=1433496&r2=1433497&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/ReportService.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/ReportService.java Tue Jan 15 16:27:50 2013
@@ -29,6 +29,8 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
 import org.apache.syncope.client.to.ReportExecTO;
 import org.apache.syncope.client.to.ReportTO;
 import org.apache.syncope.types.ReportExecExportFormat;
@@ -75,7 +77,7 @@ public interface ReportService {
     @GET
     @Path("executions/{executionId}")
     @Produces(MediaType.APPLICATION_OCTET_STREAM)
-    void exportExecutionResult(@PathParam("executionId") Long executionId,
+    Response exportExecutionResult(@PathParam("executionId") Long executionId,
             @QueryParam("format") ReportExecExportFormat fmt);
 
     @POST

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java?rev=1433497&r1=1433496&r2=1433497&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ConfigurationServiceProxy.java Tue Jan 15 16:27:50 2013
@@ -18,7 +18,9 @@
  */
 package org.apache.syncope.services.proxy;
 
+import java.io.InputStream;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -64,20 +66,20 @@ public class ConfigurationServiceProxy e
 
     @Override
     public Set<String> getValidators() {
-        // TODO Auto-generated method stub
-        return null;
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
+                baseUrl + "configuration/validators.json", String[].class)));
     }
 
     @Override
     public Set<String> getMailTemplates() {
-        // TODO Auto-generated method stub
-        return null;
+        return new HashSet<String>(Arrays.asList(getRestTemplate().getForObject(
+                baseUrl + "configuration/mailTemplates.json", String[].class)));
     }
 
     @Override
     public Response dbExport() {
-        // TODO Auto-generated method stub
-        return null;
+        return Response.ok(getRestTemplate().getForObject(baseUrl + "configuration/dbexport", InputStream.class))
+                .build();
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java?rev=1433497&r1=1433496&r2=1433497&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/ReportServiceProxy.java Tue Jan 15 16:27:50 2013
@@ -18,9 +18,12 @@
  */
 package org.apache.syncope.services.proxy;
 
+import java.io.InputStream;
 import java.util.Arrays;
 import java.util.List;
 
+import javax.ws.rs.core.Response;
+
 import org.apache.syncope.client.to.ReportExecTO;
 import org.apache.syncope.client.to.ReportTO;
 import org.apache.syncope.services.ReportService;
@@ -55,14 +58,13 @@ public class ReportServiceProxy extends 
 
     @Override
     public List<ReportTO> list(int page, int size) {
-        // TODO Auto-generated method stub
-        return null;
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/list/{page}/{size}", ReportTO[].class,
+                page, size));
     }
 
     @Override
     public List<ReportExecTO> listExecutions() {
-        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/execution/list",
-                ReportExecTO[].class));
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "report/execution/list", ReportExecTO[].class));
     }
 
     @Override
@@ -78,32 +80,35 @@ public class ReportServiceProxy extends 
 
     @Override
     public ReportExecTO readExecution(Long executionId) {
-        return getRestTemplate().getForObject(baseUrl + "report/execution/read/{reportId}",
-                ReportExecTO.class, executionId);
+        return getRestTemplate().getForObject(baseUrl + "report/execution/read/{executionId}", ReportExecTO.class,
+                executionId);
     }
 
     @Override
-    public void exportExecutionResult(Long executionId, ReportExecExportFormat fmt) {
-        // TODO Auto-generated method stub
-
+    public Response exportExecutionResult(Long executionId, ReportExecExportFormat fmt) {
+        String format = (fmt != null)
+                ? "?fmt=" + fmt.toString()
+                : "";
+        InputStream stream = getRestTemplate().getForObject(baseUrl + "report/execution/export/{executionId}" + format,
+                InputStream.class, executionId);
+        return Response.ok(stream).build();
     }
 
     @Override
     public ReportExecTO execute(Long reportId) {
-        return getRestTemplate().postForObject(baseUrl + "report/execute/{reportId}", null,
-                ReportExecTO.class, reportId);
+        return getRestTemplate().postForObject(baseUrl + "report/execute/{reportId}", null, ReportExecTO.class,
+                reportId);
     }
 
     @Override
     public ReportTO delete(Long reportId) {
-        return getRestTemplate().getForObject(baseUrl + "report/delete/{reportId}",
-                ReportTO.class, reportId);
+        return getRestTemplate().getForObject(baseUrl + "report/delete/{reportId}", ReportTO.class, reportId);
     }
 
     @Override
     public ReportExecTO deleteExecution(Long executionId) {
-        // TODO Auto-generated method stub
-        return null;
+        return getRestTemplate().getForObject(baseUrl + "report/execution/delete/{executionId}", ReportExecTO.class,
+                executionId);
     }
 
 }

Modified: syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java?rev=1433497&r1=1433496&r2=1433497&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/services/proxy/UserRequestServiceProxy.java Tue Jan 15 16:27:50 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.services.proxy;
 
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.syncope.client.mod.UserMod;
@@ -34,8 +35,7 @@ public class UserRequestServiceProxy ext
 
     @Override
     public boolean isCreateAllowed() {
-        // TODO Auto-generated method stub
-        return false;
+        return getRestTemplate().getForObject(baseUrl + "user/request/create/allowed", Boolean.class);
     }
 
     @Override
@@ -50,26 +50,24 @@ public class UserRequestServiceProxy ext
 
     @Override
     public UserRequestTO delete(Long userId) {
-        return getRestTemplate().getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class,
-                userId);
+        return getRestTemplate().getForObject(baseUrl + "user/request/delete/{userId}", UserRequestTO.class, userId);
     }
 
     @Override
     public List<UserRequestTO> list() {
-        // TODO Auto-generated method stub
-        return null;
+        return Arrays.asList(getRestTemplate().getForObject(baseUrl + "user/request/list", UserRequestTO[].class));
     }
 
     @Override
     public UserRequestTO read(Long requestId) {
-        // TODO Auto-generated method stub
-        return null;
+        return getRestTemplate()
+                .getForObject(baseUrl + "user/request/read/{requestId}", UserRequestTO.class, requestId);
     }
 
     @Override
     public UserRequestTO deleteRequest(Long requestId) {
-        // TODO Auto-generated method stub
-        return null;
+        return getRestTemplate().getForObject(baseUrl + "user/request/deleteRequest/{requestId}", UserRequestTO.class,
+                requestId);
     }
 
 }