View Javadoc
1   package org.kuali.ole.sip2.response;
2   
3   import org.kuali.ole.sip2.sip2Server.MessageUtil;
4   
5   /**
6    * Created by gayathria on 10/11/14.
7    */
8   public class OLESIP2PatronEnableTurnedOffResponse extends OLESIP2TurnedOffResponse {
9   
10  
11      public OLESIP2PatronEnableTurnedOffResponse() {
12          this.code = "26";
13      }
14  
15      public String getOLESIP2PatronEnableTurnedOffResponse(String requestData) {
16          StringBuilder builder = new StringBuilder();
17          String[] requestDataArray = requestData.split("\\|");
18          builder.append(code);
19          builder.append("              ");
20          builder.append("001");
21          builder.append(MessageUtil.getSipDateTime());
22          builder.append("AO ");
23          builder.append("|AA");
24          for (String data : requestDataArray) {
25              if (data.startsWith("AA")) {
26                  builder.append((data.replaceFirst("AA", "")).trim());
27              }
28          }
29          builder.append("|AE ");
30          builder.append("|AF");
31          builder.append("Patron Enabled Service Currently turned Off");
32  
33          for (String data : requestDataArray) {
34              if (data.startsWith("AY")) {
35                  builder.append("|AY");
36                  builder.append(data.substring(2, 5));
37                  builder.append(MessageUtil.computeChecksum(builder.toString()));
38              }
39          }
40  
41          return builder.toString() + '\r';
42  
43      }
44  }