summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremah2013-03-27 15:27:48 (EDT)
committer emah2013-03-27 15:27:48 (EDT)
commitb001624e3983bf2bf7145ca33a65c74408de1498 (patch)
treebe20c224d441022d1b3f7f9ea00c0a6a1aa01e63
parent1f0d789b72f1ca6ca309177bb8ca67e0bfb04e4c (diff)
downloadorg.eclipse.lyo.rio-b001624e3983bf2bf7145ca33a65c74408de1498.zip
org.eclipse.lyo.rio-b001624e3983bf2bf7145ca33a65c74408de1498.tar.gz
org.eclipse.lyo.rio-b001624e3983bf2bf7145ca33a65c74408de1498.tar.bz2
Bug 404484 - BaseResource should return a single Base object rather thanrefs/changes/34/11534/1
a list of objects - Return 'Base' instead of List<Base> from the two rest endpoints - Cleaned up the imports Change-Id: I7f8ebca4e32e75445d1be5b97082548ef23e038c Signed-off-by: emah <ernest@ca.ibm.com>
-rw-r--r--org.eclipse.lyo.rio.trs/src/main/java/org/eclipse/lyo/rio/trs/resources/BaseResource.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/org.eclipse.lyo.rio.trs/src/main/java/org/eclipse/lyo/rio/trs/resources/BaseResource.java b/org.eclipse.lyo.rio.trs/src/main/java/org/eclipse/lyo/rio/trs/resources/BaseResource.java
index e3f1e81..b78a93a 100644
--- a/org.eclipse.lyo.rio.trs/src/main/java/org/eclipse/lyo/rio/trs/resources/BaseResource.java
+++ b/org.eclipse.lyo.rio.trs/src/main/java/org/eclipse/lyo/rio/trs/resources/BaseResource.java
@@ -18,8 +18,6 @@ package org.eclipse.lyo.rio.trs.resources;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -34,9 +32,9 @@ import javax.ws.rs.core.UriInfo;
import org.apache.wink.common.annotations.Workspace;
import org.eclipse.lyo.core.trs.Base;
+import org.eclipse.lyo.core.trs.TRSConstants;
import org.eclipse.lyo.oslc4j.core.annotation.OslcService;
import org.eclipse.lyo.rio.trs.util.TRSUtil;
-import org.eclipse.lyo.core.trs.TRSConstants;
/**
* RESTful service endpoints for returning the Base of a Tracked Resource Set in pages.
@@ -75,7 +73,7 @@ public class BaseResource {
*/
@GET
@Produces({ "application/rdf+xml", MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public List<Base> getBase() throws URISyntaxException{
+ public Base getBase() throws URISyntaxException{
URI requestURI = uriInfo.getRequestUri();
boolean endsWithSlash = requestURI.getPath().endsWith("/");
@@ -90,7 +88,7 @@ public class BaseResource {
@GET
@Path("{page}")
@Produces({ "application/rdf+xml", MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public List<Base> getBasePage(@PathParam("page")Long page) throws URISyntaxException{
+ public Base getBasePage(@PathParam("page")Long page) throws URISyntaxException{
TRSUtil.updateTRSResourceURI(uriInfo.getBaseUri());
// from uri find out which Inner container to access...
@@ -99,8 +97,6 @@ public class BaseResource {
if (TRSUtil.getTrsBase(requestURI).isEmpty() || !TRSUtil.getTrsBase(requestURI).containsKey(page))
throw new WebApplicationException(Status.NOT_FOUND);
- List<Base> results = new ArrayList<Base>();
- results.add(TRSUtil.getTrsBase(requestURI).get(page));
- return results;
+ return TRSUtil.getTrsBase(requestURI).get(page);
}
}