PageRenderTime 68ms CodeModel.GetById 64ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/association/DeleteTxnReq.java

http://mobicents.googlecode.com/
Java | 52 lines | 24 code | 14 blank | 14 comment | 2 complexity | 6b7102581cdd71c8ed0e7595b42a0c3d MD5 | raw file
 1package javax.megaco.association;
 2
 3import javax.megaco.AssociationEvent;
 4
 5
 6public class DeleteTxnReq extends AssociationEvent {
 7
 8	private int txnHandle = -1;
 9
10	public DeleteTxnReq(Object source, int assocHandle)
11			throws IllegalArgumentException {
12		super(source, assocHandle);
13		// TODO Auto-generated constructor stub
14	}
15
16	@Override
17	public final int getAssocOperIdentifier() {
18
19		return AssocEventType.M_DELETE_TXN_REQ;
20	}
21
22	/**
23	 * Gets an object identifier that specifies the transaction identifier. If
24	 * the transaction identifier is set to 0, then this would be the case when
25	 * the transaction identifier is to represent all transactions.<br><br>
26	 * If the transaction identifier is not set, then this method returns 0, indicating all transactions. 
27	 * 
28	 * @return Returns an integer value that specifies the transaction identifier.
29	 */
30	public final int getTxnHandle() {
31		if(txnHandle==-1)
32			return 0;
33		
34		return txnHandle;
35		
36	}
37	
38	/**
39	 * This method sets the transaction identifier. To delete all transactions, the transaction identifier is set to 0. 
40	 * @param transactionHandle A reference to transaction identifier.
41	 * @throws IllegalArgumentException This exception is raised if the value of transaction handle passed to this method is less than 0.
42	 */
43	public final void setTxnHandle(int transactionHandle)     throws IllegalArgumentException
44	{
45		
46		if(transactionHandle<0)
47			throw new IllegalArgumentException("Txn Handle can not be less than zero");
48		
49		this.txnHandle=transactionHandle;
50	}
51
52}