/integrations/opennms-vmware/src/main/java/org/opennms/netmgt/config/vmware/vijava/VmwareGroup.java

https://github.com/ajakubo1/opennms · Java · 336 lines · 122 code · 31 blank · 183 comment · 8 complexity · 3d430b23e669595b6f0f824f69c8c29a MD5 · raw file

  1. /*******************************************************************************
  2. * This file is part of OpenNMS(R).
  3. *
  4. * Copyright (C) 2012 The OpenNMS Group, Inc.
  5. * OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
  6. *
  7. * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
  8. *
  9. * OpenNMS(R) is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published
  11. * by the Free Software Foundation, either version 3 of the License,
  12. * or (at your option) any later version.
  13. *
  14. * OpenNMS(R) is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with OpenNMS(R). If not, see:
  21. * http://www.gnu.org/licenses/
  22. *
  23. * For more information contact:
  24. * OpenNMS(R) Licensing <license@opennms.org>
  25. * http://www.opennms.org/
  26. * http://www.opennms.com/
  27. *******************************************************************************/
  28. package org.opennms.netmgt.config.vmware.vijava;
  29. import org.apache.commons.lang.builder.EqualsBuilder;
  30. import javax.xml.bind.annotation.*;
  31. /**
  32. * An VMware Object Group
  33. */
  34. @XmlRootElement(name = "vmware-group")
  35. @XmlAccessorType(XmlAccessType.FIELD)
  36. @SuppressWarnings("all")
  37. public class VmwareGroup implements java.io.Serializable {
  38. /**
  39. * The name of this group, for user id purposes
  40. */
  41. @XmlAttribute(name = "name")
  42. private java.lang.String _name;
  43. /**
  44. * Specifies the name of the resource type that pertains to the
  45. * attributes
  46. * in this group. For scalar attributes (those occurring once
  47. * per node,
  48. * such as available system memory) this should be "node". For
  49. * multi-instanced attributes, this should be the name of a
  50. * custom
  51. * resource type declared in datacollection-config.xml.
  52. */
  53. @XmlAttribute(name = "resourceType")
  54. private java.lang.String _resourceType;
  55. /**
  56. * An VMware Object
  57. */
  58. @XmlElement(name = "attrib")
  59. private java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> _attribList;
  60. public VmwareGroup() {
  61. super();
  62. this._attribList = new java.util.ArrayList<org.opennms.netmgt.config.vmware.vijava.Attrib>();
  63. }
  64. /**
  65. * @param vAttrib
  66. * @throws java.lang.IndexOutOfBoundsException
  67. * if the index
  68. * given is outside the bounds of the collection
  69. */
  70. public void addAttrib(
  71. final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
  72. throws java.lang.IndexOutOfBoundsException {
  73. this._attribList.add(vAttrib);
  74. }
  75. /**
  76. * @param index
  77. * @param vAttrib
  78. * @throws java.lang.IndexOutOfBoundsException
  79. * if the index
  80. * given is outside the bounds of the collection
  81. */
  82. public void addAttrib(
  83. final int index,
  84. final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
  85. throws java.lang.IndexOutOfBoundsException {
  86. this._attribList.add(index, vAttrib);
  87. }
  88. /**
  89. * Method enumerateAttrib.
  90. *
  91. * @return an Enumeration over all possible elements of this
  92. * collection
  93. */
  94. public java.util.Enumeration<org.opennms.netmgt.config.vmware.vijava.Attrib> enumerateAttrib(
  95. ) {
  96. return java.util.Collections.enumeration(this._attribList);
  97. }
  98. /**
  99. * Overrides the java.lang.Object.equals method.
  100. *
  101. * @param obj
  102. * @return true if the objects are equal.
  103. */
  104. @Override()
  105. public boolean equals(
  106. final java.lang.Object obj) {
  107. if (obj instanceof VmwareGroup) {
  108. VmwareGroup other = (VmwareGroup) obj;
  109. return new EqualsBuilder()
  110. .append(getName(), other.getName())
  111. .append(getResourceType(), other.getResourceType())
  112. .append(getAttrib(), other.getAttrib())
  113. .isEquals();
  114. }
  115. return false;
  116. }
  117. /**
  118. * Method getAttrib.
  119. *
  120. * @param index
  121. * @return the value of the
  122. * org.opennms.netmgt.config.vmware.vijava.Attrib at the given
  123. * index
  124. * @throws java.lang.IndexOutOfBoundsException
  125. * if the index
  126. * given is outside the bounds of the collection
  127. */
  128. public org.opennms.netmgt.config.vmware.vijava.Attrib getAttrib(
  129. final int index)
  130. throws java.lang.IndexOutOfBoundsException {
  131. // check bounds for index
  132. if (index < 0 || index >= this._attribList.size()) {
  133. throw new IndexOutOfBoundsException("getAttrib: Index value '" + index + "' not in range [0.." + (this._attribList.size() - 1) + "]");
  134. }
  135. return (org.opennms.netmgt.config.vmware.vijava.Attrib) _attribList.get(index);
  136. }
  137. /**
  138. * Method getAttrib.Returns the contents of the collection in
  139. * an Array. <p>Note: Just in case the collection contents
  140. * are changing in another thread, we pass a 0-length Array of
  141. * the correct type into the API call. This way we <i>know</i>
  142. * that the Array returned is of exactly the correct length.
  143. *
  144. * @return this collection as an Array
  145. */
  146. public org.opennms.netmgt.config.vmware.vijava.Attrib[] getAttrib(
  147. ) {
  148. org.opennms.netmgt.config.vmware.vijava.Attrib[] array = new org.opennms.netmgt.config.vmware.vijava.Attrib[0];
  149. return (org.opennms.netmgt.config.vmware.vijava.Attrib[]) this._attribList.toArray(array);
  150. }
  151. /**
  152. * Method getAttribCollection.Returns a reference to
  153. * '_attribList'. No type checking is performed on any
  154. * modifications to the Vector.
  155. *
  156. * @return a reference to the Vector backing this class
  157. */
  158. public java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> getAttribCollection(
  159. ) {
  160. return this._attribList;
  161. }
  162. /**
  163. * Method getAttribCount.
  164. *
  165. * @return the size of this collection
  166. */
  167. public int getAttribCount(
  168. ) {
  169. return this._attribList.size();
  170. }
  171. /**
  172. * Returns the value of field 'name'. The field 'name' has the
  173. * following description: The name of this group, for user id
  174. * purposes
  175. *
  176. * @return the value of field 'Name'.
  177. */
  178. public java.lang.String getName(
  179. ) {
  180. return this._name == null ? "" : this._name;
  181. }
  182. /**
  183. * Returns the value of field 'resourceType'. The field
  184. * 'resourceType' has the following description: Specifies the
  185. * name of the resource type that pertains to the attributes
  186. * in this group. For scalar attributes (those occurring once
  187. * per node,
  188. * such as available system memory) this should be "node". For
  189. * multi-instanced attributes, this should be the name of a
  190. * custom
  191. * resource type declared in datacollection-config.xml.
  192. *
  193. * @return the value of field 'ResourceType'.
  194. */
  195. public java.lang.String getResourceType(
  196. ) {
  197. return this._resourceType == null ? "" : this._resourceType;
  198. }
  199. /**
  200. * Method iterateAttrib.
  201. *
  202. * @return an Iterator over all possible elements in this
  203. * collection
  204. */
  205. public java.util.Iterator<org.opennms.netmgt.config.vmware.vijava.Attrib> iterateAttrib(
  206. ) {
  207. return this._attribList.iterator();
  208. }
  209. /**
  210. */
  211. public void removeAllAttrib(
  212. ) {
  213. this._attribList.clear();
  214. }
  215. /**
  216. * Method removeAttrib.
  217. *
  218. * @param vAttrib
  219. * @return true if the object was removed from the collection.
  220. */
  221. public boolean removeAttrib(
  222. final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib) {
  223. boolean removed = _attribList.remove(vAttrib);
  224. return removed;
  225. }
  226. /**
  227. * Method removeAttribAt.
  228. *
  229. * @param index
  230. * @return the element removed from the collection
  231. */
  232. public org.opennms.netmgt.config.vmware.vijava.Attrib removeAttribAt(
  233. final int index) {
  234. java.lang.Object obj = this._attribList.remove(index);
  235. return (org.opennms.netmgt.config.vmware.vijava.Attrib) obj;
  236. }
  237. /**
  238. * @param index
  239. * @param vAttrib
  240. * @throws java.lang.IndexOutOfBoundsException
  241. * if the index
  242. * given is outside the bounds of the collection
  243. */
  244. public void setAttrib(
  245. final int index,
  246. final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
  247. throws java.lang.IndexOutOfBoundsException {
  248. // check bounds for index
  249. if (index < 0 || index >= this._attribList.size()) {
  250. throw new IndexOutOfBoundsException("setAttrib: Index value '" + index + "' not in range [0.." + (this._attribList.size() - 1) + "]");
  251. }
  252. this._attribList.set(index, vAttrib);
  253. }
  254. /**
  255. * @param vAttribArray
  256. */
  257. public void setAttrib(
  258. final org.opennms.netmgt.config.vmware.vijava.Attrib[] vAttribArray) {
  259. //-- copy array
  260. _attribList.clear();
  261. for (int i = 0; i < vAttribArray.length; i++) {
  262. this._attribList.add(vAttribArray[i]);
  263. }
  264. }
  265. /**
  266. * Sets the value of '_attribList' by copying the given Vector.
  267. * All elements will be checked for type safety.
  268. *
  269. * @param vAttribList the Vector to copy.
  270. */
  271. public void setAttrib(
  272. final java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> vAttribList) {
  273. // copy vector
  274. this._attribList.clear();
  275. this._attribList.addAll(vAttribList);
  276. }
  277. /**
  278. * Sets the value of field 'name'. The field 'name' has the
  279. * following description: The name of this group, for user id
  280. * purposes
  281. *
  282. * @param name the value of field 'name'.
  283. */
  284. public void setName(
  285. final java.lang.String name) {
  286. this._name = name;
  287. }
  288. /**
  289. * Sets the value of field 'resourceType'. The field
  290. * 'resourceType' has the following description: Specifies the
  291. * name of the resource type that pertains to the attributes
  292. * in this group. For scalar attributes (those occurring once
  293. * per node,
  294. * such as available system memory) this should be "node". For
  295. * multi-instanced attributes, this should be the name of a
  296. * custom
  297. * resource type declared in datacollection-config.xml.
  298. *
  299. * @param resourceType the value of field 'resourceType'.
  300. */
  301. public void setResourceType(
  302. final java.lang.String resourceType) {
  303. this._resourceType = resourceType;
  304. }
  305. }