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

http://mobicents.googlecode.com/ · Java · 181 lines · 75 code · 24 blank · 82 comment · 2 complexity · d264c6eb0330e9f9cfd58e436a5cc933 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.RegistrationTerminationRequest;
  27. import net.java.slee.resource.diameter.cxdx.events.avp.AssociatedIdentities;
  28. import net.java.slee.resource.diameter.cxdx.events.avp.DeregistrationReason;
  29. import net.java.slee.resource.diameter.cxdx.events.avp.SupportedFeaturesAvp;
  30. import org.jdiameter.api.Message;
  31. import org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl;
  32. import org.mobicents.slee.resource.diameter.cxdx.events.avp.AssociatedIdentitiesImpl;
  33. import org.mobicents.slee.resource.diameter.cxdx.events.avp.DeregistrationReasonImpl;
  34. import org.mobicents.slee.resource.diameter.cxdx.events.avp.SupportedFeaturesAvpImpl;
  35. /**
  36. *
  37. * RegistrationTerminationRequestImpl.java
  38. *
  39. * @author <a href="mailto:brainslog@gmail.com"> Alexandre Mendonca </a>
  40. * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
  41. */
  42. public class RegistrationTerminationRequestImpl extends DiameterMessageImpl implements RegistrationTerminationRequest {
  43. /**
  44. * @param message
  45. */
  46. public RegistrationTerminationRequestImpl(Message message) {
  47. super(message);
  48. }
  49. /* (non-Javadoc)
  50. * @see org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl#getLongName()
  51. */
  52. @Override
  53. public String getLongName() {
  54. return "Registration-Termination-Request";
  55. }
  56. /* (non-Javadoc)
  57. * @see org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl#getShortName()
  58. */
  59. @Override
  60. public String getShortName() {
  61. return "RTR";
  62. }
  63. /* (non-Javadoc)
  64. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#getAssociatedIdentities()
  65. */
  66. public AssociatedIdentities getAssociatedIdentities() {
  67. return (AssociatedIdentities) getAvpAsCustom(ASSOCIATED_IDENTITIES, CXDX_VENDOR_ID, AssociatedIdentitiesImpl.class);
  68. }
  69. /* (non-Javadoc)
  70. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#getAuthSessionState()
  71. */
  72. public AuthSessionStateType getAuthSessionState() {
  73. return (AuthSessionStateType) getAvpAsEnumerated(DiameterAvpCodes.AUTH_SESSION_STATE, AuthSessionStateType.class);
  74. }
  75. /* (non-Javadoc)
  76. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#getDeregistrationReason()
  77. */
  78. public DeregistrationReason getDeregistrationReason() {
  79. return (DeregistrationReason) getAvpAsCustom(DEREGISTRATION_REASON, CXDX_VENDOR_ID, DeregistrationReasonImpl.class);
  80. }
  81. /* (non-Javadoc)
  82. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#getPublicIdentities()
  83. */
  84. public String[] getPublicIdentities() {
  85. return getAvpsAsUTF8String(PUBLIC_IDENTITY, CXDX_VENDOR_ID);
  86. }
  87. /* (non-Javadoc)
  88. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#getSupportedFeatureses()
  89. */
  90. public SupportedFeaturesAvp[] getSupportedFeatureses() {
  91. return (SupportedFeaturesAvp[]) getAvpsAsCustom(SUPPORTED_FEATURES, CXDX_VENDOR_ID, SupportedFeaturesAvpImpl.class);
  92. }
  93. /* (non-Javadoc)
  94. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#hasAssociatedIdentities()
  95. */
  96. public boolean hasAssociatedIdentities() {
  97. return hasAvp(ASSOCIATED_IDENTITIES, CXDX_VENDOR_ID);
  98. }
  99. /* (non-Javadoc)
  100. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#hasAuthSessionState()
  101. */
  102. public boolean hasAuthSessionState() {
  103. return hasAvp(DiameterAvpCodes.AUTH_SESSION_STATE);
  104. }
  105. /* (non-Javadoc)
  106. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#hasDeregistrationReason()
  107. */
  108. public boolean hasDeregistrationReason() {
  109. return hasAvp(DEREGISTRATION_REASON, CXDX_VENDOR_ID);
  110. }
  111. /* (non-Javadoc)
  112. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setAssociatedIdentities(net.java.slee.resource.diameter.cxdx.events.avp.AssociatedIdentities)
  113. */
  114. public void setAssociatedIdentities(AssociatedIdentities associatedIdentities) {
  115. addAvp(ASSOCIATED_IDENTITIES, CXDX_VENDOR_ID, associatedIdentities.byteArrayValue());
  116. }
  117. /* (non-Javadoc)
  118. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setAuthSessionState(net.java.slee.resource.diameter.base.events.avp.AuthSessionStateType)
  119. */
  120. public void setAuthSessionState(AuthSessionStateType authSessionState) {
  121. addAvp(DiameterAvpCodes.AUTH_SESSION_STATE, authSessionState.getValue());
  122. }
  123. /* (non-Javadoc)
  124. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setDeregistrationReason(net.java.slee.resource.diameter.cxdx.events.avp.DeregistrationReason)
  125. */
  126. public void setDeregistrationReason(DeregistrationReason publicIdentity) {
  127. addAvp(DEREGISTRATION_REASON, CXDX_VENDOR_ID, publicIdentity.byteArrayValue());
  128. }
  129. /* (non-Javadoc)
  130. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setPublicIdentities(java.lang.String[])
  131. */
  132. public void setPublicIdentities(String[] publicIdentities) {
  133. for(String publicIdentity : publicIdentities) {
  134. setPublicIdentity(publicIdentity);
  135. }
  136. }
  137. /* (non-Javadoc)
  138. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setPublicIdentity(java.lang.String)
  139. */
  140. public void setPublicIdentity(String publicIdentity) {
  141. addAvp(PUBLIC_IDENTITY, CXDX_VENDOR_ID, publicIdentity);
  142. }
  143. /* (non-Javadoc)
  144. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setSupportedFeatures(net.java.slee.resource.diameter.sh.client.events.avp.SupportedFeaturesAvp)
  145. */
  146. public void setSupportedFeatures(SupportedFeaturesAvp supportedFeatures) {
  147. addAvp(SUPPORTED_FEATURES, CXDX_VENDOR_ID, supportedFeatures.byteArrayValue());
  148. }
  149. /* (non-Javadoc)
  150. * @see net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest#setSupportedFeatureses(net.java.slee.resource.diameter.sh.client.events.avp.SupportedFeaturesAvp[])
  151. */
  152. public void setSupportedFeatureses(SupportedFeaturesAvp[] supportedFeatureses) {
  153. for(SupportedFeaturesAvp supportedFeatures : supportedFeatureses) {
  154. setSupportedFeatures(supportedFeatures);
  155. }
  156. }
  157. }