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 OLESIP2RenewAllRequestParser extends OLESIP2RequestParser {
10
11 private static final Logger LOG = Logger.getLogger(OLESIP2RenewAllRequestParser.class);
12
13
14 public OLESIP2RenewAllRequestParser(String requestData) {
15 this.parseRenewAllRequest(requestData);
16 }
17
18
19 public void parseRenewAllRequest(String requestData) {
20
21 LOG.info("Entry OLESIP2RenewAllRequestParser.parseRenewAllRequest(String requestData)");
22 String[] requestDataArray = requestData.split("\\|");
23 try {
24 for (String data : requestDataArray) {
25 LOG.info(data);
26 if (data.startsWith(OLESIP2Constants.RENEW_ALL_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.FEE_ACKNOWLEDGED_CODE)) {
41 feeAcknowledged = charToBool(data.charAt(2));
42 }
43 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
44 sequenceNum = data.substring(2, 5);
45 checkSum = data.substring(5);
46 }
47 }
48 } catch (Exception e) {
49 LOG.error(e.getMessage(), e);
50 }
51 LOG.info("Exit OLESIP2RenewAllRequestParser.parseRenewAllRequest(String requestData)");
52 }
53 }