summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Padgett2011-11-10 18:53:07 (EST)
committer Michael Fiedler2011-11-10 18:53:07 (EST)
commit97ffbcc05a36a7ef9c9dd468dba5b8f0365c02fa (patch)
treefa4459e570317c2650276432700087e21afd2ce8
parentc71396bc6b9636e1c9f5bd4ba64c800430debaac (diff)
downloadorg.eclipse.lyo.server-97ffbcc05a36a7ef9c9dd468dba5b8f0365c02fa.zip
org.eclipse.lyo.server-97ffbcc05a36a7ef9c9dd468dba5b8f0365c02fa.tar.gz
org.eclipse.lyo.server-97ffbcc05a36a7ef9c9dd468dba5b8f0365c02fa.tar.bz2
Bug 363339 - Bugzilla adapter gives back invalid XML for query responses
Conflicts: org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java14
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/resources/QueryResult.java52
2 files changed, 57 insertions, 9 deletions
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
index f07d33f..a786bf3 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
@@ -41,7 +41,7 @@ import org.eclipse.lyo.samples.bugzilla.jbugzx.rpc.ExtendedBugSearch;
import org.eclipse.lyo.samples.bugzilla.jbugzx.rpc.GetProducts;
import org.eclipse.lyo.samples.bugzilla.resources.BugzillaChangeRequest;
import org.eclipse.lyo.samples.bugzilla.resources.Person;
-import org.eclipse.lyo.samples.bugzilla.resources.QueryResponse;
+import org.eclipse.lyo.samples.bugzilla.resources.QueryResult;
import org.eclipse.lyo.samples.bugzilla.resources.ResponseInfo;
import org.eclipse.lyo.samples.bugzilla.utils.AcceptType;
import org.eclipse.lyo.samples.bugzilla.utils.RdfUtils;
@@ -199,14 +199,10 @@ public class ChangeRequestCollectionService extends HttpServlet {
responseInfo.setNextPage(new URI(URLStrategy
.getChangeRequestCollectionURL(product.getId())
+ "&oslc.paging=true&page=" + (page + 1)));
- responseInfo.setUri(new URI(request.getRequestURL().append('?')
- .append(request.getQueryString()).toString()));
-
- QueryResponse queryResult = new QueryResponse();
- // This must match the query capability base.
- queryResult.setUri(new URI(request.getRequestURL()
- .append("?productId=").append(product.getId())
- .toString()));
+ responseInfo.setUri(new URI(request.getRequestURL().append(request.getQueryString()).toString()));
+
+ QueryResult queryResult = new QueryResult();
+ queryResult.setUri(new URI(request.getRequestURL().toString()));
for (Bug bug : results) {
BugzillaChangeRequest changeRequest = BugzillaChangeRequest.fromBug(bug);
queryResult.getMembers().add(changeRequest);
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/resources/QueryResult.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/resources/QueryResult.java
new file mode 100644
index 0000000..85cdd02
--- /dev/null
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/resources/QueryResult.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.samples.bugzilla.resources;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import thewebsemantic.Id;
+import thewebsemantic.Namespace;
+import thewebsemantic.RdfProperty;
+import thewebsemantic.RdfType;
+
+/**
+ * An OSLC query response.
+ *
+ * @author Samuel Padgett <spadgett@us.ibm.com>
+ */
+@Namespace("http://www.w3.org/2000/01/rdf-schema#")
+@RdfType("Description")
+public class QueryResult {
+ @Id
+ private URI uri;
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ @RdfProperty("http://www.w3.org/2000/01/rdf-schema#member")
+ private Collection<ChangeRequest> members = new ArrayList<ChangeRequest>();
+
+ public Collection<ChangeRequest> getMembers() {
+ return members;
+ }
+}