View Javadoc
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    * Created by gayathria on 2/12/14.
8    */
9   public class OLESIP2EndPatronSessionRequestParser extends OLESIP2RequestParser {
10  
11      private static final Logger LOG = Logger.getLogger(OLESIP2EndPatronSessionRequestParser.class);
12  
13  
14      public OLESIP2EndPatronSessionRequestParser(String requestData) {
15          this.parseEndPatronSession(requestData);
16      }
17  
18      public void parseEndPatronSession(String requestData) {
19  
20          LOG.info("Entry OLESIP2EndPatronSessionRequestParser.parseEndPatronSession(String requestData)");
21  
22          String[] requestDataArray = requestData.split("\\|");
23  
24          for (String data : requestDataArray) {
25              if (data.startsWith(OLESIP2Constants.END_PATRON_SESSION_REQUEST)) {
26                  code = data.substring(0, 2);
27                  transactionDate = data.substring(2, 20);
28  
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 OLESIP2EndPatronSessionRequestParser.parseEndPatronSession(String requestData)");
46      }
47  
48  }