KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > sandesha > ws > rm > Nack


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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 JavaDoc;
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 JavaDoc {
60
61         nackElement.addTextNode(new Long JavaDoc(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 JavaDoc(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 JavaDoc {
87
88         msgElement.addChildElement(Constants.WSRM.NACK, Constants.WSRM.NS_PREFIX_RM).addTextNode((new Long JavaDoc(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 }
Popular Tags