1 package org.kuali.ole.sip2.requestParser;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.ole.request.OLESIP2RequestParser;
5 import org.kuali.ole.sip2.constants.OLESIP2Constants;
6
7
8
9
10 public class OLESIP2EndPatronSessionRequestParser extends OLESIP2RequestParser {
11
12 private static final Logger LOG = Logger.getLogger(OLESIP2EndPatronSessionRequestParser.class);
13
14
15 public OLESIP2EndPatronSessionRequestParser(String requestData) {
16 this.parseEndPatronSession(requestData);
17 }
18
19 public void parseEndPatronSession(String requestData) {
20
21 LOG.info("Entry OLESIP2EndPatronSessionRequestParser.parseEndPatronSession(String requestData)");
22
23 String[] requestDataArray = requestData.split("\\|");
24
25 for (String data : requestDataArray) {
26 if (data.startsWith(OLESIP2Constants.END_PATRON_SESSION_REQUEST)) {
27 code = data.substring(0, 2);
28 transactionDate = data.substring(2, 20);
29
30 institutionId = data.substring(22);
31 }
32 if (data.startsWith(OLESIP2Constants.PATRON_IDENTIFIER_CODE)) {
33 patronIdentifier = (data.replaceFirst(OLESIP2Constants.PATRON_IDENTIFIER_CODE, "")).trim();
34 }
35 if (data.startsWith(OLESIP2Constants.TERMINAL_PWD_CODE)) {
36 terminalPassword = (data.replaceFirst(OLESIP2Constants.TERMINAL_PWD_CODE, "")).trim();
37 }
38 if (data.startsWith(OLESIP2Constants.PATRON_PWD_CODE)) {
39 patronPassword = (data.replaceFirst(OLESIP2Constants.PATRON_PWD_CODE, "")).trim();
40 }
41 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
42 sequenceNum = data.substring(2, 5);
43 checkSum = data.substring(5);
44 }
45 }
46 LOG.info("Exit OLESIP2EndPatronSessionRequestParser.parseEndPatronSession(String requestData)");
47 }
48
49 }