View Javadoc
1   package org.kuali.ole.sip2.response;
2   
3   import org.kuali.ole.sip2.sip2Server.MessageUtil;
4   import org.kuali.ole.sip2.sip2Server.StringUtil;
5   
6   /**
7    * Created by gayathria on 2/12/14.
8    */
9   public class OLESIP2HoldTurnedOffResponse extends OLESIP2TurnedOffResponse {
10  
11      public OLESIP2HoldTurnedOffResponse() {
12          code = "16";
13      }
14  
15      public String getOLESIP2HoldTurnedOffResponse(String requestData) {
16  
17          StringBuilder builder = new StringBuilder();
18          String[] requestDataArray = requestData.split("\\|");
19          builder.append(this.code);
20  
21          builder.append(StringUtil.bool2Int(false));
22          builder.append(StringUtil.bool2Char(false));
23  
24  
25          builder.append(MessageUtil.getSipDateTime());
26  
27  
28          builder.append("AO");
29          builder.append("|AA");
30  
31          for (String data : requestDataArray) {
32              if (data.startsWith("AA")) {
33                  builder.append((data.replaceFirst("AA", "")).trim());
34              }
35          }
36          builder.append("|AF");
37          builder.append("Hold Service Currently turned Off");
38  
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  }