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