PageRenderTime 131ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/servers/jain-slee/resources/diameter-sh-client/common/events/src/main/java/net/java/slee/resource/diameter/sh/events/avp/DataReferenceType.java

http://mobicents.googlecode.com/
Java | 274 lines | 112 code | 38 blank | 124 comment | 2 complexity | 7f3e88c749bcb131b560a2d774dd75b3 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  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 net.java.slee.resource.diameter.sh.events.avp;
  23. import java.io.Serializable;
  24. import java.io.StreamCorruptedException;
  25. import net.java.slee.resource.diameter.base.events.avp.Enumerated;
  26. /**
  27. * AVP representation of Data-Reference AVP. Defined in 3GPP TS 29.329 section
  28. * 6.3.4.<br>
  29. * The Data-Reference AVP is of type Enumerated, and indicates the type of the
  30. * requested user data in the operation UDR and SNR. Its exact values and
  31. * meaning is defined in 3GPP TS 29.328 [1]. The following values are defined
  32. * (more details are given in 3GPP TS 29.328 [1]):
  33. * <ul>
  34. * <li>RepositoryData (0)</li>
  35. * <li>IMSPublicIdentity (10)</li>
  36. * <li>IMSUserState (11)</li>
  37. * <li>S-CSCFName (12)</li>
  38. * <li>InitialFilterCriteria (13) - This value is used to request initial filter
  39. * criteria relevant to the requesting AS</li>
  40. *
  41. * <li>LocationInformation (14)</li>
  42. * <li>UserState (15)</li>
  43. * <li>ChargingInformation (16)</li>
  44. * <li>MSISDN (17)</li>
  45. * </ul>
  46. *
  47. * @author <a href="mailto:brainslog@gmail.com"> Alexandre Mendonca </a>
  48. * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
  49. */
  50. public class DataReferenceType implements Serializable, Enumerated {
  51. private static final long serialVersionUID = -8270968643651090042L;
  52. /**
  53. * Int value equal to one passed in UDR/SNR - it indicates that data is repository data - see TS29.328 for description
  54. */
  55. public static final int _REPOSITORY_DATA = 0;
  56. /**
  57. * Int value equal to one passed in UDR/SNR - it indicates that data is IMS user identity - see TS29.328 for description
  58. */
  59. public static final int _IMS_PUBLIC_IDENTITY = 10;
  60. /**
  61. * Int value equal to one passed in UDR/SNR - it indicates that data is state of IMS user - see TS29.328 for description
  62. */
  63. public static final int _IMS_USER_STATE = 11;
  64. /**
  65. * Int value equal to one passed in UDR/SNR - it indicates that data is service cscf name - see TS29.328 for description
  66. */
  67. public static final int _S_CSCFNAME = 12;
  68. /**
  69. * Int value equal to one passed in UDR/SNR - it indicates that data is filter criteria - see TS29.328 for description
  70. */
  71. public static final int _INITIAL_FILTER_CRITERIA = 13;
  72. /**
  73. * Int value equal to one passed in UDR/SNR - it indicates that data is location info - see TS29.328 for description
  74. */
  75. public static final int _LOCATION_INFORMATION = 14;
  76. /**
  77. * Int value equal to one passed in UDR/SNR - it indicates that data is user state - see TS29.328 for description
  78. */
  79. public static final int _USER_STATE = 15;
  80. /**
  81. * Int value equal to one passed in UDR/SNR - it indicates that data is charging information - see TS29.328 for description
  82. */
  83. public static final int _CHARGING_INFORMATION = 16;
  84. /**
  85. * Int value equal to one passed in UDR/SNR - it indicates that data is msisdn info - see TS29.328 for description
  86. */
  87. public static final int _MSISDN = 17;
  88. /**
  89. *
  90. */
  91. public static final int _PSI_ACTIVATION = 18;
  92. /**
  93. *
  94. */
  95. public static final int _DSAI = 19;
  96. /**
  97. *
  98. */
  99. public static final int _SERVICE_LEVEL_TRACE_INFO = 21;
  100. /**
  101. *
  102. */
  103. public static final int _IP_ADDRESS_SECURE_BINDING_INFORMATION = 22;
  104. /**
  105. * Singleton representation of {@link _REPOSITORY_DATA}
  106. */
  107. public static final DataReferenceType REPOSITORY_DATA = new DataReferenceType(_REPOSITORY_DATA);
  108. /**
  109. * Singleton representation of {@link _IMS_PUBLIC_IDENTITY}
  110. */
  111. public static final DataReferenceType IMS_PUBLIC_IDENTITY = new DataReferenceType(_IMS_PUBLIC_IDENTITY);
  112. /**
  113. * Singleton representation of {@link _IMS_USER_STATE}
  114. */
  115. public static final DataReferenceType IMS_USER_STATE = new DataReferenceType(_IMS_USER_STATE);
  116. /**
  117. * Singleton representation of {@link _S_CSCFNAME}
  118. */
  119. public static final DataReferenceType S_CSCFNAME = new DataReferenceType(_S_CSCFNAME);
  120. /**
  121. * Singleton representation of {@link _INITIAL_FILTER_CRITERIA}
  122. */
  123. public static final DataReferenceType INITIAL_FILTER_CRITERIA = new DataReferenceType(_INITIAL_FILTER_CRITERIA);
  124. /**
  125. * Singleton representation of {@link _LOCATION_INFORMATION}
  126. */
  127. public static final DataReferenceType LOCATION_INFORMATION = new DataReferenceType(_LOCATION_INFORMATION);
  128. /**
  129. * Singleton representation of {@link _USER_STATE}
  130. */
  131. public static final DataReferenceType USER_STATE = new DataReferenceType(_USER_STATE);
  132. /**
  133. * Singleton representation of {@link _CHARGING_INFORMATION}
  134. */
  135. public static final DataReferenceType CHARGING_INFORMATION = new DataReferenceType(_CHARGING_INFORMATION);
  136. /**
  137. * Singleton representation of {@link _MSISDN}
  138. */
  139. public static final DataReferenceType MSISDN = new DataReferenceType(_MSISDN);
  140. /**
  141. * Singleton representation of {@link _PSI_ACTIVATION}
  142. */
  143. public static final DataReferenceType PSI_ACTIVATION = new DataReferenceType(_PSI_ACTIVATION);
  144. /**
  145. * Singleton representation of {@link _DSAI}
  146. */
  147. public static final DataReferenceType DSAI = new DataReferenceType(_DSAI);
  148. /**
  149. * Singleton representation of {@link _SERVICE_LEVEL_TRACE_INFO}
  150. */
  151. public static final DataReferenceType SERVICE_LEVEL_TRACE_INFO = new DataReferenceType(_SERVICE_LEVEL_TRACE_INFO);
  152. /**
  153. * Singleton representation of {@link _IP_ADDRESS_SECURE_BINDING_INFORMATION}
  154. */
  155. public static final DataReferenceType IP_ADDRESS_SECURE_BINDING_INFORMATION = new DataReferenceType(_IP_ADDRESS_SECURE_BINDING_INFORMATION);
  156. private DataReferenceType(int value) {
  157. this.value = value;
  158. }
  159. public static DataReferenceType fromInt(int type) {
  160. switch (type) {
  161. case _REPOSITORY_DATA:
  162. return REPOSITORY_DATA;
  163. case _IMS_PUBLIC_IDENTITY:
  164. return IMS_PUBLIC_IDENTITY;
  165. case _IMS_USER_STATE:
  166. return IMS_USER_STATE;
  167. case _S_CSCFNAME:
  168. return S_CSCFNAME;
  169. case _INITIAL_FILTER_CRITERIA:
  170. return INITIAL_FILTER_CRITERIA;
  171. case _LOCATION_INFORMATION:
  172. return LOCATION_INFORMATION;
  173. case _USER_STATE:
  174. return USER_STATE;
  175. case _CHARGING_INFORMATION:
  176. return CHARGING_INFORMATION;
  177. case _MSISDN:
  178. return MSISDN;
  179. case _PSI_ACTIVATION:
  180. return PSI_ACTIVATION;
  181. case _DSAI:
  182. return DSAI;
  183. case _SERVICE_LEVEL_TRACE_INFO:
  184. return SERVICE_LEVEL_TRACE_INFO;
  185. case _IP_ADDRESS_SECURE_BINDING_INFORMATION:
  186. return IP_ADDRESS_SECURE_BINDING_INFORMATION;
  187. default:
  188. throw new IllegalArgumentException("Invalid DataReference value: " + type);
  189. }
  190. }
  191. public int getValue() {
  192. return value;
  193. }
  194. public String toString() {
  195. switch (value) {
  196. case _REPOSITORY_DATA:
  197. return "REPOSITORY_DATA";
  198. case _IMS_PUBLIC_IDENTITY:
  199. return "IMS_PUBLIC_IDENTITY";
  200. case _IMS_USER_STATE:
  201. return "IMS_USER_STATE";
  202. case _S_CSCFNAME:
  203. return "S_CSCFNAME";
  204. case _INITIAL_FILTER_CRITERIA:
  205. return "INITIAL_FILTER_CRITERIA";
  206. case _LOCATION_INFORMATION:
  207. return "LOCATION_INFORMATION";
  208. case _USER_STATE:
  209. return "USER_STATE";
  210. case _CHARGING_INFORMATION:
  211. return "CHARGING_INFORMATION";
  212. case _MSISDN:
  213. return "MSISDN";
  214. case _PSI_ACTIVATION:
  215. return "PSI_ACTIVATION";
  216. case _DSAI:
  217. return "DSAI";
  218. case _SERVICE_LEVEL_TRACE_INFO:
  219. return "SERVICE_LEVEL_TRACE_INFO";
  220. case _IP_ADDRESS_SECURE_BINDING_INFORMATION:
  221. return "IP_ADDRESS_SECURE_BINDING_INFORMATION";
  222. default:
  223. return "<Invalid Value>";
  224. }
  225. }
  226. private Object readResolve() throws StreamCorruptedException {
  227. try {
  228. return fromInt(value);
  229. }
  230. catch (IllegalArgumentException iae) {
  231. throw new StreamCorruptedException("Invalid internal state found: " + value);
  232. }
  233. }
  234. private int value;
  235. }