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
8
9 public class OLESIP2RenewTurnedOffResponse extends OLESIP2TurnedOffResponse {
10 public OLESIP2RenewTurnedOffResponse() {
11 code = "30";
12 }
13
14 public String getOLESIP2RenewTurnedOffResponse(String requestData) {
15 StringBuilder renewResponseBuilder = new StringBuilder();
16 String[] requestDataArray = requestData.split("\\|");
17 renewResponseBuilder.append(code);
18
19 renewResponseBuilder.append(StringUtil.bool2Int(false));
20 renewResponseBuilder.append(StringUtil.bool2Char(false));
21 renewResponseBuilder.append("U");
22 renewResponseBuilder.append(StringUtil.bool2Char(false));
23
24 renewResponseBuilder.append(MessageUtil.getSipDateTime());
25 renewResponseBuilder.append("AO");
26
27 renewResponseBuilder.append("|AA");
28 for (String data : requestDataArray) {
29 if (data.startsWith("|AA")) {
30 renewResponseBuilder.append((data.replaceFirst("AA", "")).trim());
31 }
32 }
33 renewResponseBuilder.append("|AB");
34
35 renewResponseBuilder.append("|AJ");
36
37 renewResponseBuilder.append("|AH");
38
39 renewResponseBuilder.append("|AFRenew Service Currently turned Off");
40
41 for (String data : requestDataArray) {
42 if (data.startsWith("AY")) {
43 renewResponseBuilder.append("|AY");
44 renewResponseBuilder.append(data.substring(2, 5));
45 renewResponseBuilder.append(MessageUtil.computeChecksum(renewResponseBuilder.toString()));
46 }
47 }
48
49 return renewResponseBuilder.toString() + '\r';
50 }
51 }