View Javadoc
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    * Created by gayathria on 2/12/14.
9    */
10  public class OLESIP2PatronStatusRequestParser extends OLESIP2RequestParser {
11  
12      private String language;
13  
14      private static final Logger LOG = Logger.getLogger(OLESIP2PatronStatusRequestParser.class);
15  
16  
17      public OLESIP2PatronStatusRequestParser(String requestData) {
18          this.parsePatronStatusRequest(requestData);
19      }
20  
21  
22      public void parsePatronStatusRequest(String requestData) {
23  
24          LOG.info("Entry OLESIP2PatronStatusRequestParser.parsePatronStatusRequest(String requestData)");
25          String[] requestDataArray = requestData.split("\\|");
26          for (String data : requestDataArray) {
27  
28              if (data.startsWith(OLESIP2Constants.PATRON_STATUS_REQUEST)) {
29                  code = data.substring(0, 2);
30                  language = data.substring(2, 5);
31                  transactionDate = data.substring(5, 23);
32                  institutionId = data.substring(25);
33              }
34              if (data.startsWith(OLESIP2Constants.PATRON_IDENTIFIER_CODE)) {
35                  patronIdentifier = (data.replaceFirst(OLESIP2Constants.PATRON_IDENTIFIER_CODE, "")).trim();
36              }
37              if (data.startsWith(OLESIP2Constants.TERMINAL_PWD_CODE)) {
38                  terminalPassword = (data.replaceFirst(OLESIP2Constants.TERMINAL_PWD_CODE, "")).trim();
39              }
40              if (data.startsWith(OLESIP2Constants.PATRON_PWD_CODE)) {
41                  patronPassword = (data.replaceFirst(OLESIP2Constants.PATRON_PWD_CODE, "")).trim();
42              }
43  
44              if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
45                  sequenceNum = data.substring(2, 5);
46                  checkSum = data.substring(5);
47              }
48          }
49          LOG.info("Exit OLESIP2PatronStatusRequestParser.parsePatronStatusRequest(String requestData)");
50      }
51  
52  
53      public String getLanguage() {
54          return language;
55      }
56  
57      public void setLanguage(String language) {
58          this.language = language;
59      }
60  }