Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WL-1709 Add getters so we can walk the DAIA object in tests.

  • Loading branch information...
commit e7f65ed064d014679643a57b3d8d4094248c4bda 1 parent e9289c8
@buckett buckett authored
View
20 src/main/java/uk/ac/ox/oucs/sirlouie/daia/Available.java
@@ -26,6 +26,26 @@ public void addMesage(Message message) {
messages.add(message);
}
+ public String getService() {
+ return service;
+ }
+
+ public String getHref() {
+ return href;
+ }
+
+ public String getDelay() {
+ return delay;
+ }
+
+ public List<Message> getMessages() {
+ return messages;
+ }
+
+ public String getLimitation() {
+ return limitation;
+ }
+
public void setService(String service) {
this.service=service;
}
View
14 src/main/java/uk/ac/ox/oucs/sirlouie/daia/Department.java
@@ -14,11 +14,17 @@ public Department() {
}
public Department(String id) {
-
this.id=id;
codes=LibraryCodes.getInstance();
}
-
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return codes.get(id);
+ }
public JSONObject toJSON() throws JSONException {
@@ -26,8 +32,8 @@ public JSONObject toJSON() throws JSONException {
if (null != id) {
json.put("id", id);
}
- if (null != codes.get(id)) {
- json.put("content", codes.get(id));
+ if (null != getName()) {
+ json.put("content", getName());
}
return json;
View
16 src/main/java/uk/ac/ox/oucs/sirlouie/daia/Document.java
@@ -29,6 +29,22 @@ public Document(String id, String href) {
this.href = href;
}
+ public String getId() {
+ return id;
+ }
+
+ public String getHref() {
+ return href;
+ }
+
+ public List<Item> getItems() {
+ return items;
+ }
+
+ public List<Message> getErrors() {
+ return errors;
+ }
+
public void addItems(Collection<SearObject> beans) {
if (null == this.href && !beans.isEmpty()) {
View
36 src/main/java/uk/ac/ox/oucs/sirlouie/daia/Item.java
@@ -23,6 +23,42 @@
public Item() {
}
+ public String getId() {
+ return id;
+ }
+
+ public List<Message> getMessages() {
+ return messages;
+ }
+
+ public Department getDepartment() {
+ return department;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public List<Available> getAvailableServices() {
+ return availableServices;
+ }
+
+ public List<UnAvailable> getUnAvailableServices() {
+ return unAvailableServices;
+ }
+
+ public String getStorage() {
+ return storage;
+ }
+
+ public String getLimitation() {
+ return limitation;
+ }
+
+ public String getHref() {
+ return href;
+ }
+
public void addMesage(Message message) {
messages.add(message);
}
View
16 src/main/java/uk/ac/ox/oucs/sirlouie/daia/ResponseBean.java
@@ -12,8 +12,15 @@
import uk.ac.ox.oucs.sirlouie.reply.SearObject;
+/**
+ * This is the container for a DAIA response.
+ *
+ * @see http://www.gbv.de/wikis/cls/DAIA_-_Document_Availability_Information_API
+ *
+ */
public class ResponseBean {
+ // Required
private String id;
private List<Document> documents = new ArrayList<Document>();
private String error;
@@ -29,6 +36,11 @@ public void setError(String message) {
this.error = message;
}
+ /**
+ * This is the method that takes the response of availability and builds a
+ * set of DAIA objects representing it.
+ * @param beans
+ */
public void addSearObjects(Collection<SearObject> beans) {
Document document = new Document(id, null);
document.addItems(beans);
@@ -39,6 +51,10 @@ public void addDocument(Document document) {
documents.add(document);
}
+ public Collection<Document> getDocuments() {
+ return this.documents;
+ }
+
/*
* {
* "version" : "0.5",
View
24 src/main/java/uk/ac/ox/oucs/sirlouie/daia/UnAvailable.java
@@ -19,6 +19,30 @@
public UnAvailable() {
}
+ public String getService() {
+ return service;
+ }
+
+ public String getHref() {
+ return href;
+ }
+
+ public String getExpected() {
+ return expected;
+ }
+
+ public List<Message> getMessages() {
+ return messages;
+ }
+
+ public String getLimitation() {
+ return limitation;
+ }
+
+ public String getQueue() {
+ return queue;
+ }
+
public void addMesage(Message message) {
messages.add(message);
}
Please sign in to comment.
Something went wrong with that request. Please try again.