UiClass.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /**
  2. * Licensed Materials - Property of IBM
  3. *
  4. * IBM Cognos Products: CAMAAA
  5. *
  6. * (C) Copyright IBM Corp. 2005, 2012
  7. *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
  9. * IBM Corp.
  10. */
  11. import java.util.HashMap;
  12. import java.util.Locale;
  13. import java.util.Set;
  14. import java.util.Stack;
  15. import com.cognos.CAM_AAA.authentication.IBaseClass;
  16. import com.cognos.CAM_AAA.authentication.IUiClass;
  17. public class UiClass implements IUiClass
  18. {
  19. /**
  20. * @param theObjectID
  21. */
  22. public UiClass(String theObjectID)
  23. {
  24. super();
  25. names = null;
  26. descriptions = null;
  27. ancestors = null;
  28. objectID = theObjectID;
  29. }
  30. /**
  31. * @param theLocale
  32. * @param theDescription
  33. */
  34. public void addDescription(Locale theLocale, String theDescription)
  35. {
  36. if (descriptions == null)
  37. {
  38. descriptions = new HashMap();
  39. }
  40. descriptions.put(theLocale, theDescription);
  41. }
  42. /*
  43. * (non-Javadoc)
  44. *
  45. * @see com.cognos.CAM_AAA.authentication.IUiClass#getDescription(java.util.Locale)
  46. */
  47. public String getDescription(Locale theLocale)
  48. {
  49. if (descriptions != null)
  50. {
  51. return (String) descriptions.get(theLocale);
  52. }
  53. return null;
  54. }
  55. /*
  56. * (non-Javadoc)
  57. *
  58. * @see com.cognos.CAM_AAA.authentication.IUiClass#getAvailableDescriptionLocales()
  59. */
  60. public Locale[] getAvailableDescriptionLocales()
  61. {
  62. if (descriptions != null)
  63. {
  64. Set keySet = descriptions.keySet();
  65. Locale[] array = new Locale[keySet.size()];
  66. return (Locale[]) keySet.toArray(array);
  67. }
  68. return null;
  69. }
  70. /**
  71. * @param theAncestor
  72. */
  73. public void addAncestors(IBaseClass theAncestor)
  74. {
  75. if (ancestors == null)
  76. {
  77. ancestors = new Stack();
  78. }
  79. ancestors.push(theAncestor);
  80. }
  81. /*
  82. * (non-Javadoc)
  83. *
  84. * @see com.cognos.CAM_AAA.authentication.IBaseClass#getAncestors()
  85. */
  86. public IBaseClass[] getAncestors()
  87. {
  88. if (ancestors != null)
  89. {
  90. IBaseClass[] array = new IBaseClass[ancestors.size()];
  91. return (IBaseClass[]) ancestors.toArray(array);
  92. }
  93. return null;
  94. }
  95. /**
  96. * @param theLocale
  97. * @param theName
  98. */
  99. public void addName(Locale theLocale, String theName)
  100. {
  101. if (names == null)
  102. {
  103. names = new HashMap();
  104. }
  105. names.put(theLocale, theName);
  106. }
  107. /*
  108. * (non-Javadoc)
  109. *
  110. * @see com.cognos.CAM_AAA.authentication.IBaseClass#getHasChildren()
  111. */
  112. public boolean getHasChildren()
  113. {
  114. return false;
  115. }
  116. /*
  117. * (non-Javadoc)
  118. *
  119. * @see com.cognos.CAM_AAA.authentication.IBaseClass#getName(java.util.Locale)
  120. */
  121. public String getName(Locale theLocale)
  122. {
  123. if (names != null)
  124. {
  125. return (String) names.get(theLocale);
  126. }
  127. return null;
  128. }
  129. /*
  130. * (non-Javadoc)
  131. *
  132. * @see com.cognos.CAM_AAA.authentication.IBaseClass#getAvailableNameLocales()
  133. */
  134. public Locale[] getAvailableNameLocales()
  135. {
  136. if (names != null)
  137. {
  138. Set keySet = names.keySet();
  139. Locale[] array = new Locale[keySet.size()];
  140. return (Locale[]) keySet.toArray(array);
  141. }
  142. return null;
  143. }
  144. /*
  145. * (non-Javadoc)
  146. *
  147. * @see com.cognos.CAM_AAA.authentication.IBaseClass#getObjectID()
  148. */
  149. public String getObjectID()
  150. {
  151. return objectID;
  152. }
  153. /**
  154. * @param theObjectID
  155. */
  156. protected void setObjectID(String theObjectID)
  157. {
  158. objectID = theObjectID;
  159. }
  160. private String objectID;
  161. private HashMap names;
  162. private HashMap descriptions;
  163. private Stack ancestors;
  164. }