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