1 package org.kuali.ole.sip2.sip2Response;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.kuali.ole.sip2.common.MessageUtil;
5 import org.kuali.ole.sip2.constants.OLESIP2Constants;
6 import org.kuali.ole.sip2.requestParser.OLESIP2SCStatusRequestParser;
7
8
9
10
11 public class OLESIP2ACSStatusResponse extends OLESIP2Response {
12
13 public OLESIP2ACSStatusResponse() {
14 this.code = OLESIP2Constants.ACS_STATUS_RESPONSE;
15 }
16
17
18 public String getSIP2ACSStatusResponse(OLESIP2SCStatusRequestParser sip2SCStatusRequestParser) {
19
20 StringBuilder builder = new StringBuilder();
21
22 builder.append(code);
23 builder.append(OLESIP2Constants.Y);
24 builder.append(OLESIP2Constants.Y);
25 builder.append(OLESIP2Constants.Y);
26 builder.append(OLESIP2Constants.Y);
27 builder.append(OLESIP2Constants.N);
28 builder.append(OLESIP2Constants.N);
29 builder.append(OLESIP2Constants.TIME_OUT_PERIOD);
30 builder.append(OLESIP2Constants.RETRIES_ALLOWED);
31 builder.append(MessageUtil.getSipDateTime());
32 builder.append(OLESIP2Constants.SIP_VERSION);
33 builder.append(OLESIP2Constants.SPLIT+
34 OLESIP2Constants.INSTITUTION_ID_CODE);
35 builder.append(StringUtils.isNotBlank(sip2SCStatusRequestParser.getInstitutionId())?
36 sip2SCStatusRequestParser.getInstitutionId():OLESIP2Constants.INSTITUTION);
37 builder.append(OLESIP2Constants.SPLIT+
38 OLESIP2Constants.TERMINAL_LOCATION_CODE);
39 builder.append(OLESIP2Constants.INSTITUTION);
40 builder.append(OLESIP2Constants.SPLIT+
41 OLESIP2Constants.SUPPORTED_MSG_CODE);
42 builder.append(OLESIP2Constants.Y);
43 builder.append(OLESIP2Constants.Y);
44 builder.append(OLESIP2Constants.Y);
45 builder.append(OLESIP2Constants.Y);
46 builder.append(OLESIP2Constants.Y);
47 builder.append(OLESIP2Constants.Y);
48 builder.append(OLESIP2Constants.Y);
49 builder.append(OLESIP2Constants.Y);
50 builder.append(OLESIP2Constants.Y);
51 builder.append(OLESIP2Constants.Y);
52 builder.append(OLESIP2Constants.Y);
53 builder.append(OLESIP2Constants.N);
54 builder.append(OLESIP2Constants.Y);
55 builder.append(OLESIP2Constants.Y);
56 builder.append(OLESIP2Constants.Y);
57 builder.append(OLESIP2Constants.Y);
58 builder.append(OLESIP2Constants.SPLIT+
59 OLESIP2Constants.SCREEN_MSG_CODE);
60 builder.append(OLESIP2Constants.ACS_SCREEN_MSG);
61 if (StringUtils.isNotBlank(sip2SCStatusRequestParser.getSequenceNum())) {
62 builder.append(OLESIP2Constants.SPLIT+
63 OLESIP2Constants.SEQUENCE_NUM_CODE);
64 builder.append(sip2SCStatusRequestParser.getSequenceNum());
65 builder.append(MessageUtil.computeChecksum(builder.toString()));
66 }
67
68 return builder.toString() + '\r';
69 }
70
71 }