1 package org.kuali.ole.sip2.requestParser;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.ole.sip2.common.StatusCode;
5 import org.kuali.ole.sip2.constants.OLESIP2Constants;
6
7
8
9
10 public class OLESIP2SCStatusRequestParser extends OLESIP2RequestParser {
11
12 private static final Logger LOG = Logger.getLogger(OLESIP2SCStatusRequestParser.class);
13
14 private StatusCode statusCode;
15 private String maxPrintWidth;
16 private String protocolVersion;
17
18 public OLESIP2SCStatusRequestParser(String requestData) {
19 this.parseSCStstusRequest(requestData);
20 }
21
22
23 public void parseSCStstusRequest(String requestData) {
24
25 LOG.info("Entry OLESIP2SCStatusRequestParser.parseSCStstusRequest(String requestData)");
26 requestData = requestData.trim();
27 code = requestData.substring(0, 2);
28 if (String.valueOf(requestData.charAt(2)).equalsIgnoreCase("0"))
29 statusCode = StatusCode.OK;
30 else if (String.valueOf(requestData.charAt(2)).equalsIgnoreCase("1"))
31 statusCode = StatusCode.PRINTER_OUT_OF_PAPER;
32 else if (String.valueOf(requestData.charAt(2)).equalsIgnoreCase("2"))
33 statusCode = StatusCode.SHUT_DOWN;
34 maxPrintWidth = requestData.substring(3, 6);
35 protocolVersion = requestData.substring(6, 10);
36 if (requestData.length() == 19) {
37 if (requestData.substring(10, 12).equalsIgnoreCase(OLESIP2Constants.SEQUENCE_NUM_CODE)) {
38 sequenceNum = requestData.substring(12, 15);
39 checkSum = requestData.substring(15);
40 }
41 }
42 LOG.info("Exit OLESIP2SCStatusRequestParser.parseSCStstusRequest(String requestData)");
43 }
44
45 public StatusCode getStatusCode() {
46 return statusCode;
47 }
48
49 public void setStatusCode(StatusCode statusCode) {
50 this.statusCode = statusCode;
51 }
52
53 public String getMaxPrintWidth() {
54 return maxPrintWidth;
55 }
56
57 public void setMaxPrintWidth(String maxPrintWidth) {
58 this.maxPrintWidth = maxPrintWidth;
59 }
60
61 public String getProtocolVersion() {
62 return protocolVersion;
63 }
64
65 public void setProtocolVersion(String protocolVersion) {
66 this.protocolVersion = protocolVersion;
67 }
68 }