001package org.kuali.ole.sip2.requestParser; 002 003import org.apache.log4j.Logger; 004import org.kuali.ole.sip2.constants.OLESIP2Constants; 005 006/** 007 * Created by gayathria on 2/12/14. 008 */ 009public class OLESIP2PatronEnableRequestParser extends OLESIP2RequestParser { 010 011 012 private static final Logger LOG = Logger.getLogger(OLESIP2PatronEnableRequestParser.class); 013 014 015 public OLESIP2PatronEnableRequestParser(String requestData) { 016 this.parsePatronEnableRequest(requestData); 017 } 018 019 020 public void parsePatronEnableRequest(String requestData) { 021 LOG.info("Entry OLESIP2PatronEnableRequestParser.parsePatronEnable(String requestData)"); 022 023 String[] requestDataArray = requestData.split("\\|"); 024 for (String data : requestDataArray) { 025 if (data.startsWith(OLESIP2Constants.PATRON_ENABLE_REQUEST)) { 026 code = data.substring(0, 2); 027 transactionDate = data.substring(2, 20); 028 institutionId = data.substring(22); 029 } 030 if (data.startsWith(OLESIP2Constants.PATRON_IDENTIFIER_CODE)) { 031 patronIdentifier = (data.replaceFirst(OLESIP2Constants.PATRON_IDENTIFIER_CODE, "")).trim(); 032 } 033 if (data.startsWith(OLESIP2Constants.TERMINAL_PWD_CODE)) { 034 terminalPassword = (data.replaceFirst(OLESIP2Constants.TERMINAL_PWD_CODE, "")).trim(); 035 } 036 if (data.startsWith(OLESIP2Constants.PATRON_PWD_CODE)) { 037 patronPassword = (data.replaceFirst(OLESIP2Constants.PATRON_PWD_CODE, "")).trim(); 038 } 039 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) { 040 sequenceNum = data.substring(2, 5); 041 checkSum = data.substring(5); 042 } 043 } 044 LOG.info("Exit OLESIP2PatronEnableRequestParser.parsePatronEnable(String requestData)"); 045 } 046}