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