From 8adf7eecfbcb98af079f4f2d129a1f76b146aefc Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 9 May 2013 09:54:46 -0400 Subject: [PATCH] Renames data classes that are no longer pz2 only .. to reflect that they handle SP-only responses too --- .../com/indexdata/mkjsf/controls/ResultsPager.java | 8 +- .../com/indexdata/mkjsf/errors/ErrorCentral.java | 4 +- .../java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java | 12 +- .../mkjsf/pazpar2/ServiceProxyExtensions.java | 4 +- .../com/indexdata/mkjsf/pazpar2/data/ByTarget.java | 6 +- .../indexdata/mkjsf/pazpar2/data/CommandError.java | 8 +- .../java/com/indexdata/mkjsf/pazpar2/data/Hit.java | 6 +- .../indexdata/mkjsf/pazpar2/data/InitResponse.java | 2 +- .../com/indexdata/mkjsf/pazpar2/data/Location.java | 8 +- .../indexdata/mkjsf/pazpar2/data/Pazpar2Error.java | 2 +- .../mkjsf/pazpar2/data/Pazpar2ResponseData.java | 124 -------------- .../mkjsf/pazpar2/data/Pazpar2ResponseParser.java | 169 -------------------- .../mkjsf/pazpar2/data/Pazpar2Responses.java | 139 ---------------- .../mkjsf/pazpar2/data/RecordOffsetResponse.java | 2 +- .../mkjsf/pazpar2/data/RecordResponse.java | 8 +- .../mkjsf/pazpar2/data/ResponseDataObject.java | 124 ++++++++++++++ .../mkjsf/pazpar2/data/ResponseParser.java | 169 ++++++++++++++++++++ .../indexdata/mkjsf/pazpar2/data/Responses.java | 139 ++++++++++++++++ .../mkjsf/pazpar2/data/SearchResponse.java | 2 +- .../indexdata/mkjsf/pazpar2/data/ShowResponse.java | 6 +- .../indexdata/mkjsf/pazpar2/data/StatResponse.java | 4 +- .../com/indexdata/mkjsf/pazpar2/data/Target.java | 4 +- .../mkjsf/pazpar2/data/TermListResponse.java | 4 +- .../mkjsf/pazpar2/data/TermListsResponse.java | 4 +- .../indexdata/mkjsf/pazpar2/data/TermResponse.java | 4 +- 25 files changed, 481 insertions(+), 481 deletions(-) delete mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseData.java delete mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseParser.java delete mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Responses.java create mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java create mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseParser.java create mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java diff --git a/src/main/java/com/indexdata/mkjsf/controls/ResultsPager.java b/src/main/java/com/indexdata/mkjsf/controls/ResultsPager.java index 3825d1e..951e8d4 100644 --- a/src/main/java/com/indexdata/mkjsf/controls/ResultsPager.java +++ b/src/main/java/com/indexdata/mkjsf/controls/ResultsPager.java @@ -5,20 +5,20 @@ import java.util.ArrayList; import java.util.List; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Commands; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2Responses; +import com.indexdata.mkjsf.pazpar2.data.Responses; public class ResultsPager implements Serializable { private static final long serialVersionUID = 8854795222615583071L; - private Pazpar2Responses data = null; + private Responses data = null; private int pageRangeLength = 13; private Pazpar2Commands req; - public ResultsPager(Pazpar2Responses data) { + public ResultsPager(Responses data) { this.data = data; } - public ResultsPager(Pazpar2Responses data, int pageRange, Pazpar2Commands req) { + public ResultsPager(Responses data, int pageRange, Pazpar2Commands req) { this.data = data; this.pageRangeLength = pageRange; this.req = req; diff --git a/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java b/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java index 5a0875f..499fad8 100644 --- a/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java +++ b/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java @@ -12,7 +12,7 @@ import javax.inject.Named; import org.apache.log4j.Logger; import com.indexdata.mkjsf.config.ConfigurationReader; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2Responses; +import com.indexdata.mkjsf.pazpar2.data.Responses; @Named("errors") @SessionScoped public class ErrorCentral implements Serializable { @@ -21,7 +21,7 @@ public class ErrorCentral implements Serializable { private static Logger logger = Logger.getLogger(ErrorCentral.class); private ErrorHelper errorHelper = null; - @Inject Pazpar2Responses pzresp; + @Inject Responses pzresp; @Inject ConfigurationReader configurator; private List configurationErrors = new ArrayList(); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java index 1ca0709..ca6dc9e 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java @@ -25,9 +25,9 @@ import com.indexdata.mkjsf.errors.ErrorCentral; import com.indexdata.mkjsf.errors.ErrorHelper; import com.indexdata.mkjsf.pazpar2.commands.CommandParameter; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Commands; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseParser; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2Responses; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; +import com.indexdata.mkjsf.pazpar2.data.ResponseParser; +import com.indexdata.mkjsf.pazpar2.data.Responses; import com.indexdata.mkjsf.pazpar2.data.RecordResponse; import com.indexdata.mkjsf.pazpar2.sp.auth.ServiceProxyUser; import com.indexdata.mkjsf.pazpar2.state.StateListener; @@ -58,7 +58,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria @Inject ConfigurationReader configurator; @Inject StateManager stateMgr; @Inject Pazpar2Commands pzreq; - @Inject Pazpar2Responses pzresp; + @Inject Responses pzresp; @Inject ErrorCentral errors; @Inject ServiceProxyUser user; @@ -164,8 +164,8 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria String commandName = thread.getCommand().getCommandName(); HttpResponseWrapper response = thread.getCommandResponse(); responseLogger.debug("Response was: " + response.getResponseString()); - Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response.getResponseString()); - if (Pazpar2ResponseParser.docTypes.contains(responseObject.getType())) { + ResponseDataObject responseObject = ResponseParser.getParser().getDataObject(response.getResponseString()); + if (ResponseParser.docTypes.contains(responseObject.getType())) { pzresp.put(commandName, responseObject); } else { if (commandName.equals("record") && diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java index 04343c3..c5b93ea 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java @@ -13,7 +13,7 @@ import org.apache.log4j.Logger; import com.indexdata.mkjsf.config.ConfigurationReader; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Commands; import com.indexdata.mkjsf.pazpar2.commands.sp.InitDocUpload; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2Responses; +import com.indexdata.mkjsf.pazpar2.data.Responses; import com.indexdata.mkjsf.pazpar2.sp.auth.ServiceProxyUser; @Named("pz2x") @SessionScoped @@ -29,7 +29,7 @@ public class ServiceProxyExtensions implements ServiceProxyInterface, Serializa @Inject ServiceProxyUser user; @Inject Pz2Bean pz2; @Inject Pazpar2Commands pzreq; - @Inject Pazpar2Responses pzresp; + @Inject Responses pzresp; public ServiceProxyExtensions() { diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java index e684f9e..b98bf1a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java @@ -3,17 +3,17 @@ package com.indexdata.mkjsf.pazpar2.data; import java.util.ArrayList; import java.util.List; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; import com.indexdata.mkjsf.pazpar2.data.Target; -public class ByTarget extends Pazpar2ResponseData { +public class ByTarget extends ResponseDataObject { private static final long serialVersionUID = 3960644950805644518L; public List getTargets() { List targets = new ArrayList(); if (getElements("target") != null) { - for (Pazpar2ResponseData element : getElements("target")) { + for (ResponseDataObject element : getElements("target")) { targets.add((Target)element); } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java index c8f9e2d..e3fd7b7 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java @@ -19,13 +19,13 @@ import com.indexdata.utils.XmlUtils; * in a new 'applicationerror' element which in turn will be embedded in a * command XML (i.e. a 'search' or a 'show' response XML) * - * The command response XML is subsequently parsed by Pazpar2ResponseParser, + * The command response XML is subsequently parsed by ResponseParser, * which will then create the CommandError object. * * @author Niels Erik * */ -public class CommandError extends Pazpar2ResponseData implements ErrorInterface { +public class CommandError extends ResponseDataObject implements ErrorInterface { private static final long serialVersionUID = 8878776025779714122L; private static Pattern xmlDeclaration = Pattern.compile("<\\?xml.*\\?>"); @@ -64,7 +64,7 @@ public class CommandError extends Pazpar2ResponseData implements ErrorInterface /** * Creates an XML string error message, embedded in an XML string document named by the command - * This is the XML that Pazpar2ResponseParser will turn into a CommandError object. + * This is the XML that ResponseParser will turn into a CommandError object. * @param commandName * @param exceptionName * @param errorMessage @@ -85,7 +85,7 @@ public class CommandError extends Pazpar2ResponseData implements ErrorInterface /** * Embeds a Pazpar2 (or Pazpar2 client) error response document as a child element of * a command response document (like 'search' or 'show'). - * This is the XML that Pazpar2ResponseParser will turn into a CommandError object. + * This is the XML that ResponseParser will turn into a CommandError object. * * * @param commandName The name of the command during which's execution the error was encountered diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Hit.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Hit.java index 8f16eee..df184b6 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Hit.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Hit.java @@ -4,16 +4,16 @@ import java.util.ArrayList; import java.util.List; import com.indexdata.mkjsf.pazpar2.data.Location; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class Hit extends Pazpar2ResponseData { +public class Hit extends ResponseDataObject { private static final long serialVersionUID = 9039281987691623220L; public List getLocations() { List locations = new ArrayList(); - for (Pazpar2ResponseData element : getElements("location")) { + for (ResponseDataObject element : getElements("location")) { locations.add((Location)element); } return locations; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java index 5563141..6438f9a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java @@ -1,6 +1,6 @@ package com.indexdata.mkjsf.pazpar2.data; -public class InitResponse extends Pazpar2ResponseData { +public class InitResponse extends ResponseDataObject { private static final long serialVersionUID = -1479775157276901600L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java index 1dcb6c3..b66b717 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java @@ -1,9 +1,9 @@ package com.indexdata.mkjsf.pazpar2.data; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class Location extends Pazpar2ResponseData { +public class Location extends ResponseDataObject { private static final long serialVersionUID = -1386527442857478225L; private int seqno = -1; @@ -35,7 +35,7 @@ public class Location extends Pazpar2ResponseData { public String getSubjects() { StringBuilder builder = new StringBuilder(""); - for (Pazpar2ResponseData data : getElements("md-subject")) { + for (ResponseDataObject data : getElements("md-subject")) { if (builder.length()==0) { builder.append(data.getValue()); } else { @@ -53,7 +53,7 @@ public class Location extends Pazpar2ResponseData { public String getAuthors() { StringBuilder builder = new StringBuilder(""); if (getElements("md-author") != null) { - for (Pazpar2ResponseData data : getElements("md-author")) { + for (ResponseDataObject data : getElements("md-author")) { if (builder.length()==0) { builder.append(data.getValue()); } else { diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Error.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Error.java index 76a54f3..b46cb8b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Error.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Error.java @@ -1,6 +1,6 @@ package com.indexdata.mkjsf.pazpar2.data; -public class Pazpar2Error extends Pazpar2ResponseData { +public class Pazpar2Error extends ResponseDataObject { private static final long serialVersionUID = -7060267782024414318L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseData.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseData.java deleted file mode 100644 index 10451ea..0000000 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseData.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.indexdata.mkjsf.pazpar2.data; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.apache.log4j.Logger; - -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; - -public class Pazpar2ResponseData implements Serializable { - - Logger logger = Logger.getLogger(Pazpar2ResponseData.class); - private static final long serialVersionUID = -3909755656714679959L; - String type = null; - HashMap attributes = new HashMap(); - HashMap> elements = new HashMap>(); - String textContent = ""; - CommandError error = null; - String xml = null; - - public void setType (String type) { - this.type = type; - } - - public String getType () { - return type; - } - - public void setAttribute (String name, String value) { - attributes.put(name, value); - } - - public String getAttribute (String name) { - return attributes.get(name); - } - - public void addElement (String name, Pazpar2ResponseData value) { - if (elements.containsKey(name)) { - elements.get(name).add(value); - } else { - List list = new ArrayList(); - list.add(value); - elements.put(name,list); - } - } - - public List getElements (String name) { - return elements.get(name); - } - - public Pazpar2ResponseData getOneElement (String name) { - if (elements.get(name) != null) { - return elements.get(name).get(0); - } else { - return null; - } - } - - /** - * Returns the text content of the first element found with the given - * name - * @param name of the element - * @return text value, empty string if none found - */ - public String getOneElementValue (String name) { - if (getOneElement(name)!=null && getOneElement(name).getValue().length()>0) { - return getOneElement(name).getValue(); - } else { - return ""; - } - } - - public void appendContent (String content) { - textContent = textContent + content; - } - - public String getValue () { - return textContent; - } - - public String getProperty(String name) { - List els = elements.get(name); - if (els != null) { - return els.get(0).getValue(); - } else { - return null; - } - } - - public int getIntValue(String name) { - String val = getOneElementValue(name); - if (val.length()==0) { - return 0; - } else { - return Integer.parseInt(val); - } - } - - public boolean hasApplicationError () { - return (getOneElement("applicationerror") != null); - } - - public CommandError getApplicationError() { - return (CommandError) getOneElement("applicationerror"); - } - - public boolean hasPazpar2Error() { - return hasApplicationError() && getApplicationError().hasPazpar2Error(); - } - - public void setXml(String xml) { - this.xml = xml; - } - - public String getXml() { - if (type != null && type.equals("record")) { - logger.debug("Getting XML for "+type + ": "+xml); - } - return xml == null ? "" : xml; - } - -} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseParser.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseParser.java deleted file mode 100644 index 3bff69a..0000000 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2ResponseParser.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.indexdata.mkjsf.pazpar2.data; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.List; -import java.util.Stack; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.log4j.Logger; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; - -import com.indexdata.mkjsf.pazpar2.data.ByTarget; -import com.indexdata.mkjsf.pazpar2.data.Hit; -import com.indexdata.mkjsf.pazpar2.data.Location; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; -import com.indexdata.mkjsf.pazpar2.data.RecordResponse; -import com.indexdata.mkjsf.pazpar2.data.ShowResponse; -import com.indexdata.mkjsf.pazpar2.data.StatResponse; -import com.indexdata.mkjsf.pazpar2.data.Target; -import com.indexdata.mkjsf.pazpar2.data.TermListResponse; -import com.indexdata.mkjsf.pazpar2.data.TermListsResponse; -import com.indexdata.mkjsf.pazpar2.data.TermResponse; -import com.indexdata.mkjsf.pazpar2.data.TermXTargetResponse; - -public class Pazpar2ResponseParser extends DefaultHandler { - - private XMLReader xmlReader = null; - private Pazpar2ResponseData currentElement = null; - private Stack dataElements = new Stack(); - private Pazpar2ResponseData result = null; - private String xml = null; - private static Logger logger = Logger.getLogger(Pazpar2ResponseParser.class); - - public static final List docTypes = - Arrays.asList("bytarget","termlist","show","stat","record","search"); - - public Pazpar2ResponseParser() { - try { - initSax(); - } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public static Pazpar2ResponseParser getParser() { - return new Pazpar2ResponseParser(); - } - - private void initSax() throws ParserConfigurationException, SAXException { - SAXParserFactory spf = SAXParserFactory.newInstance(); - spf.setNamespaceAware(true); - SAXParser saxParser = spf.newSAXParser(); - xmlReader = saxParser.getXMLReader(); - xmlReader.setContentHandler(this); - } - - /** - * Parses a Pazpar2 XML response -- or an error response as XML -- and produces a - * Pazpar2ResponseData object, i.e. a 'show' object - * - * @param response XML response string from Pazpar2 - * @return Response data object - */ - public Pazpar2ResponseData getDataObject (String response) { - this.xml = response; - try { - xmlReader.parse(new InputSource(new ByteArrayInputStream(response.getBytes("UTF-8")))); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return result; - } - - /** - * Receive notification at the start of element - * - */ - @Override - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - if (localName.equals("show")) { - currentElement = new ShowResponse(); - } else if (localName.equals("hit")) { - currentElement = new Hit(); - } else if (localName.equals("location")) { - currentElement = new Location(); - } else if (localName.equals("bytarget")) { - currentElement = new ByTarget(); - } else if (localName.equals("target")) { - currentElement = new Target(); - } else if (localName.equals("stat")) { - currentElement = new StatResponse(); - } else if (localName.equals("termlist")) { - currentElement = new TermListsResponse(); - } else if (localName.equals("list")) { - currentElement = new TermListResponse(); - ((TermListResponse)currentElement).setName(atts.getValue("name")); - ((TermListsResponse)dataElements.peek()).addTermList((TermListResponse)currentElement); - } else if (localName.equals("term")) { - if (dataElements.peek().getAttribute("name").equals("xtargets")) { - currentElement = new TermXTargetResponse(); - } else { - currentElement = new TermResponse(); - } - ((TermListResponse)dataElements.peek()).addTerm((TermResponse)currentElement); - } else if (localName.equals("record")) { - currentElement = new RecordResponse(); - } else if (localName.equals("search")) { - currentElement = new SearchResponse(); - } else if (localName.equals("applicationerror")) { - currentElement = new CommandError(); - } else if (localName.equals("error") && dataElements.peek().getType().equals("applicationerror")) { - currentElement = new Pazpar2Error(); - } else { - currentElement = new Pazpar2ResponseData(); - } - currentElement.setType(localName); - for (int i=0; i< atts.getLength(); i++) { - currentElement.setAttribute(atts.getLocalName(i), atts.getValue(i)); - } - if (!docTypes.contains(localName)) { - if (dataElements.size() == 0) { - logger.info("Encountered unknown top level element [" + localName + "]. Creating generic data object."); - currentElement.setType(localName); - } else { - dataElements.peek().addElement(localName, currentElement); - } - } - if (this.xml != null) { // Store XML for doc level elements - currentElement.setXml(xml); - xml = null; - } - dataElements.push(currentElement); - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - String data = new String(ch, start, length); - dataElements.peek().appendContent(data); - } - - @Override - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - if (dataElements.size()==1) { - result = dataElements.pop(); - } else { - dataElements.pop(); - } - } -} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Responses.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Responses.java deleted file mode 100644 index 600754f..0000000 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Pazpar2Responses.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.indexdata.mkjsf.pazpar2.data; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.enterprise.context.SessionScoped; -import javax.inject.Named; - -import org.apache.log4j.Logger; - -import com.indexdata.mkjsf.errors.ErrorHelper; -import com.indexdata.mkjsf.errors.ErrorInterface; -import com.indexdata.mkjsf.pazpar2.data.sp.SpResponses; - -@Named("pzresp") @SessionScoped -public class Pazpar2Responses implements Serializable { - - private static final long serialVersionUID = -7543231258346154642L; - protected Map dataObjects = new ConcurrentHashMap(); - private static Logger logger = Logger.getLogger(Pazpar2Responses.class); - private ErrorHelper errorHelper = null; - - public Pazpar2Responses() { - } - - public void put(String name, Pazpar2ResponseData responseData) { - dataObjects.put(name, responseData); - } - - public void setErrorHelper(ErrorHelper helper) { - this.errorHelper = helper; - } - - public boolean hasApplicationError () { - if (getSearch().hasApplicationError()) { - logger.info("Error detected in search"); - return true; - } - for (String name : dataObjects.keySet()) { - if (dataObjects.get(name).hasApplicationError()) { - logger.info("Error detected in " + name); - return true; - } - } - return false; - } - - /** - * Returns a search command error, if any, otherwise the first - * error found for an arbitrary command, if any, otherwise - * an empty dummy error. - */ - public ErrorInterface getCommandError() { - CommandError error = new CommandError(); - if (dataObjects.get("search").hasApplicationError()) { - error = dataObjects.get("search").getApplicationError(); - error.setErrorHelper(errorHelper); - } else { - for (String name : dataObjects.keySet()) { - if (dataObjects.get(name).hasApplicationError()) { - error = dataObjects.get(name).getApplicationError(); - error.setErrorHelper(errorHelper); - break; - } - } - } - return error; - } - - public void reset() { - logger.debug("Resetting show,stat,termlist,bytarget,search response objects."); - dataObjects = new ConcurrentHashMap(); - dataObjects.put("show", new ShowResponse()); - dataObjects.put("stat", new StatResponse()); - dataObjects.put("termlist", new TermListsResponse()); - dataObjects.put("bytarget", new ByTarget()); - dataObjects.put("record", new RecordResponse()); - dataObjects.put("search", new SearchResponse()); - } - - public ShowResponse getShow () { - return ((ShowResponse) dataObjects.get("show")); - } - - public StatResponse getStat () { - return ((StatResponse) dataObjects.get("stat")); - } - - public RecordResponse getRecord() { - return ((RecordResponse) dataObjects.get("record")); - } - - public SearchResponse getSearch() { - return ((SearchResponse) dataObjects.get("search")); - } - - public TermListsResponse getTermLists () { - return ((TermListsResponse) dataObjects.get("termlist")); - } - - public List getFacetTerms (String facet, int count) { - return (getTermLists().getTermList(facet).getTerms(count)); - } - - public List getFacetTerms (String facet) { - return (getTermLists().getTermList(facet).getTerms()); - } - - public ByTarget getByTarget() { - return ((ByTarget) dataObjects.get("bytarget")); - } - - public Pazpar2ResponseData getResponseObject (String name) { - return dataObjects.get(name); - } - - public boolean hasRecords () { - return getStat().getRecords() > 0 - && getShow().getHits() != null - && getShow().getHits().size()>0; - } - - public String getActiveClients() { - if (getShow()!=null) { - logger.debug("Active clients: "+getShow().getActiveClients()); - return getShow().getActiveClients(); - } else { - return ""; - } - } - - public SpResponses getSp() { - // TODO: - return null; - } - -} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java index 8e4ab25..d8920b0 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java @@ -1,6 +1,6 @@ package com.indexdata.mkjsf.pazpar2.data; -public class RecordOffsetResponse extends Pazpar2ResponseData { +public class RecordOffsetResponse extends ResponseDataObject { private static final long serialVersionUID = -601620728296476450L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java index 566ea09..d3607c1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.List; import com.indexdata.mkjsf.pazpar2.data.Location; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class RecordResponse extends Pazpar2ResponseData { +public class RecordResponse extends ResponseDataObject { private static final long serialVersionUID = 6682722004285796002L; @@ -18,7 +18,7 @@ public class RecordResponse extends Pazpar2ResponseData { List locations = new ArrayList(); if (getElements("location")!=null) { int i = 0; - for (Pazpar2ResponseData element : getElements("location")) { + for (ResponseDataObject element : getElements("location")) { ((Location)element).setSequenceNumber(i++); locations.add((Location)element); } @@ -46,7 +46,7 @@ public class RecordResponse extends Pazpar2ResponseData { public String getSubjects() { StringBuilder builder = new StringBuilder(""); - for (Pazpar2ResponseData data : getElements("md-subject")) { + for (ResponseDataObject data : getElements("md-subject")) { if (builder.length()==0) { builder.append(data.getValue()); } else { diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java new file mode 100644 index 0000000..0db67d3 --- /dev/null +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java @@ -0,0 +1,124 @@ +package com.indexdata.mkjsf.pazpar2.data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; + +public class ResponseDataObject implements Serializable { + + Logger logger = Logger.getLogger(ResponseDataObject.class); + private static final long serialVersionUID = -3909755656714679959L; + String type = null; + HashMap attributes = new HashMap(); + HashMap> elements = new HashMap>(); + String textContent = ""; + CommandError error = null; + String xml = null; + + public void setType (String type) { + this.type = type; + } + + public String getType () { + return type; + } + + public void setAttribute (String name, String value) { + attributes.put(name, value); + } + + public String getAttribute (String name) { + return attributes.get(name); + } + + public void addElement (String name, ResponseDataObject value) { + if (elements.containsKey(name)) { + elements.get(name).add(value); + } else { + List list = new ArrayList(); + list.add(value); + elements.put(name,list); + } + } + + public List getElements (String name) { + return elements.get(name); + } + + public ResponseDataObject getOneElement (String name) { + if (elements.get(name) != null) { + return elements.get(name).get(0); + } else { + return null; + } + } + + /** + * Returns the text content of the first element found with the given + * name + * @param name of the element + * @return text value, empty string if none found + */ + public String getOneElementValue (String name) { + if (getOneElement(name)!=null && getOneElement(name).getValue().length()>0) { + return getOneElement(name).getValue(); + } else { + return ""; + } + } + + public void appendContent (String content) { + textContent = textContent + content; + } + + public String getValue () { + return textContent; + } + + public String getProperty(String name) { + List els = elements.get(name); + if (els != null) { + return els.get(0).getValue(); + } else { + return null; + } + } + + public int getIntValue(String name) { + String val = getOneElementValue(name); + if (val.length()==0) { + return 0; + } else { + return Integer.parseInt(val); + } + } + + public boolean hasApplicationError () { + return (getOneElement("applicationerror") != null); + } + + public CommandError getApplicationError() { + return (CommandError) getOneElement("applicationerror"); + } + + public boolean hasPazpar2Error() { + return hasApplicationError() && getApplicationError().hasPazpar2Error(); + } + + public void setXml(String xml) { + this.xml = xml; + } + + public String getXml() { + if (type != null && type.equals("record")) { + logger.debug("Getting XML for "+type + ": "+xml); + } + return xml == null ? "" : xml; + } + +} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseParser.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseParser.java new file mode 100644 index 0000000..9466473 --- /dev/null +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseParser.java @@ -0,0 +1,169 @@ +package com.indexdata.mkjsf.pazpar2.data; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.List; +import java.util.Stack; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.apache.log4j.Logger; +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; + +import com.indexdata.mkjsf.pazpar2.data.ByTarget; +import com.indexdata.mkjsf.pazpar2.data.Hit; +import com.indexdata.mkjsf.pazpar2.data.Location; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; +import com.indexdata.mkjsf.pazpar2.data.RecordResponse; +import com.indexdata.mkjsf.pazpar2.data.ShowResponse; +import com.indexdata.mkjsf.pazpar2.data.StatResponse; +import com.indexdata.mkjsf.pazpar2.data.Target; +import com.indexdata.mkjsf.pazpar2.data.TermListResponse; +import com.indexdata.mkjsf.pazpar2.data.TermListsResponse; +import com.indexdata.mkjsf.pazpar2.data.TermResponse; +import com.indexdata.mkjsf.pazpar2.data.TermXTargetResponse; + +public class ResponseParser extends DefaultHandler { + + private XMLReader xmlReader = null; + private ResponseDataObject currentElement = null; + private Stack dataElements = new Stack(); + private ResponseDataObject result = null; + private String xml = null; + private static Logger logger = Logger.getLogger(ResponseParser.class); + + public static final List docTypes = + Arrays.asList("bytarget","termlist","show","stat","record","search"); + + public ResponseParser() { + try { + initSax(); + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static ResponseParser getParser() { + return new ResponseParser(); + } + + private void initSax() throws ParserConfigurationException, SAXException { + SAXParserFactory spf = SAXParserFactory.newInstance(); + spf.setNamespaceAware(true); + SAXParser saxParser = spf.newSAXParser(); + xmlReader = saxParser.getXMLReader(); + xmlReader.setContentHandler(this); + } + + /** + * Parses a Pazpar2 XML response -- or an error response as XML -- and produces a + * ResponseDataObject object, i.e. a 'show' object + * + * @param response XML response string from Pazpar2 + * @return Response data object + */ + public ResponseDataObject getDataObject (String response) { + this.xml = response; + try { + xmlReader.parse(new InputSource(new ByteArrayInputStream(response.getBytes("UTF-8")))); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return result; + } + + /** + * Receive notification at the start of element + * + */ + @Override + public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { + if (localName.equals("show")) { + currentElement = new ShowResponse(); + } else if (localName.equals("hit")) { + currentElement = new Hit(); + } else if (localName.equals("location")) { + currentElement = new Location(); + } else if (localName.equals("bytarget")) { + currentElement = new ByTarget(); + } else if (localName.equals("target")) { + currentElement = new Target(); + } else if (localName.equals("stat")) { + currentElement = new StatResponse(); + } else if (localName.equals("termlist")) { + currentElement = new TermListsResponse(); + } else if (localName.equals("list")) { + currentElement = new TermListResponse(); + ((TermListResponse)currentElement).setName(atts.getValue("name")); + ((TermListsResponse)dataElements.peek()).addTermList((TermListResponse)currentElement); + } else if (localName.equals("term")) { + if (dataElements.peek().getAttribute("name").equals("xtargets")) { + currentElement = new TermXTargetResponse(); + } else { + currentElement = new TermResponse(); + } + ((TermListResponse)dataElements.peek()).addTerm((TermResponse)currentElement); + } else if (localName.equals("record")) { + currentElement = new RecordResponse(); + } else if (localName.equals("search")) { + currentElement = new SearchResponse(); + } else if (localName.equals("applicationerror")) { + currentElement = new CommandError(); + } else if (localName.equals("error") && dataElements.peek().getType().equals("applicationerror")) { + currentElement = new Pazpar2Error(); + } else { + currentElement = new ResponseDataObject(); + } + currentElement.setType(localName); + for (int i=0; i< atts.getLength(); i++) { + currentElement.setAttribute(atts.getLocalName(i), atts.getValue(i)); + } + if (!docTypes.contains(localName)) { + if (dataElements.size() == 0) { + logger.info("Encountered unknown top level element [" + localName + "]. Creating generic data object."); + currentElement.setType(localName); + } else { + dataElements.peek().addElement(localName, currentElement); + } + } + if (this.xml != null) { // Store XML for doc level elements + currentElement.setXml(xml); + xml = null; + } + dataElements.push(currentElement); + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + String data = new String(ch, start, length); + dataElements.peek().appendContent(data); + } + + @Override + public void endElement(String namespaceURI, String localName, String qName) throws SAXException { + if (dataElements.size()==1) { + result = dataElements.pop(); + } else { + dataElements.pop(); + } + } +} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java new file mode 100644 index 0000000..6f16348 --- /dev/null +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java @@ -0,0 +1,139 @@ +package com.indexdata.mkjsf.pazpar2.data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; + +import org.apache.log4j.Logger; + +import com.indexdata.mkjsf.errors.ErrorHelper; +import com.indexdata.mkjsf.errors.ErrorInterface; +import com.indexdata.mkjsf.pazpar2.data.sp.SpResponses; + +@Named("pzresp") @SessionScoped +public class Responses implements Serializable { + + private static final long serialVersionUID = -7543231258346154642L; + protected Map dataObjects = new ConcurrentHashMap(); + private static Logger logger = Logger.getLogger(Responses.class); + private ErrorHelper errorHelper = null; + + public Responses() { + } + + public void put(String name, ResponseDataObject responseData) { + dataObjects.put(name, responseData); + } + + public void setErrorHelper(ErrorHelper helper) { + this.errorHelper = helper; + } + + public boolean hasApplicationError () { + if (getSearch().hasApplicationError()) { + logger.info("Error detected in search"); + return true; + } + for (String name : dataObjects.keySet()) { + if (dataObjects.get(name).hasApplicationError()) { + logger.info("Error detected in " + name); + return true; + } + } + return false; + } + + /** + * Returns a search command error, if any, otherwise the first + * error found for an arbitrary command, if any, otherwise + * an empty dummy error. + */ + public ErrorInterface getCommandError() { + CommandError error = new CommandError(); + if (dataObjects.get("search").hasApplicationError()) { + error = dataObjects.get("search").getApplicationError(); + error.setErrorHelper(errorHelper); + } else { + for (String name : dataObjects.keySet()) { + if (dataObjects.get(name).hasApplicationError()) { + error = dataObjects.get(name).getApplicationError(); + error.setErrorHelper(errorHelper); + break; + } + } + } + return error; + } + + public void reset() { + logger.debug("Resetting show,stat,termlist,bytarget,search response objects."); + dataObjects = new ConcurrentHashMap(); + dataObjects.put("show", new ShowResponse()); + dataObjects.put("stat", new StatResponse()); + dataObjects.put("termlist", new TermListsResponse()); + dataObjects.put("bytarget", new ByTarget()); + dataObjects.put("record", new RecordResponse()); + dataObjects.put("search", new SearchResponse()); + } + + public ShowResponse getShow () { + return ((ShowResponse) dataObjects.get("show")); + } + + public StatResponse getStat () { + return ((StatResponse) dataObjects.get("stat")); + } + + public RecordResponse getRecord() { + return ((RecordResponse) dataObjects.get("record")); + } + + public SearchResponse getSearch() { + return ((SearchResponse) dataObjects.get("search")); + } + + public TermListsResponse getTermLists () { + return ((TermListsResponse) dataObjects.get("termlist")); + } + + public List getFacetTerms (String facet, int count) { + return (getTermLists().getTermList(facet).getTerms(count)); + } + + public List getFacetTerms (String facet) { + return (getTermLists().getTermList(facet).getTerms()); + } + + public ByTarget getByTarget() { + return ((ByTarget) dataObjects.get("bytarget")); + } + + public ResponseDataObject getResponseObject (String name) { + return dataObjects.get(name); + } + + public boolean hasRecords () { + return getStat().getRecords() > 0 + && getShow().getHits() != null + && getShow().getHits().size()>0; + } + + public String getActiveClients() { + if (getShow()!=null) { + logger.debug("Active clients: "+getShow().getActiveClients()); + return getShow().getActiveClients(); + } else { + return ""; + } + } + + public SpResponses getSp() { + // TODO: + return null; + } + +} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java index 27706af..84b7e0c 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java @@ -1,6 +1,6 @@ package com.indexdata.mkjsf.pazpar2.data; -public class SearchResponse extends Pazpar2ResponseData { +public class SearchResponse extends ResponseDataObject { private static final long serialVersionUID = -3320013021497018972L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java index 066a831..2bf0a92 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.List; import com.indexdata.mkjsf.pazpar2.data.Hit; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class ShowResponse extends Pazpar2ResponseData { +public class ShowResponse extends ResponseDataObject { private static final long serialVersionUID = 7103554232106330370L; @@ -38,7 +38,7 @@ public class ShowResponse extends Pazpar2ResponseData { public List getHits() { List hits = new ArrayList(); if (getElements("hit") != null) { - for (Pazpar2ResponseData element : getElements("hit")) { + for (ResponseDataObject element : getElements("hit")) { hits.add((Hit)element); } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java index 941c0e9..3342c15 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java @@ -1,8 +1,8 @@ package com.indexdata.mkjsf.pazpar2.data; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class StatResponse extends Pazpar2ResponseData { +public class StatResponse extends ResponseDataObject { private static final long serialVersionUID = -6578979787689458761L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java index 59dd6f7..9d5e8fa 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java @@ -1,8 +1,8 @@ package com.indexdata.mkjsf.pazpar2.data; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class Target extends Pazpar2ResponseData { +public class Target extends ResponseDataObject { private static final long serialVersionUID = 3343881183545520108L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java index 4c00a92..b4c4fb3 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java @@ -5,11 +5,11 @@ import java.util.List; import org.apache.log4j.Logger; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; import com.indexdata.mkjsf.pazpar2.data.TermListResponse; import com.indexdata.mkjsf.pazpar2.data.TermResponse; -public class TermListResponse extends Pazpar2ResponseData { +public class TermListResponse extends ResponseDataObject { private static Logger logger = Logger.getLogger(TermListResponse.class); private static final long serialVersionUID = 3838585739723097393L; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java index 8b59291..8558e32 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java @@ -3,10 +3,10 @@ package com.indexdata.mkjsf.pazpar2.data; import java.util.HashMap; import java.util.Map; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; import com.indexdata.mkjsf.pazpar2.data.TermListResponse; -public class TermListsResponse extends Pazpar2ResponseData { +public class TermListsResponse extends ResponseDataObject { private static final long serialVersionUID = -1370643625715834978L; private int activeClients = -1; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java index e4a40cb..9c3ddb1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java @@ -1,8 +1,8 @@ package com.indexdata.mkjsf.pazpar2.data; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2ResponseData; +import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; -public class TermResponse extends Pazpar2ResponseData { +public class TermResponse extends ResponseDataObject { private static final long serialVersionUID = -8323959763575180678L; -- 1.7.10.4