1 package org.kuali.ole.sip2.sip2Response;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.kuali.ole.sip2.constants.OLESIP2Constants;
5 import org.kuali.ole.sip2.requestParser.OLESIP2ItemStatusUpdateRequestParser;
6 import org.kuali.ole.sip2.sip2Server.MessageUtil;
7 import org.kuali.ole.sip2.sip2Server.StringUtil;
8
9
10
11
12 public class OLESIP2ItemStatusUpdateResponse extends OLESIP2Response {
13 public OLESIP2ItemStatusUpdateResponse() {
14 code = OLESIP2Constants.ITEM_STATUS_UPDATE_RESPONSE;
15 }
16
17 public String getOLESIP2ItemStatusUpdateResponse(String requestData, OLESIP2ItemStatusUpdateRequestParser olesip2ItemStatusUpdateRequestParser) {
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 StringBuilder builder = new StringBuilder();
34 String[] requestDataArray = requestData.split("\\|");
35 builder.append(this.code);
36 builder.append(StringUtil.bool2Int(false));
37 builder.append(MessageUtil.getSipDateTime());
38 builder.append(OLESIP2Constants.ITEM_IDENTIFIER_CODE);
39 for (String data : requestDataArray) {
40 if (data.startsWith(OLESIP2Constants.ITEM_IDENTIFIER_CODE)) {
41 builder.append((data.replaceFirst(OLESIP2Constants.ITEM_IDENTIFIER_CODE, "")).trim());
42 }
43 }
44 builder.append(OLESIP2Constants.SPLIT+
45 OLESIP2Constants.SCREEN_MSG_CODE);
46 builder.append(OLESIP2Constants.ITEM_SERVICE_NOT_SUPPORTED);
47 for (String data : requestDataArray) {
48 if (data.startsWith(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
49 builder.append(OLESIP2Constants.SPLIT+
50 OLESIP2Constants.SEQUENCE_NUM_CODE);
51 builder.append(data.substring(2, 5));
52 builder.append(MessageUtil.computeChecksum(builder.toString()));
53 }
54 }
55 System.out.println(builder.toString());
56
57
58 return builder.toString() + '\r';
59 }
60 }