1 package org.kuali.ole.sip2.response;
2
3 import org.kuali.ole.sip2.sip2Server.MessageUtil;
4
5
6
7
8 public class OLESIP2PatronStatusTurnedOffResponse extends OLESIP2TurnedOffResponse {
9
10
11 public OLESIP2PatronStatusTurnedOffResponse() {
12 code = "24";
13 }
14
15 public String getOLESIP2PatronStatusTurnedOffResponse(String requestData, String requestType) {
16
17
18 String[] requestDataArray = requestData.split("\\|");
19 StringBuilder builder = new StringBuilder();
20 builder.append(code);
21 builder.append(" ");
22 builder.append("001");
23 builder.append(MessageUtil.getSipDateTime());
24 builder.append("AO");
25 builder.append("|AA");
26 for (String data : requestDataArray) {
27 if (data.startsWith("AA")) {
28 builder.append((data.replaceFirst("AA", "")).trim());
29 }
30 }
31 builder.append("|AE");
32 builder.append("|AF");
33 builder.append(requestType + " Service Currently turned Off");
34
35 for (String data : requestDataArray) {
36 if (data.startsWith("AY")) {
37 builder.append("|AY");
38 builder.append(data.substring(2, 5));
39 builder.append(MessageUtil.computeChecksum(builder.toString()));
40 }
41 }
42
43 return builder.toString() + '\r';
44
45 }
46
47
48 }