PageRenderTime 32ms CodeModel.GetById 13ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 29package org.opennms.netmgt.config.vmware.vijava;
 30
 31import org.apache.commons.lang.builder.EqualsBuilder;
 32
 33import javax.xml.bind.annotation.*;
 34
 35/**
 36 * An VMware Object Group
 37 */
 38@XmlRootElement(name = "vmware-group")
 39@XmlAccessorType(XmlAccessType.FIELD)
 40@SuppressWarnings("all")
 41public class VmwareGroup implements java.io.Serializable {
 42
 43    /**
 44     * The name of this group, for user id purposes
 45     */
 46    @XmlAttribute(name = "name")
 47    private java.lang.String _name;
 48
 49    /**
 50     * Specifies the name of the resource type that pertains to the
 51     * attributes
 52     * in this group. For scalar attributes (those occurring once
 53     * per node,
 54     * such as available system memory) this should be "node". For
 55     * multi-instanced attributes, this should be the name of a
 56     * custom
 57     * resource type declared in datacollection-config.xml.
 58     */
 59    @XmlAttribute(name = "resourceType")
 60    private java.lang.String _resourceType;
 61
 62    /**
 63     * An VMware Object
 64     */
 65    @XmlElement(name = "attrib")
 66    private java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> _attribList;
 67
 68    public VmwareGroup() {
 69        super();
 70        this._attribList = new java.util.ArrayList<org.opennms.netmgt.config.vmware.vijava.Attrib>();
 71    }
 72
 73    /**
 74     * @param vAttrib
 75     * @throws java.lang.IndexOutOfBoundsException
 76     *          if the index
 77     *          given is outside the bounds of the collection
 78     */
 79    public void addAttrib(
 80            final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
 81            throws java.lang.IndexOutOfBoundsException {
 82        this._attribList.add(vAttrib);
 83    }
 84
 85    /**
 86     * @param index
 87     * @param vAttrib
 88     * @throws java.lang.IndexOutOfBoundsException
 89     *          if the index
 90     *          given is outside the bounds of the collection
 91     */
 92    public void addAttrib(
 93            final int index,
 94            final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
 95            throws java.lang.IndexOutOfBoundsException {
 96        this._attribList.add(index, vAttrib);
 97    }
 98
 99    /**
100     * Method enumerateAttrib.
101     *
102     * @return an Enumeration over all possible elements of this
103     *         collection
104     */
105    public java.util.Enumeration<org.opennms.netmgt.config.vmware.vijava.Attrib> enumerateAttrib(
106    ) {
107        return java.util.Collections.enumeration(this._attribList);
108    }
109
110    /**
111     * Overrides the java.lang.Object.equals method.
112     *
113     * @param obj
114     * @return true if the objects are equal.
115     */
116    @Override()
117    public boolean equals(
118            final java.lang.Object obj) {
119        if (obj instanceof VmwareGroup) {
120            VmwareGroup other = (VmwareGroup) obj;
121            return new EqualsBuilder()
122                    .append(getName(), other.getName())
123                    .append(getResourceType(), other.getResourceType())
124                    .append(getAttrib(), other.getAttrib())
125                    .isEquals();
126        }
127        return false;
128    }
129
130    /**
131     * Method getAttrib.
132     *
133     * @param index
134     * @return the value of the
135     *         org.opennms.netmgt.config.vmware.vijava.Attrib at the given
136     *         index
137     * @throws java.lang.IndexOutOfBoundsException
138     *          if the index
139     *          given is outside the bounds of the collection
140     */
141    public org.opennms.netmgt.config.vmware.vijava.Attrib getAttrib(
142            final int index)
143            throws java.lang.IndexOutOfBoundsException {
144        // check bounds for index
145        if (index < 0 || index >= this._attribList.size()) {
146            throw new IndexOutOfBoundsException("getAttrib: Index value '" + index + "' not in range [0.." + (this._attribList.size() - 1) + "]");
147        }
148
149        return (org.opennms.netmgt.config.vmware.vijava.Attrib) _attribList.get(index);
150    }
151
152    /**
153     * Method getAttrib.Returns the contents of the collection in
154     * an Array.  <p>Note:  Just in case the collection contents
155     * are changing in another thread, we pass a 0-length Array of
156     * the correct type into the API call.  This way we <i>know</i>
157     * that the Array returned is of exactly the correct length.
158     *
159     * @return this collection as an Array
160     */
161    public org.opennms.netmgt.config.vmware.vijava.Attrib[] getAttrib(
162    ) {
163        org.opennms.netmgt.config.vmware.vijava.Attrib[] array = new org.opennms.netmgt.config.vmware.vijava.Attrib[0];
164        return (org.opennms.netmgt.config.vmware.vijava.Attrib[]) this._attribList.toArray(array);
165    }
166
167    /**
168     * Method getAttribCollection.Returns a reference to
169     * '_attribList'. No type checking is performed on any
170     * modifications to the Vector.
171     *
172     * @return a reference to the Vector backing this class
173     */
174    public java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> getAttribCollection(
175    ) {
176        return this._attribList;
177    }
178
179    /**
180     * Method getAttribCount.
181     *
182     * @return the size of this collection
183     */
184    public int getAttribCount(
185    ) {
186        return this._attribList.size();
187    }
188
189    /**
190     * Returns the value of field 'name'. The field 'name' has the
191     * following description: The name of this group, for user id
192     * purposes
193     *
194     * @return the value of field 'Name'.
195     */
196    public java.lang.String getName(
197    ) {
198        return this._name == null ? "" : this._name;
199    }
200
201    /**
202     * Returns the value of field 'resourceType'. The field
203     * 'resourceType' has the following description: Specifies the
204     * name of the resource type that pertains to the attributes
205     * in this group. For scalar attributes (those occurring once
206     * per node,
207     * such as available system memory) this should be "node". For
208     * multi-instanced attributes, this should be the name of a
209     * custom
210     * resource type declared in datacollection-config.xml.
211     *
212     * @return the value of field 'ResourceType'.
213     */
214    public java.lang.String getResourceType(
215    ) {
216        return this._resourceType == null ? "" : this._resourceType;
217    }
218
219    /**
220     * Method iterateAttrib.
221     *
222     * @return an Iterator over all possible elements in this
223     *         collection
224     */
225    public java.util.Iterator<org.opennms.netmgt.config.vmware.vijava.Attrib> iterateAttrib(
226    ) {
227        return this._attribList.iterator();
228    }
229
230    /**
231     */
232    public void removeAllAttrib(
233    ) {
234        this._attribList.clear();
235    }
236
237    /**
238     * Method removeAttrib.
239     *
240     * @param vAttrib
241     * @return true if the object was removed from the collection.
242     */
243    public boolean removeAttrib(
244            final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib) {
245        boolean removed = _attribList.remove(vAttrib);
246        return removed;
247    }
248
249    /**
250     * Method removeAttribAt.
251     *
252     * @param index
253     * @return the element removed from the collection
254     */
255    public org.opennms.netmgt.config.vmware.vijava.Attrib removeAttribAt(
256            final int index) {
257        java.lang.Object obj = this._attribList.remove(index);
258        return (org.opennms.netmgt.config.vmware.vijava.Attrib) obj;
259    }
260
261    /**
262     * @param index
263     * @param vAttrib
264     * @throws java.lang.IndexOutOfBoundsException
265     *          if the index
266     *          given is outside the bounds of the collection
267     */
268    public void setAttrib(
269            final int index,
270            final org.opennms.netmgt.config.vmware.vijava.Attrib vAttrib)
271            throws java.lang.IndexOutOfBoundsException {
272        // check bounds for index
273        if (index < 0 || index >= this._attribList.size()) {
274            throw new IndexOutOfBoundsException("setAttrib: Index value '" + index + "' not in range [0.." + (this._attribList.size() - 1) + "]");
275        }
276
277        this._attribList.set(index, vAttrib);
278    }
279
280    /**
281     * @param vAttribArray
282     */
283    public void setAttrib(
284            final org.opennms.netmgt.config.vmware.vijava.Attrib[] vAttribArray) {
285        //-- copy array
286        _attribList.clear();
287
288        for (int i = 0; i < vAttribArray.length; i++) {
289            this._attribList.add(vAttribArray[i]);
290        }
291    }
292
293    /**
294     * Sets the value of '_attribList' by copying the given Vector.
295     * All elements will be checked for type safety.
296     *
297     * @param vAttribList the Vector to copy.
298     */
299    public void setAttrib(
300            final java.util.List<org.opennms.netmgt.config.vmware.vijava.Attrib> vAttribList) {
301        // copy vector
302        this._attribList.clear();
303
304        this._attribList.addAll(vAttribList);
305    }
306
307    /**
308     * Sets the value of field 'name'. The field 'name' has the
309     * following description: The name of this group, for user id
310     * purposes
311     *
312     * @param name the value of field 'name'.
313     */
314    public void setName(
315            final java.lang.String name) {
316        this._name = name;
317    }
318
319    /**
320     * Sets the value of field 'resourceType'. The field
321     * 'resourceType' has the following description: Specifies the
322     * name of the resource type that pertains to the attributes
323     * in this group. For scalar attributes (those occurring once
324     * per node,
325     * such as available system memory) this should be "node". For
326     * multi-instanced attributes, this should be the name of a
327     * custom
328     * resource type declared in datacollection-config.xml.
329     *
330     * @param resourceType the value of field 'resourceType'.
331     */
332    public void setResourceType(
333            final java.lang.String resourceType) {
334        this._resourceType = resourceType;
335    }
336}