You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by cs...@apache.org on 2013/02/01 22:10:35 UTC

svn commit: r1441629 - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/services/proxy/ common/src/main/java/org/apache/syncope/common/services/ console/src/main/java/org/apache/syncope/console/rest/ core/src/main/java/org/apache/synco...

Author: cschneider
Date: Fri Feb  1 21:10:35 2013
New Revision: 1441629

URL: http://svn.apache.org/viewvc?rev=1441629&view=rev
Log:
SYNCOPE-231 Fix marshalling issue in getReportletConfClasses

Added:
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java   (with props)
Modified:
    syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/ReportServiceProxy.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java

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=1441629&r1=1441628&r2=1441629&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 Feb  1 21:10:35 2013
@@ -21,14 +21,13 @@ package org.apache.syncope.client.servic
 import java.io.InputStream;
 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;
 
 import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ReportService;
+import org.apache.syncope.common.services.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
 import org.apache.syncope.common.types.ReportExecExportFormat;
@@ -74,10 +73,10 @@ public class ReportServiceProxy extends 
     }
 
     @Override
-    public Set<String> getReportletConfClasses() {
+    public ReportletConfClasses getReportletConfClasses() {
         List<String> confClasses = Arrays.asList(getRestTemplate().getForObject(
                 baseUrl + "report/reportletConfClasses.json", String[].class));
-        return new HashSet<String>(confClasses);
+        return new ReportletConfClasses(confClasses);
     }
 
     @Override

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java?rev=1441629&r1=1441628&r2=1441629&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportService.java Fri Feb  1 21:10:35 2013
@@ -19,7 +19,6 @@
 package org.apache.syncope.common.services;
 
 import java.util.List;
-import java.util.Set;
 
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -89,7 +88,7 @@ public interface ReportService {
      */
     @GET
     @Path("reportletConfClasses")
-    Set<String> getReportletConfClasses();
+    ReportletConfClasses getReportletConfClasses();
 
     /**
      * @return Returns a list of all reports

Added: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java?rev=1441629&view=auto
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java (added)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java Fri Feb  1 21:10:35 2013
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.services;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class ReportletConfClasses {
+
+    List<String> confClasses;
+
+    public ReportletConfClasses() {
+        this.confClasses = new ArrayList<String>();
+    }
+
+    public ReportletConfClasses(Collection<String> confClasses) {
+        this();
+        this.confClasses.addAll(confClasses);  
+    }
+
+
+    public List<String> getConfClasses() {
+        return confClasses;
+    }
+
+    public void setConfClasses(List<String> confClasses) {
+        this.confClasses = confClasses;
+    }
+}

Propchange: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/ReportletConfClasses.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java?rev=1441629&r1=1441628&r2=1441629&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java Fri Feb  1 21:10:35 2013
@@ -18,13 +18,13 @@
  */
 package org.apache.syncope.console.rest;
 
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 
 import javax.ws.rs.core.Response;
 
 import org.apache.syncope.common.services.ReportService;
+import org.apache.syncope.common.services.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
@@ -36,15 +36,13 @@ public class ReportRestClient extends Ba
     private static final long serialVersionUID = 1644689667998953604L;
 
     public List<String> getReportletConfClasses() {
-        List<String> reportletClasses = null;
-
         try {
-            Set<String> reportletClassesSet = getService(ReportService.class).getReportletConfClasses();
-            reportletClasses = new LinkedList<String>(reportletClassesSet);
+            ReportletConfClasses reportletConfClasses = getService(ReportService.class).getReportletConfClasses();
+            return reportletConfClasses.getConfClasses();
         } catch (SyncopeClientCompositeErrorException e) {
             LOG.error("While getting available reportlet classes", e);
+            return new ArrayList<String>();
         }
-        return reportletClasses;
     }
 
     public ReportTO read(final Long reportId) {

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=1441629&r1=1441628&r2=1441629&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 Fri Feb  1 21:10:35 2013
@@ -30,6 +30,7 @@ import javax.ws.rs.core.UriInfo;
 
 import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.services.ReportService;
+import org.apache.syncope.common.services.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
 import org.apache.syncope.common.types.ReportExecExportFormat;
@@ -85,8 +86,8 @@ public class ReportServiceImpl implement
     }
 
     @Override
-    public Set<String> getReportletConfClasses() {
-        return reportController.getReportletConfClassesInternal();
+    public ReportletConfClasses getReportletConfClasses() {
+        return new ReportletConfClasses(reportController.getReportletConfClassesInternal());
     }
 
     @Override

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java?rev=1441629&r1=1441628&r2=1441629&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ReportTestITCase.java Fri Feb  1 21:10:35 2013
@@ -29,13 +29,13 @@ import java.io.StringWriter;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.List;
-import java.util.Set;
 
 import javax.ws.rs.core.Response;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 import org.apache.syncope.common.report.UserReportletConf;
+import org.apache.syncope.common.services.ReportletConfClasses;
 import org.apache.syncope.common.to.ReportExecTO;
 import org.apache.syncope.common.to.ReportTO;
 import org.junit.FixMethodOrder;
@@ -55,9 +55,9 @@ public class ReportTestITCase extends Ab
 
     @Test
     public void getReportletClasses() {
-        Set<String> reportletClasses = reportService.getReportletConfClasses();
+        ReportletConfClasses reportletClasses = reportService.getReportletConfClasses();
         assertNotNull(reportletClasses);
-        assertFalse(reportletClasses.isEmpty());
+        assertFalse(reportletClasses.getConfClasses().isEmpty());
     }
 
     @Test