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 OLESIP2ItemStatusUpdateRequestParser extends OLESIP2RequestParser {
11  
12  
13      private static final Logger LOG = Logger.getLogger(OLESIP2ItemStatusUpdateRequestParser.class);
14  
15      public OLESIP2ItemStatusUpdateRequestParser(String requestData) {
16          this.parseItemStatusUpdateRequest(requestData);
17      }
18  
19      public void parseItemStatusUpdateRequest(String requestData) {
20  
21          LOG.info("Entry OLESIP2ItemStatusUpdateRequestParser.parseItemStatusUpdate(String requestData)");
22          String[] requestDataArray = requestData.split("\\|");
23          for (String data : requestDataArray) {
24              LOG.info(data);
25              if (data.startsWith(OLESIP2Constants.CHECKOUT_REQUEST)) {
26                  code = data.substring(0, 2);
27                  transactionDate = data.substring(2, 20);
28                  institutionId = data.substring(22);
29              }
30              if (data.startsWith(OLESIP2Constants.ITEM_IDENTIFIER_CODE)) {
31                  itemIdentifier = (data.replaceFirst(OLESIP2Constants.ITEM_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.ITEM_PROPERTIES_CODE)) {
37                  itemProperties = (data.replaceFirst(OLESIP2Constants.ITEM_PROPERTIES_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 OLESIP2ItemStatusUpdateRequestParser.parseItemStatusUpdate(String requestData)");
45      }
46  
47  
48  }