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