001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /**
043: * This generated bean class Family matches the schema element 'family'.
044: * The root bean class is TemplateFamilies
045: *
046: * Generated on Thu Jun 07 12:07:29 PDT 2007
047: * @Generated
048: */package org.netbeans.modules.uml.codegen.dataaccess.xmlbeans;
049:
050: import org.w3c.dom.*;
051: import org.netbeans.modules.schema2beans.*;
052: import java.beans.*;
053: import java.util.*;
054:
055: // BEGIN_NOI18N
056:
057: public class Family extends org.netbeans.modules.schema2beans.BaseBean
058: implements
059: org.netbeans.modules.uml.codegen.dataaccess.xmlbeans.FamilyInterface,
060: org.netbeans.modules.uml.codegen.dataaccess.xmlbeans.CommonBean {
061:
062: static Vector comparators = new Vector();
063: private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(
064: 4, 2, 0);
065:
066: static public final String NAME = "Name"; // NOI18N
067: static public final String EXPANDED = "Expanded"; // NOI18N
068: static public final String DOMAINOBJECT = "DomainObject"; // NOI18N
069:
070: public Family() {
071: this (Common.USE_DEFAULT_VALUES);
072: }
073:
074: public Family(int options) {
075: super (comparators, runtimeVersion);
076: // Properties (see root bean comments for the bean graph)
077: initPropertyTables(1);
078: this .createProperty("domainObject", // NOI18N
079: DOMAINOBJECT, Common.TYPE_1_N | Common.TYPE_BEAN
080: | Common.TYPE_KEY, DomainObject.class);
081: this .createAttribute(DOMAINOBJECT, "name", "Name",
082: AttrProp.CDATA | AttrProp.IMPLIED, null, null);
083: this .initialize(options);
084: }
085:
086: // Setting the default values of the properties
087: void initialize(int options) {
088:
089: }
090:
091: // This attribute is optional
092: public void setName(java.lang.String value) {
093: setAttributeValue(NAME, value);
094: }
095:
096: //
097: public java.lang.String getName() {
098: return getAttributeValue(NAME);
099: }
100:
101: // This attribute is optional
102: public void setExpanded(boolean value) {
103: setAttributeValue(EXPANDED, "" + value);
104: }
105:
106: //
107: public boolean isExpanded() {
108: return (getAttributeValue(EXPANDED) == null) ? false
109: : java.lang.Boolean
110: .valueOf(getAttributeValue(EXPANDED))
111: .booleanValue();
112: }
113:
114: public boolean fetchDefaultExpanded() {
115: return false;
116: }
117:
118: // This attribute is an array containing at least one element
119: public void setDomainObject(int index, DomainObject value) {
120: this .setValue(DOMAINOBJECT, index, value);
121: }
122:
123: //
124: public DomainObject getDomainObject(int index) {
125: return (DomainObject) this .getValue(DOMAINOBJECT, index);
126: }
127:
128: // Return the number of properties
129: public int sizeDomainObject() {
130: return this .size(DOMAINOBJECT);
131: }
132:
133: // This attribute is an array containing at least one element
134: public void setDomainObject(DomainObject[] value) {
135: this .setValue(DOMAINOBJECT, value);
136: }
137:
138: //
139: public DomainObject[] getDomainObject() {
140: return (DomainObject[]) this .getValues(DOMAINOBJECT);
141: }
142:
143: // Add a new element returning its index in the list
144: public int addDomainObject(
145: org.netbeans.modules.uml.codegen.dataaccess.xmlbeans.DomainObject value) {
146: int positionOfNewItem = this .addValue(DOMAINOBJECT, value);
147: return positionOfNewItem;
148: }
149:
150: //
151: // Remove an element using its reference
152: // Returns the index the element had in the list
153: //
154: public int removeDomainObject(
155: org.netbeans.modules.uml.codegen.dataaccess.xmlbeans.DomainObject value) {
156: return this .removeValue(DOMAINOBJECT, value);
157: }
158:
159: /**
160: * Create a new bean using it's default constructor.
161: * This does not add it to any bean graph.
162: */
163: public DomainObject newDomainObject() {
164: return new DomainObject();
165: }
166:
167: //
168: public static void addComparator(
169: org.netbeans.modules.schema2beans.BeanComparator c) {
170: comparators.add(c);
171: }
172:
173: //
174: public static void removeComparator(
175: org.netbeans.modules.schema2beans.BeanComparator c) {
176: comparators.remove(c);
177: }
178:
179: public void validate()
180: throws org.netbeans.modules.schema2beans.ValidateException {
181: }
182:
183: // Dump the content of this bean returning it as a String
184: public void dump(StringBuffer str, String indent) {
185: String s;
186: Object o;
187: org.netbeans.modules.schema2beans.BaseBean n;
188: str.append(indent);
189: str.append("DomainObject[" + this .sizeDomainObject() + "]"); // NOI18N
190: for (int i = 0; i < this .sizeDomainObject(); i++) {
191: str.append(indent + "\t");
192: str.append("#" + i + ":");
193: n = (org.netbeans.modules.schema2beans.BaseBean) this
194: .getDomainObject(i);
195: if (n != null)
196: n.dump(str, indent + "\t"); // NOI18N
197: else
198: str.append(indent + "\tnull"); // NOI18N
199: this .dumpAttributes(DOMAINOBJECT, i, str, indent);
200: }
201:
202: }
203:
204: public String dumpBeanNode() {
205: StringBuffer str = new StringBuffer();
206: str.append("Family\n"); // NOI18N
207: this .dump(str, "\n "); // NOI18N
208: return str.toString();
209: }
210:
211: public DomainObject getDomainByName(String domainName) {
212: DomainObject[] domainList = getDomainObject();
213: DomainObject theDomain = null;
214:
215: for (DomainObject domain : domainList) {
216: if (domain.getName().equals(domainName)) {
217: theDomain = domain;
218: break;
219: }
220: }
221:
222: return theDomain;
223: }
224:
225: public boolean isUniqueDomainName(String domainName) {
226: return getDomainByName(domainName) == null;
227: }
228:
229: }
230:
231: // END_NOI18N
232:
233: /*
234: The following schema file has been used for generation:
235:
236: <?xml version="1.0" encoding="UTF-8"?>
237:
238: <!--
239: The contents of this file are subject to the terms of the Common Development
240: and Distribution License (the License). You may not use this file except in
241: compliance with the License.
242:
243: You can obtain a copy of the License at http://www.netbeans.org/cddl.html
244: or http://www.netbeans.org/cddl.txt.
245:
246: When distributing Covered Code, include this CDDL Header Notice in each file
247: and include the License file at http://www.netbeans.org/cddl.txt.
248: If applicable, add the following below the CDDL Header, with the fields
249: enclosed by brackets [] replaced by your own identifying information:
250: "Portions Copyrighted [year] [name of copyright owner]"
251:
252: The Original Software is NetBeans. The Initial Developer of the Original
253: Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
254: Microsystems, Inc. All Rights Reserved.
255: -->
256:
257: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
258: <xsd:element name="templateFamilies">
259: <xsd:complexType>
260: <xsd:sequence>
261: <xsd:element name="family" maxOccurs="unbounded">
262: <xsd:complexType>
263: <xsd:sequence>
264: <xsd:element name="domainObject" maxOccurs="unbounded">
265: <xsd:complexType>
266: <xsd:sequence>
267: <xsd:element name="modelElement" type="xsd:string"/>
268: <xsd:element name="stereotype" type="xsd:string"/>
269: <xsd:element name="description" type="xsd:string"/>
270: <xsd:element name="template" maxOccurs="unbounded">
271: <xsd:complexType>
272: <xsd:sequence>
273: <xsd:element name="filenameFormat" type="xsd:string"/>
274: <xsd:element name="fileExtension" type="xsd:string"/>
275: <xsd:element name="folderPath" type="xsd:string"/>
276: <xsd:element name="templateFile" type="xsd:string"/>
277: </xsd:sequence>
278: </xsd:complexType>
279: </xsd:element>
280: </xsd:sequence>
281: <xsd:attribute name="name" type="xsd:string"/>
282: </xsd:complexType>
283: </xsd:element>
284: </xsd:sequence>
285: <xsd:attribute name="name" type="xsd:string"/>
286: <xsd:attribute name="expanded" type="xsd:boolean"/>
287: </xsd:complexType>
288: </xsd:element>
289: </xsd:sequence>
290: </xsd:complexType>
291: </xsd:element>
292: </xsd:schema>
293:
294: */
|