View Javadoc
1   package org.kuali.ole.sip2.response;
2   
3   import org.kuali.ole.sip2.sip2Server.MessageUtil;
4   
5   
6   /**
7    * Created by gayathria on 1/9/14.
8    */
9   public class OLESIP2CheckInTurnedOffResponse extends OLESIP2TurnedOffResponse {
10  
11      public OLESIP2CheckInTurnedOffResponse() {
12          this.code = "10";
13      }
14  
15  
16      public String getOLESIP2CheckInTurnedOffResponse(String requestData) {
17  
18          String[] requestDataArray = requestData.split("\\|");
19  
20  
21          StringBuilder builder = new StringBuilder();
22          builder.append(code);
23  
24          builder.append("0");
25          builder.append("N");
26          builder.append("N");
27          builder.append("N");
28  
29          builder.append(MessageUtil.getSipDateTime());
30          builder.append("AO");
31          builder.append("|AB");
32          for (String data : requestDataArray) {
33              if (data.startsWith("AB")) {
34                  builder.append((data.replaceFirst("AB", "")).trim());
35              }
36          }
37          builder.append("|AQ");
38          builder.append("|AFCheckIn service is currently turned off");
39          for (String data : requestDataArray) {
40              if (data.startsWith("AY")) {
41                  builder.append("|AY");
42                  builder.append(data.substring(2, 5));
43                  builder.append(MessageUtil.computeChecksum(builder.toString()));
44              }
45          }
46          return builder.toString() + '\r';
47      }
48  
49  }