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