X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fdata%2FResponses.java;h=5d0fb75ac55c352fadb560adee7a3f17f65560a9;hb=HEAD;hp=ef6526b1a9b0ff3148b51586cedf150dce37754f;hpb=ff74a02127ad0f4129a89a20fd057e28f30767ea;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java index ef6526b..5d0fb75 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Responses.java @@ -20,7 +20,13 @@ import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject; import com.indexdata.mkjsf.pazpar2.data.sp.SpResponses; import com.indexdata.mkjsf.utils.Utils; -@Named("pzresp") @SessionScoped +/** + * Provides references to all current data objects and has general methods for clearing certain response data. + * + * @author Niels Erik + * + */ +@SessionScoped @Named public class Responses implements Serializable { private static final long serialVersionUID = -7543231258346154642L; @@ -81,19 +87,28 @@ public class Responses implements Serializable { return error; } + /** + * Empties all data objects populated after a search (including the search response itself) + * + */ public void resetSearchAndBeyond() { logger.debug("Resetting show,stat,termlist,bytarget,record,search response objects."); dataObjects.put("show", new ShowResponse()); dataObjects.put("stat", new StatResponse()); dataObjects.put("termlist", new TermListsResponse()); - dataObjects.put("bytarget", new ByTarget()); + dataObjects.put("bytarget", new ByTargetResponse()); dataObjects.put("record", new RecordResponse()); dataObjects.put("search", new SearchResponse()); getSp().resetSearchAndBeyond(false); } + /** + * Empties all data objects populated after a service was initialized, including the init response itself + * but excluding a possible auth response + */ public void resetInitAndBeyond () { - dataObjects.put("init", new InitResponse()); + dataObjects.put("init", new InitResponse()); + dataObjects.put("info", new InfoResponse()); resetSearchAndBeyond(); getSp().resetInitAndBeyond(false); } @@ -130,8 +145,12 @@ public class Responses implements Serializable { return (getTermLists().getTermList(facet).getTerms()); } - public ByTarget getByTarget() { - return ((ByTarget) dataObjects.get("bytarget")); + public ByTargetResponse getByTarget() { + return ((ByTargetResponse) dataObjects.get("bytarget")); + } + + public InfoResponse getInfo() { + return ((InfoResponse) dataObjects.get("info")); } public ResponseDataObject getResponseObject (String name) {