aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Pitschke2012-07-26 12:51:56 (EDT)
committerMichael Fiedler2012-07-31 08:37:37 (EDT)
commit569834e1d71e52d52147cef4363d77b402bb59df (patch)
treed430f65db7f91df31246715691bbe5ba3548f6b7
parent5ad66ded63074aca26db9234ec3b8881cdecfe22 (diff)
downloadorg.eclipse.lyo.core-569834e1d71e52d52147cef4363d77b402bb59df.zip
org.eclipse.lyo.core-569834e1d71e52d52147cef4363d77b402bb59df.tar.gz
org.eclipse.lyo.core-569834e1d71e52d52147cef4363d77b402bb59df.tar.bz2
Bug 385080: Add Support for oslc.nextPagerefs/changes/81/6981/2
Change-Id: Ib69f46c7723b4c2c27400369e051fd0970094ec8 Signed-off-by: Steve Pitschke <pitschke@us.ibm.com>
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java7
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java10
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java4
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java8
4 files changed, 27 insertions, 2 deletions
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
index ef1fd47..5690fb0 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
@@ -166,11 +165,15 @@ public abstract class AbstractOslcRdfXmlProvider
final Map<String, Object> properties = isClientSide ?
null :
(Map<String, Object>)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_SELECTED_PROPERTIES);
-
+ final String nextPageURI = isClientSide ?
+ null :
+ (String)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE);
+
try
{
final Model model = JenaModelHelper.createJenaModel(descriptionURI,
responseInfoURI,
+ nextPageURI,
objects,
properties);
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
index 61e558b..737deca 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
@@ -96,6 +96,7 @@ import com.hp.hpl.jena.vocabulary.RDFS;
public final class JenaModelHelper
{
private static final String PROPERTY_TOTAL_COUNT = "totalCount";
+ private static final String PROPERTY_NEXT_PAGE = "nextPage";
private static final String RDF_TYPE_URI = OslcConstants.RDF_NAMESPACE + "type";
private static final BaseDatatype RDF_TYPE_XMLLITERAL = new BaseDatatype(OslcConstants.RDF_NAMESPACE + "XMLLiteral");
@@ -125,12 +126,14 @@ public final class JenaModelHelper
{
return createJenaModel(null,
null,
+ null,
objects,
null);
}
static Model createJenaModel(final String descriptionAbout,
final String responseInfoAbout,
+ final String nextPageAbout,
final Object[] objects,
final Map<String, Object> properties)
throws DatatypeConfigurationException,
@@ -156,6 +159,13 @@ public final class JenaModelHelper
responseInfoResource.addProperty(model.createProperty(OslcConstants.OSLC_CORE_NAMESPACE,
PROPERTY_TOTAL_COUNT),
String.valueOf(objects.length));
+
+ if (nextPageAbout != null)
+ {
+ responseInfoResource.addProperty(model.createProperty(OslcConstants.OSLC_CORE_NAMESPACE,
+ PROPERTY_NEXT_PAGE),
+ nextPageAbout);
+ }
}
}
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
index 1d39e4d..57f7e77 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
@@ -136,11 +136,15 @@ public abstract class AbstractOslcRdfJsonProvider
final Map<String, Object> properties = isClientSide ?
null :
(Map<String, Object>)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_SELECTED_PROPERTIES);
+ final String nextPageURI = isClientSide ?
+ null :
+ (String)httpServletRequest.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE);
try
{
jsonObject = JsonHelper.createJSON(descriptionURI,
responseInfoURI,
+ nextPageURI,
objects,
properties);
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
index 826252a..b95489b 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
@@ -90,6 +90,7 @@ final class JsonHelper
private static final String JSON_PROPERTY_SUFFIX_RESPONSE_INFO = "responseInfo";
private static final String JSON_PROPERTY_SUFFIX_RESULTS = "results";
private static final String JSON_PROPERTY_SUFFIX_TOTAL_COUNT = "totalCount";
+ private static final String JSON_PROPERTY_SUFFIX_NEXT_PAGE = "nextPage";
private static final String JSON_PROPERTY_SUFFIX_TYPE = "type";
private static final String RDF_ABOUT_URI = OslcConstants.RDF_NAMESPACE + JSON_PROPERTY_SUFFIX_ABOUT;
@@ -111,6 +112,7 @@ final class JsonHelper
public static JSONObject createJSON(final String descriptionAbout,
final String responseInfoAbout,
+ final String nextPageAbout,
final Object[] objects,
final Map<String, Object> properties)
throws DatatypeConfigurationException,
@@ -177,6 +179,12 @@ final class JsonHelper
responseInfoJSONObject.put(oslcPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_TOTAL_COUNT,
objects.length);
+ if (nextPageAbout != null)
+ {
+ responseInfoJSONObject.put(oslcPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_NEXT_PAGE,
+ nextPageAbout);
+ }
+
final JSONArray responseInfoTypesJSONArray = new JSONArray();
final JSONObject responseInfoTypeJSONObject = new JSONObject();