1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.sandesha.ws.rm;
19
20 import org.apache.axis.message.MessageElement;
21 import org.apache.sandesha.Constants;
22
23 import javax.xml.soap.SOAPException;
24
25 /***
26 * class Nack
27 *
28 * @author Amila Navarathna
29 * @author Jaliya Ekanayaka
30 * @author Sudar Nimalan
31 */
32 public class Nack implements IRmElement {
33
34 /***
35 * Field notAckNum
36 */
37 private long notAckNum;
38
39 /***
40 * Field nackElement
41 */
42 private MessageElement nackElement;
43
44 /***
45 * Constructor Nack
46 */
47 public Nack() {
48
49 nackElement = new MessageElement();
50 nackElement.setName(Constants.WSRM.NS_PREFIX_RM + Constants.COLON + Constants.WSRM.NACK);
51 }
52
53 /***
54 * Method getSoapElement
55 *
56 * @return MessageElement
57 * @throws SOAPException
58 */
59 public MessageElement getSoapElement() throws SOAPException {
60
61 nackElement.addTextNode(new Long(notAckNum).toString());
62
63 return nackElement;
64 }
65
66 /***
67 * Method fromSOAPEnvelope
68 *
69 * @param element
70 * @return Nack
71 */
72 public Nack fromSOAPEnvelope(MessageElement element) {
73
74 notAckNum = (new Long(element.getFirstChild().toString())).longValue();
75
76 return this;
77 }
78
79 /***
80 * Method toSOAPEnvelope
81 *
82 * @param msgElement
83 * @return MessageElement
84 * @throws SOAPException
85 */
86 public MessageElement toSOAPEnvelope(MessageElement msgElement) throws SOAPException {
87
88 msgElement.addChildElement(Constants.WSRM.NACK, Constants.WSRM.NS_PREFIX_RM).addTextNode((new Long(notAckNum)).toString());
89
90 return msgElement;
91 }
92
93 /***
94 * Method addChildElement
95 *
96 * @param element
97 */
98 public void addChildElement(MessageElement element) {
99
100 }
101
102 /***
103 * @param notAckNo
104 */
105 public void setNotAckNum(long notAckNo) {
106 notAckNum = notAckNo;
107 }
108 }