1 package org.kuali.ole.sip2.requestParser;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.ole.sip2.constants.OLESIP2Constants;
5
6
7
8
9 public class OLESIP2PatronInformationRequestParser extends OLESIP2RequestParser {
10
11 private String language;
12 private String summary;
13 private String startItem;
14 private String endItem;
15
16 private static final Logger LOG = Logger.getLogger(OLESIP2PatronInformationRequestParser.class);
17
18
19 public OLESIP2PatronInformationRequestParser(String requestData) {
20 this.parsePatronInformationRequest(requestData);
21 }
22
23
24 public void parsePatronInformationRequest(String requestData) {
25
26 LOG.info("Entry OLESIP2PatronInformationRequestParser.parsePatronInformation(String requestData)");
27
28 String[] requestDataArray = requestData.split("\\|");
29 for (String data : requestDataArray) {
30 LOG.info(data);
31 if (data.startsWith(OLESIP2Constants.PATRON_INFORMATION_REQUEST)) {
32 code = data.substring(0, 2);
33 language = data.substring(2, 5);
34 transactionDate = data.substring(5, 23);
35 summary = data.substring(23, 33);
36 institutionId = data.substring(35);
37 }
38 if (data.startsWith(OLESIP2Constants.PATRON_IDENTIFIER_CODE)) {
39 patronIdentifier = (data.replaceFirst(OLESIP2Constants.PATRON_IDENTIFIER_CODE, "")).trim();
40 }
41 if (data.startsWith(OLESIP2Constants.TERMINAL_PWD_CODE)) {
42 terminalPassword = (data.replaceFirst(OLESIP2Constants.TERMINAL_PWD_CODE, "")).trim();
43 }
44 if (data.startsWith(OLESIP2Constants.PATRON_PWD_CODE)) {
45 patronPassword = (data.replaceFirst(OLESIP2Constants.PATRON_PWD_CODE, "")).trim();
46 }
47 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
48 sequenceNum = data.substring(2, 5);
49 checkSum = data.substring(5);
50 }
51 }
52 LOG.info("Exit OLESIP2PatronInformationRequestParser.parsePatronInformation(String requestData)");
53 }
54
55
56 public String getLanguage() {
57 return language;
58 }
59
60 public void setLanguage(String language) {
61 this.language = language;
62 }
63
64 public String getSummary() {
65 return summary;
66 }
67
68 public void setSummary(String summary) {
69 this.summary = summary;
70 }
71
72 public String getStartItem() {
73 return startItem;
74 }
75
76 public void setStartItem(String startItem) {
77 this.startItem = startItem;
78 }
79
80 public String getEndItem() {
81 return endItem;
82 }
83
84 public void setEndItem(String endItem) {
85 this.endItem = endItem;
86 }
87 }