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

http://mobicents.googlecode.com/ · Java · 164 lines · 51 code · 16 blank · 97 comment · 12 complexity · 037c3daec30a8c7ed16da066ec38cac3 MD5 · raw file

  1. package javax.megaco.association;
  2. import javax.megaco.AssociationEvent;
  3. public class ModifyAssocReq extends AssociationEvent {
  4. protected SrvChngReason srvChangeReason = null;
  5. protected SrvChngMethod srvChngMethod = null;
  6. protected LocalAddr srvChngAddress = null;
  7. protected String srvChngMethodExtension = null;
  8. public ModifyAssocReq(Object source, int assocHandle) throws IllegalArgumentException {
  9. super(source, assocHandle);
  10. // TODO Auto-generated constructor stub
  11. }
  12. @Override
  13. public int getAssocOperIdentifier() {
  14. return AssocEventType.M_MODIFY_ASSOC_REQ;
  15. }
  16. /**
  17. * Gets the integer value which identifies the service change reason. The
  18. * stack would use the same ServiceChange Reason in the ServiceChange
  19. * command request sent to peer.
  20. *
  21. * @return Returns the integer value corresponding to the service change
  22. * reason. If the ServiceChangeReason is not set, then this method
  23. * would return value null. The possible values are field constants
  24. * defined for the class SrvChngReason.
  25. */
  26. public SrvChngReason getSrvChangeReason() {
  27. // return srvChangeReason == null ? 0 : srvChangeReason
  28. // .getSrvChngReasonId();
  29. return srvChangeReason;
  30. }
  31. /**
  32. * This method sets the service change reason. This parameter is required on
  33. * if the application is MG. The MG stack would use the same ServiceChange
  34. * Reason in the ServiceChange command request sent to peer MGC.
  35. *
  36. * @param reason
  37. * - The object reference to ServiceChange Reason.
  38. * @throws IllegalArgumentException
  39. * This exception is raised if the reference of Service Change
  40. * Reason passed to this method is NULL.
  41. */
  42. public void setSrvChangeReason(SrvChngReason reason) throws IllegalArgumentException {
  43. if (reason == null) {
  44. throw new IllegalArgumentException("Change reason can not be null");
  45. }
  46. this.srvChangeReason = reason;
  47. }
  48. /**
  49. * Gets the integer value which identifies the service change method. This
  50. * parameter is required on if the application is MG. The MG stack would use
  51. * the same ServiceChange Method in ServiceChange command request sent to
  52. * peer MGC.
  53. *
  54. * @return Returns the integer value corresponding to the service change
  55. * method. If the ServiceChangeMethod is not set, then this method
  56. * would return value null. The possible values are field constants
  57. * defined for the class SrvChngMethod.
  58. */
  59. public SrvChngMethod getSrvChngMethod() {
  60. // return srvChngMethod == null ? 0 :
  61. // srvChngMethod.getSrvChngMethodId();
  62. return srvChngMethod;
  63. }
  64. /**
  65. * This method sets the service change method. This parameter is required on
  66. * if the application is MG. The MG stack would use the same ServiceChange
  67. * Method in ServiceChange command request sent to peer MGC.
  68. *
  69. * @param method
  70. * - The object reference to ServiceChange Method.
  71. * @throws IllegalArgumentException
  72. * This exception is raised if the reference of Service Change
  73. * Reason passed to this method is NULL.
  74. */
  75. public void setSrvChngMethod(SrvChngMethod method) throws IllegalArgumentException {
  76. if (method == null) {
  77. throw new IllegalArgumentException("Change method can not be null");
  78. }
  79. this.srvChngMethod = method;
  80. }
  81. /**
  82. * Gets the object reference corresponding to the service change address.
  83. * The stack would use the same ServiceChange Address in the ServiceChange
  84. * command request sent to peer.
  85. *
  86. * @return Returns the service change address. If the service change address
  87. * has not been specified for this class, then this method returns
  88. * NULL.
  89. */
  90. public LocalAddr getSrvChngAddress() {
  91. return srvChngAddress;
  92. }
  93. /**
  94. * This method sets the service change address. The stack would use the same
  95. * ServiceChange Address in the ServiceChange command request sent to peer.
  96. *
  97. * @param srvChngAddress
  98. * - The service change address.
  99. * @throws IllegalArgumentException
  100. * This exception is raised if the service change address
  101. * specified is invalid.
  102. */
  103. public void setSrvChngAddress(LocalAddr srvChngAddress) throws IllegalArgumentException {
  104. // FIXME: IllegalArgumentException
  105. this.srvChngAddress = srvChngAddress;
  106. }
  107. /**
  108. * Gets the string value of the extended service change method.
  109. *
  110. *
  111. * @return Returns string value of the extended service change method. This
  112. * is to be set only if the service change method is set to
  113. * {@link javax.megaco.association.SrvChngMethod.M_EXTENSION}.
  114. * @throws javax.megaco.association.MethodExtensionException
  115. * javax.megaco.association.MethodExtensionException - Thrown if
  116. * service change method has not been set to
  117. * {@link javax.megaco.association.SrvChngMethod.M_EXTENSION}
  118. */
  119. public java.lang.String getSrvChngMethodExtension() throws javax.megaco.association.MethodExtensionException, IllegalArgumentException {
  120. if (getSrvChngMethod() == null || getSrvChngMethod().getSrvChngMethodId() != SrvChngMethod.M_EXTENSION) {
  121. throw new MethodExtensionException("Changed Method is not equal to {@link javax.megaco.association.SrvChngMethod.M_EXTENSION}");
  122. }
  123. return this.srvChngMethodExtension;
  124. }
  125. /**
  126. * This method sets the extended service change method. This needs to be set
  127. * if and only if the service change method is
  128. * {@link javax.megaco.association.SrvChngMethod.M_EXTENSION}.
  129. *
  130. * @param extMethod
  131. * - The string value of the extended service change method.
  132. * @throws javax.megaco.association.MethodExtensionException
  133. * - Thrown if service change method has not been set to
  134. * {@link javax.megaco.association.SrvChngMethod.M_EXTENSION}.
  135. * @throws IllegalArgumentException
  136. * - Thrown if extension string does not follow the rules of the
  137. * extension parameter, e.g, should start with X+ or X- etc.
  138. */
  139. public void setSrvChngMethod(java.lang.String extMethod) throws javax.megaco.association.MethodExtensionException, IllegalArgumentException {
  140. if (getSrvChngMethod() == null || getSrvChngMethod().getSrvChngMethodId() != SrvChngMethod.M_EXTENSION) {
  141. throw new MethodExtensionException("Changed Method is not equal to SrvChngMethod.{@link javax.megaco.association.SrvChngMethod.M_EXTENSION}");
  142. }
  143. // FIXME IllegalArgumentException - Thrown if extension
  144. // string does not follow the rules of the extension parameter, e.g,
  145. // should start with X+ or X- etc.
  146. this.srvChngMethodExtension = extMethod;
  147. }
  148. }