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 10/11/14.
8    */
9   public class OLESIP2RenewAllTurnedOffResponse extends OLESIP2TurnedOffResponse {
10      public OLESIP2RenewAllTurnedOffResponse() {
11          this.code = "";
12      }
13  
14      public String getOLESIP2RenewAllTurnedOffResponse(String requestData) {
15          StringBuilder renewAllResponseBuilder = new StringBuilder();
16  
17          String[] requestDataArray = requestData.split("\\|");
18          renewAllResponseBuilder.append(code);
19  
20          renewAllResponseBuilder.append(StringUtil.bool2Int(false));
21  
22  
23          renewAllResponseBuilder.append(StringUtil.intToFixedLengthString(0, 4));
24          renewAllResponseBuilder.append(StringUtil.intToFixedLengthString(0, 4));
25  
26          renewAllResponseBuilder.append(MessageUtil.getSipDateTime());
27  
28          renewAllResponseBuilder.append("AO");
29  
30  
31          renewAllResponseBuilder.append("|AF");
32          renewAllResponseBuilder.append("Renew All Service Currently turned Off");
33  
34          for (String data : requestDataArray) {
35              if (data.startsWith("AY")) {
36                  renewAllResponseBuilder.append("|AY");
37                  renewAllResponseBuilder.append(data.substring(2, 5));
38                  renewAllResponseBuilder.append(MessageUtil.computeChecksum(renewAllResponseBuilder.toString()));
39              }
40          }
41          return renewAllResponseBuilder.toString() + '\r';
42      }
43  }