/servers/jain-slee/resources/diameter-cx-dx/events/src/main/java/org/mobicents/slee/resource/diameter/cxdx/events/ServerAssignmentRequestImpl.java

http://mobicents.googlecode.com/ · Java · 288 lines · 121 code · 40 blank · 127 comment · 2 complexity · cb00030f70560401c22d1f6d9fe2f338 MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.slee.resource.diameter.cxdx.events;
  23. import static net.java.slee.resource.diameter.cxdx.events.avp.DiameterCxDxAvpCodes.*;
  24. import net.java.slee.resource.diameter.base.events.avp.AuthSessionStateType;
  25. import net.java.slee.resource.diameter.base.events.avp.DiameterAvpCodes;
  26. import net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest;
  27. import net.java.slee.resource.diameter.cxdx.events.avp.MultipleRegistrationIndication;
  28. import net.java.slee.resource.diameter.cxdx.events.avp.SCSCFRestorationInfo;
  29. import net.java.slee.resource.diameter.cxdx.events.avp.ServerAssignmentType;
  30. import net.java.slee.resource.diameter.cxdx.events.avp.UserDataAlreadyAvailable;
  31. import net.java.slee.resource.diameter.cxdx.events.avp.SupportedFeaturesAvp;
  32. import org.jdiameter.api.Message;
  33. import org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl;
  34. import org.mobicents.slee.resource.diameter.cxdx.events.avp.SCSCFRestorationInfoImpl;
  35. import org.mobicents.slee.resource.diameter.cxdx.events.avp.SupportedFeaturesAvpImpl;
  36. /**
  37. *
  38. * ServerAssignmentRequestImpl.java
  39. *
  40. * @author <a href="mailto:brainslog@gmail.com"> Alexandre Mendonca </a>
  41. * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
  42. */
  43. public class ServerAssignmentRequestImpl extends DiameterMessageImpl implements ServerAssignmentRequest {
  44. /**
  45. * @param message
  46. */
  47. public ServerAssignmentRequestImpl(Message message) {
  48. super(message);
  49. }
  50. /* (non-Javadoc)
  51. * @see org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl#getLongName()
  52. */
  53. @Override
  54. public String getLongName() {
  55. return "Server-Assignment-Request";
  56. }
  57. /* (non-Javadoc)
  58. * @see org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl#getShortName()
  59. */
  60. @Override
  61. public String getShortName() {
  62. return "SAR";
  63. }
  64. /* (non-Javadoc)
  65. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getAuthSessionState()
  66. */
  67. public AuthSessionStateType getAuthSessionState() {
  68. return (AuthSessionStateType) getAvpAsEnumerated(DiameterAvpCodes.AUTH_SESSION_STATE, AuthSessionStateType.class);
  69. }
  70. /* (non-Javadoc)
  71. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getMultipleRegistrationIndication()
  72. */
  73. public MultipleRegistrationIndication getMultipleRegistrationIndication() {
  74. return (MultipleRegistrationIndication) getAvpAsEnumerated(MULTIPLE_REGISTRATION_INDICATION, CXDX_VENDOR_ID, MultipleRegistrationIndication.class);
  75. }
  76. /* (non-Javadoc)
  77. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getPublicIdentities()
  78. */
  79. public String[] getPublicIdentities() {
  80. return getAvpsAsUTF8String(PUBLIC_IDENTITY, CXDX_VENDOR_ID);
  81. }
  82. /* (non-Javadoc)
  83. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getSCSCFRestorationInfo()
  84. */
  85. public SCSCFRestorationInfo getSCSCFRestorationInfo() {
  86. return (SCSCFRestorationInfo) getAvpAsCustom(SCSCF_RESTORATION_INFO, CXDX_VENDOR_ID, SCSCFRestorationInfoImpl.class);
  87. }
  88. /* (non-Javadoc)
  89. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getServerAssignmentType()
  90. */
  91. public ServerAssignmentType getServerAssignmentType() {
  92. return (ServerAssignmentType) getAvpAsEnumerated(SERVER_ASSIGNMENT_TYPE, CXDX_VENDOR_ID, ServerAssignmentType.class);
  93. }
  94. /* (non-Javadoc)
  95. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getServerName()
  96. */
  97. public String getServerName() {
  98. return getAvpAsUTF8String(SERVER_NAME, CXDX_VENDOR_ID);
  99. }
  100. /* (non-Javadoc)
  101. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getSupportedFeatureses()
  102. */
  103. public SupportedFeaturesAvp[] getSupportedFeatureses() {
  104. return (SupportedFeaturesAvp[]) getAvpsAsCustom(SUPPORTED_FEATURES, CXDX_VENDOR_ID, SupportedFeaturesAvpImpl.class);
  105. }
  106. /* (non-Javadoc)
  107. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getUserDataAlreadyAvailable()
  108. */
  109. public UserDataAlreadyAvailable getUserDataAlreadyAvailable() {
  110. return (UserDataAlreadyAvailable) getAvpAsEnumerated(USER_DATA_ALREADY_AVAILABLE, UserDataAlreadyAvailable.class);
  111. }
  112. /* (non-Javadoc)
  113. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getWildcardedIMPU()
  114. */
  115. public String getWildcardedIMPU() {
  116. return getAvpAsUTF8String(WILDCARDED_IMPU, CXDX_VENDOR_ID);
  117. }
  118. /* (non-Javadoc)
  119. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#getWildcardedPSI()
  120. */
  121. public String getWildcardedPSI() {
  122. return getAvpAsUTF8String(WILDCARDED_PSI, CXDX_VENDOR_ID);
  123. }
  124. /* (non-Javadoc)
  125. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasAuthSessionState()
  126. */
  127. public boolean hasAuthSessionState() {
  128. return hasAvp(DiameterAvpCodes.AUTH_SESSION_STATE);
  129. }
  130. /* (non-Javadoc)
  131. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasMultipleRegistrationIndication()
  132. */
  133. public boolean hasMultipleRegistrationIndication() {
  134. return hasAvp(MULTIPLE_REGISTRATION_INDICATION, CXDX_VENDOR_ID);
  135. }
  136. /* (non-Javadoc)
  137. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasSCSCFRestorationInfo()
  138. */
  139. public boolean hasSCSCFRestorationInfo() {
  140. return hasAvp(SCSCF_RESTORATION_INFO, CXDX_VENDOR_ID);
  141. }
  142. /* (non-Javadoc)
  143. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasServerAssignmentType()
  144. */
  145. public boolean hasServerAssignmentType() {
  146. return hasAvp(SERVER_ASSIGNMENT_TYPE, CXDX_VENDOR_ID);
  147. }
  148. /* (non-Javadoc)
  149. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasServerName()
  150. */
  151. public boolean hasServerName() {
  152. return hasAvp(SERVER_NAME, CXDX_VENDOR_ID);
  153. }
  154. /* (non-Javadoc)
  155. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasUserDataAlreadyAvailable()
  156. */
  157. public boolean hasUserDataAlreadyAvailable() {
  158. return hasAvp(USER_DATA_ALREADY_AVAILABLE, CXDX_VENDOR_ID);
  159. }
  160. /* (non-Javadoc)
  161. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasWildcardedIMPU()
  162. */
  163. public boolean hasWildcardedIMPU() {
  164. return hasAvp(WILDCARDED_IMPU, CXDX_VENDOR_ID);
  165. }
  166. /* (non-Javadoc)
  167. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#hasWildcardedPSI()
  168. */
  169. public boolean hasWildcardedPSI() {
  170. return hasAvp(WILDCARDED_PSI, CXDX_VENDOR_ID);
  171. }
  172. /* (non-Javadoc)
  173. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setAuthSessionState(net.java.slee.resource.diameter.base.events.avp.AuthSessionStateType)
  174. */
  175. public void setAuthSessionState(AuthSessionStateType authSessionState) {
  176. addAvp(DiameterAvpCodes.AUTH_SESSION_STATE, authSessionState.getValue());
  177. }
  178. /* (non-Javadoc)
  179. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setMultipleRegistrationIndication(net.java.slee.resource.diameter.cxdx.events.avp.MultipleRegistrationIndication)
  180. */
  181. public void setMultipleRegistrationIndication(MultipleRegistrationIndication multipleRegistrationIndication) {
  182. addAvp(MULTIPLE_REGISTRATION_INDICATION, CXDX_VENDOR_ID, multipleRegistrationIndication.getValue());
  183. }
  184. /* (non-Javadoc)
  185. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setPublicIdentities(java.lang.String[])
  186. */
  187. public void setPublicIdentities(String[] publicIdentities) {
  188. for(String publicIdentity : publicIdentities) {
  189. setPublicIdentity(publicIdentity);
  190. }
  191. }
  192. /* (non-Javadoc)
  193. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setPublicIdentity(java.lang.String)
  194. */
  195. public void setPublicIdentity(String publicIdentity) {
  196. addAvp(PUBLIC_IDENTITY, CXDX_VENDOR_ID, publicIdentity);
  197. }
  198. /* (non-Javadoc)
  199. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setSCSCFRestorationInfo(net.java.slee.resource.diameter.cxdx.events.avp.SCSCFRestorationInfo)
  200. */
  201. public void setSCSCFRestorationInfo(SCSCFRestorationInfo scscfRestorationInfo) {
  202. addAvp(SCSCF_RESTORATION_INFO, CXDX_VENDOR_ID, scscfRestorationInfo.byteArrayValue());
  203. }
  204. /* (non-Javadoc)
  205. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setServerAssignmentType(net.java.slee.resource.diameter.cxdx.events.avp.ServerAssignmentType)
  206. */
  207. public void setServerAssignmentType(ServerAssignmentType serverAssignmentType) {
  208. addAvp(SERVER_ASSIGNMENT_TYPE, CXDX_VENDOR_ID, serverAssignmentType.getValue());
  209. }
  210. /* (non-Javadoc)
  211. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setServerName(java.lang.String)
  212. */
  213. public void setServerName(String serverName) {
  214. addAvp(SERVER_NAME, CXDX_VENDOR_ID, serverName);
  215. }
  216. /* (non-Javadoc)
  217. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setSupportedFeatures(net.java.slee.resource.diameter.sh.client.events.avp.SupportedFeaturesAvp)
  218. */
  219. public void setSupportedFeatures(SupportedFeaturesAvp supportedFeatures) {
  220. addAvp(SUPPORTED_FEATURES, CXDX_VENDOR_ID, supportedFeatures.byteArrayValue());
  221. }
  222. /* (non-Javadoc)
  223. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setSupportedFeatureses(net.java.slee.resource.diameter.sh.client.events.avp.SupportedFeaturesAvp[])
  224. */
  225. public void setSupportedFeatureses(SupportedFeaturesAvp[] supportedFeatureses) {
  226. for(SupportedFeaturesAvp supportedFeatures : supportedFeatureses) {
  227. setSupportedFeatures(supportedFeatures);
  228. }
  229. }
  230. /* (non-Javadoc)
  231. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setUserDataAlreadyAvailable(net.java.slee.resource.diameter.cxdx.events.avp.UserDataAlreadyAvailable)
  232. */
  233. public void setUserDataAlreadyAvailable(UserDataAlreadyAvailable userDataAlreadyAvailable) {
  234. addAvp(USER_DATA_ALREADY_AVAILABLE, CXDX_VENDOR_ID, userDataAlreadyAvailable.getValue());
  235. }
  236. /* (non-Javadoc)
  237. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setWildcardedIMPU(java.lang.String)
  238. */
  239. public void setWildcardedIMPU(String wildcardedIMPU) {
  240. addAvp(WILDCARDED_IMPU, CXDX_VENDOR_ID, wildcardedIMPU);
  241. }
  242. /* (non-Javadoc)
  243. * @see net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest#setWildcardedPSI(java.lang.String)
  244. */
  245. public void setWildcardedPSI(String wildcardedPSI) {
  246. addAvp(WILDCARDED_PSI, CXDX_VENDOR_ID, wildcardedPSI);
  247. }
  248. }