View Javadoc
1   package org.kuali.ole.request;
2   
3   
4   import org.apache.log4j.Logger;
5   
6   public class OLESIP2RequestParser {
7   
8       private final static Logger LOG = Logger.getLogger(OLESIP2RequestParser.class.getName());
9   
10      protected String code;
11      protected String sequenceNum;
12      protected String checkSum;
13      protected String institutionId;
14      protected String patronIdentifier;
15      protected String itemIdentifier;
16      protected String transactionDate;
17      protected String terminalPassword;
18      protected String itemProperties;
19      protected String patronPassword;
20      protected Boolean feeAcknowledged;
21  
22      /**
23       * Converts the given character to a boolean value. Character
24       * must be Y or N. Otherwise an exception is
25       * thrown.
26       *
27       * @param character char to be converted
28       * @return boolean value
29       * @throws Exception
30       */
31      protected boolean charToBool(char character) throws Exception {
32          if (character == 'N') {
33              return false;
34          } else if (character == 'Y') {
35              return true;
36          } else {
37              throw new Exception("Response message contains an invalid value. Allowed values are: Y and N.");
38          }
39      }
40  
41  
42      /**
43       * Converts the given string to an integer.
44       *
45       * @param value string to be converted
46       * @return integer value
47       * @throws Exception
48       */
49      protected int stringToInt(String value) throws Exception {
50          try {
51              return Integer.parseInt(value);
52          } catch (NumberFormatException nfe) {
53              throw new Exception("Response message contains an invalid value. Unable to parse an integer from the given string: \"" + value + "\".");
54          }
55      }
56  
57      public String getCode() {
58          return code;
59      }
60  
61      public void setCode(String code) {
62          this.code = code;
63      }
64  
65      public String getSequenceNum() {
66          return sequenceNum;
67      }
68  
69      public void setSequenceNum(String sequenceNum) {
70          this.sequenceNum = sequenceNum;
71      }
72  
73      public String getCheckSum() {
74          return checkSum;
75      }
76  
77      public void setCheckSum(String checkSum) {
78          this.checkSum = checkSum;
79      }
80  
81      public String getInstitutionId() {
82          return institutionId;
83      }
84  
85      public void setInstitutionId(String institutionId) {
86          this.institutionId = institutionId;
87      }
88  
89      public String getPatronIdentifier() {
90          return patronIdentifier;
91      }
92  
93      public void setPatronIdentifier(String patronIdentifier) {
94          this.patronIdentifier = patronIdentifier;
95      }
96  
97      public String getItemIdentifier() {
98          return itemIdentifier;
99      }
100 
101     public void setItemIdentifier(String itemIdentifier) {
102         this.itemIdentifier = itemIdentifier;
103     }
104 
105     public String getTransactionDate() {
106         return transactionDate;
107     }
108 
109     public void setTransactionDate(String transactionDate) {
110         this.transactionDate = transactionDate;
111     }
112 
113     public String getTerminalPassword() {
114         return terminalPassword;
115     }
116 
117     public void setTerminalPassword(String terminalPassword) {
118         this.terminalPassword = terminalPassword;
119     }
120 
121     public String getItemProperties() {
122         return itemProperties;
123     }
124 
125     public void setItemProperties(String itemProperties) {
126         this.itemProperties = itemProperties;
127     }
128 
129     public String getPatronPassword() {
130         return patronPassword;
131     }
132 
133     public void setPatronPassword(String patronPassword) {
134         this.patronPassword = patronPassword;
135     }
136 
137     public Boolean getFeeAcknowledged() {
138         return feeAcknowledged;
139     }
140 
141     public void setFeeAcknowledged(Boolean feeAcknowledged) {
142         this.feeAcknowledged = feeAcknowledged;
143     }
144 }