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