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 OLESIP2PatronStatusRequestParser extends OLESIP2RequestParser {
10
11 private String language;
12
13 private static final Logger LOG = Logger.getLogger(OLESIP2PatronStatusRequestParser.class);
14
15
16 public OLESIP2PatronStatusRequestParser(String requestData) {
17 this.parsePatronStatusRequest(requestData);
18 }
19
20
21 public void parsePatronStatusRequest(String requestData) {
22
23 LOG.info("Entry OLESIP2PatronStatusRequestParser.parsePatronStatusRequest(String requestData)");
24 String[] requestDataArray = requestData.split("\\|");
25 for (String data : requestDataArray) {
26
27 if (data.startsWith(OLESIP2Constants.PATRON_STATUS_REQUEST)) {
28 code = data.substring(0, 2);
29 language = data.substring(2, 5);
30 transactionDate = data.substring(5, 23);
31 institutionId = data.substring(25);
32 }
33 if (data.startsWith(OLESIP2Constants.PATRON_IDENTIFIER_CODE)) {
34 patronIdentifier = (data.replaceFirst(OLESIP2Constants.PATRON_IDENTIFIER_CODE, "")).trim();
35 }
36 if (data.startsWith(OLESIP2Constants.TERMINAL_PWD_CODE)) {
37 terminalPassword = (data.replaceFirst(OLESIP2Constants.TERMINAL_PWD_CODE, "")).trim();
38 }
39 if (data.startsWith(OLESIP2Constants.PATRON_PWD_CODE)) {
40 patronPassword = (data.replaceFirst(OLESIP2Constants.PATRON_PWD_CODE, "")).trim();
41 }
42
43 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
44 sequenceNum = data.substring(2, 5);
45 checkSum = data.substring(5);
46 }
47 }
48 LOG.info("Exit OLESIP2PatronStatusRequestParser.parsePatronStatusRequest(String requestData)");
49 }
50
51
52 public String getLanguage() {
53 return language;
54 }
55
56 public void setLanguage(String language) {
57 this.language = language;
58 }
59 }