X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fdata%2Fsp%2FSpResponses.java;h=b5bb18c8dbea428a4cda01ef23cf93b14126dd2c;hb=67c31a7381c986cb0473f2cc18cd0ade946a7e4e;hp=db58ca9c2d952da34e91df688e696ac7f258b611;hpb=056883036f0be0d1bf0a06d0f5842d382239adf9;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/SpResponses.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/SpResponses.java index db58ca9..b5bb18c 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/SpResponses.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/SpResponses.java @@ -1,9 +1,64 @@ package com.indexdata.mkjsf.pazpar2.data.sp; -public class SpResponses { +import java.io.Serializable; - public SpResponses() { - // TODO Auto-generated constructor stub +import com.indexdata.mkjsf.pazpar2.data.Responses; + +public class SpResponses implements Serializable { + + private static final long serialVersionUID = -3831357590639961167L; + private Responses responses = null; + + public SpResponses(Responses responses) { + this.responses = responses; + } + + /** + * Resets all responses from the search request to any request + * that can follow search (i.e. show and bytarget but not init or auth) + * @param includePazpar2Responses Set to true if the invocation should + * reset Pazpar2 responses + * (non-SP-specific responses) as well. + */ + public void resetSearchAndBeyond(boolean includePazpar2Responses) { + if (includePazpar2Responses) { + responses.resetSearchAndBeyond(); + } + } + + /** + * Resets all responses from the init request to any request + * that can follow init (i.e. search and show but not auth) + * @param includePazpar2Responses Set to true if the invocation should + * reset Pazpar2 responses + * (non-SP-specific responses) as well. + */ + public void resetInitAndBeyond (boolean includePazpar2Responses) { + responses.put("categories", new CategoriesResponse()); + if (includePazpar2Responses) { + responses.resetInitAndBeyond(); + } + resetSearchAndBeyond(includePazpar2Responses); + } + + /** + * Resets all responses from the authentication request to any request + * that can follow authentication. + * @param includePazpar2Responses Set to true if the invocation should + * reset Pazpar2 responses + * (non-SP-specific responses) as well. + */ + public void resetAuthAndBeyond (boolean includePazpar2Responses) { + responses.put("auth", new AuthResponse()); + resetInitAndBeyond(includePazpar2Responses); + } + + public AuthResponse getAuth () { + return ((AuthResponse) responses.getResponseObject("auth")); + } + + public CategoriesResponse getCategories() { + return ((CategoriesResponse) responses.getResponseObject("categories")); } }