0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041: /**
0042: * This generated bean class PortletApp
0043: * matches the schema element 'portlet-app'.
0044: *
0045: * ===============================================================
0046: *
0047: * The portlet-app element is the root of the deployment descriptor
0048: * for a portlet application. This element has a required attribute version
0049: * to specify to which version of the schema the deployment descriptor
0050: * conforms.
0051: *
0052: * ===============================================================
0053: * Generated on Tue Apr 26 19:08:25 MDT 2005
0054: *
0055: * This class matches the root element of the XML Schema,
0056: * and is the root of the bean graph.
0057: *
0058: * portletApp <portlet-app> : PortletApp
0059: * [attr: version CDATA #REQUIRED : java.lang.String]
0060: * [attr: id CDATA #IMPLIED : java.lang.String]
0061: * portlet <portlet> : PortletType[0,n] [unique name='init-param-name-uniqueness', unique name='supports-mime-type-uniqueness', unique name='preference-name-uniqueness', unique name='security-role-ref-name-uniqueness']
0062: * [attr: id CDATA #IMPLIED : java.lang.String]
0063: * description <description> : java.lang.String[0,n]
0064: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0065: * portletName <portlet-name> : java.lang.String
0066: * displayName <display-name> : java.lang.String[0,n] [whiteSpace (collapse)]
0067: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0068: * portletClass <portlet-class> : java.lang.String
0069: * initParam <init-param> : InitParamType[0,n]
0070: * [attr: id CDATA #IMPLIED : java.lang.String]
0071: * description <description> : java.lang.String[0,n]
0072: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0073: * name <name> : java.lang.String
0074: * value <value> : java.lang.String
0075: * expirationCache <expiration-cache> : int[0,1]
0076: * supports <supports> : SupportsType[1,n]
0077: * [attr: id CDATA #IMPLIED : java.lang.String]
0078: * mimeType <mime-type> : java.lang.String
0079: * portletMode <portlet-mode> : java.lang.String[0,n]
0080: * supportedLocale <supported-locale> : java.lang.String[0,n]
0081: * | resourceBundle <resource-bundle> : java.lang.String
0082: * | portletInfo <portlet-info> : PortletInfoType[0,1]
0083: * | [attr: id CDATA #IMPLIED : java.lang.String]
0084: * | title <title> : java.lang.String
0085: * | shortTitle <short-title> : java.lang.String[0,1]
0086: * | keywords <keywords> : java.lang.String[0,1]
0087: * | portletInfo2 <portlet-info> : PortletInfoType
0088: * | [attr: id CDATA #IMPLIED : java.lang.String]
0089: * | title <title> : java.lang.String
0090: * | shortTitle <short-title> : java.lang.String[0,1]
0091: * | keywords <keywords> : java.lang.String[0,1]
0092: * portletPreferences <portlet-preferences> : PortletPreferencesType[0,1]
0093: * [attr: id CDATA #IMPLIED : java.lang.String]
0094: * preference <preference> : PreferenceType[0,n]
0095: * [attr: id CDATA #IMPLIED : java.lang.String]
0096: * name <name> : java.lang.String
0097: * value <value> : java.lang.String[0,n]
0098: * readOnly <read-only> : java.lang.String[0,1] [enumeration (true), enumeration (false)]
0099: * preferencesValidator <preferences-validator> : java.lang.String[0,1]
0100: * securityRoleRef <security-role-ref> : SecurityRoleRefType[0,n]
0101: * [attr: id CDATA #IMPLIED : java.lang.String]
0102: * description <description> : java.lang.String[0,n]
0103: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0104: * roleName <role-name> : java.lang.String
0105: * roleLink <role-link> : java.lang.String[0,1]
0106: * customPortletMode <custom-portlet-mode> : CustomPortletModeType[0,n]
0107: * [attr: id CDATA #IMPLIED : java.lang.String]
0108: * description <description> : java.lang.String[0,n]
0109: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0110: * portletMode <portlet-mode> : java.lang.String
0111: * customWindowState <custom-window-state> : CustomWindowStateType[0,n]
0112: * [attr: id CDATA #IMPLIED : java.lang.String]
0113: * description <description> : java.lang.String[0,n]
0114: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0115: * windowState <window-state> : java.lang.String
0116: * userAttribute <user-attribute> : UserAttributeType[0,n]
0117: * [attr: id CDATA #IMPLIED : java.lang.String]
0118: * description <description> : java.lang.String[0,n]
0119: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0120: * name <name> : java.lang.String
0121: * securityConstraint <security-constraint> : SecurityConstraintType[0,n]
0122: * [attr: id CDATA #IMPLIED : java.lang.String]
0123: * displayName <display-name> : java.lang.String[0,n] [whiteSpace (collapse)]
0124: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0125: * portletCollection <portlet-collection> : PortletCollectionType
0126: * portletName <portlet-name> : java.lang.String[1,n]
0127: * userDataConstraint <user-data-constraint> : UserDataConstraintType
0128: * [attr: id CDATA #IMPLIED : java.lang.String]
0129: * description <description> : java.lang.String[0,n]
0130: * [attr: xml:lang CDATA #IMPLIED : java.lang.String]
0131: * transportGuarantee <transport-guarantee> : java.lang.String [enumeration (NONE), enumeration (INTEGRAL), enumeration (CONFIDENTIAL)]
0132: *
0133: * @Generated
0134: */package org.netbeans.modules.visualweb.api.portlet.dd;
0135:
0136: public class PortletApp
0137: implements
0138: org.netbeans.modules.visualweb.api.portlet.dd.PortletAppInterface,
0139: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean {
0140: public static final String VERSION = "Version"; // NOI18N
0141: public static final String ID = "Id"; // NOI18N
0142: public static final String PORTLET = "Portlet"; // NOI18N
0143: public static final String CUSTOM_PORTLET_MODE = "CustomPortletMode"; // NOI18N
0144: public static final String CUSTOM_WINDOW_STATE = "CustomWindowState"; // NOI18N
0145: public static final String USER_ATTRIBUTE = "UserAttribute"; // NOI18N
0146: public static final String SECURITY_CONSTRAINT = "SecurityConstraint"; // NOI18N
0147:
0148: private java.lang.String _Version;
0149: private java.lang.String _Id;
0150: private java.util.List _Portlet = new java.util.ArrayList(); // List<PortletType>
0151: private java.util.List _CustomPortletMode = new java.util.ArrayList(); // List<CustomPortletModeType>
0152: private java.util.List _CustomWindowState = new java.util.ArrayList(); // List<CustomWindowStateType>
0153: private java.util.List _UserAttribute = new java.util.ArrayList(); // List<UserAttributeType>
0154: private java.util.List _SecurityConstraint = new java.util.ArrayList(); // List<SecurityConstraintType>
0155: private java.lang.String schemaLocation;
0156:
0157: /**
0158: * Normal starting point constructor.
0159: */
0160: public PortletApp() {
0161: _Version = "";
0162: }
0163:
0164: /**
0165: * Required parameters constructor
0166: */
0167: public PortletApp(java.lang.String version) {
0168: _Version = version;
0169: }
0170:
0171: /**
0172: * Deep copy
0173: */
0174: public PortletApp(
0175: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp source) {
0176: this (source, false);
0177: }
0178:
0179: /**
0180: * Deep copy
0181: * @param justData just copy the XML relevant data
0182: */
0183: public PortletApp(
0184: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp source,
0185: boolean justData) {
0186: _Version = source._Version;
0187: _Id = source._Id;
0188: for (java.util.Iterator it = source._Portlet.iterator(); it
0189: .hasNext();) {
0190: org.netbeans.modules.visualweb.api.portlet.dd.PortletType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it
0191: .next();
0192: _Portlet.add((srcElement == null) ? null : newPortletType(
0193: srcElement, justData));
0194: }
0195: for (java.util.Iterator it = source._CustomPortletMode
0196: .iterator(); it.hasNext();) {
0197: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it
0198: .next();
0199: _CustomPortletMode.add((srcElement == null) ? null
0200: : newCustomPortletModeType(srcElement, justData));
0201: }
0202: for (java.util.Iterator it = source._CustomWindowState
0203: .iterator(); it.hasNext();) {
0204: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it
0205: .next();
0206: _CustomWindowState.add((srcElement == null) ? null
0207: : newCustomWindowStateType(srcElement, justData));
0208: }
0209: for (java.util.Iterator it = source._UserAttribute.iterator(); it
0210: .hasNext();) {
0211: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it
0212: .next();
0213: _UserAttribute.add((srcElement == null) ? null
0214: : newUserAttributeType(srcElement, justData));
0215: }
0216: for (java.util.Iterator it = source._SecurityConstraint
0217: .iterator(); it.hasNext();) {
0218: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it
0219: .next();
0220: _SecurityConstraint.add((srcElement == null) ? null
0221: : newSecurityConstraintType(srcElement, justData));
0222: }
0223: schemaLocation = source.schemaLocation;
0224: }
0225:
0226: // This attribute is mandatory
0227: public void setVersion(java.lang.String value) {
0228: _Version = value;
0229: }
0230:
0231: public java.lang.String getVersion() {
0232: return _Version;
0233: }
0234:
0235: // This attribute is optional
0236: public void setId(java.lang.String value) {
0237: _Id = value;
0238: }
0239:
0240: public java.lang.String getId() {
0241: return _Id;
0242: }
0243:
0244: // This attribute is an array, possibly empty
0245: public void setPortlet(
0246: org.netbeans.modules.visualweb.api.portlet.dd.PortletType[] value) {
0247: if (value == null)
0248: value = new PortletType[0];
0249: _Portlet.clear();
0250: ((java.util.ArrayList) _Portlet).ensureCapacity(value.length);
0251: for (int i = 0; i < value.length; ++i) {
0252: _Portlet.add(value[i]);
0253: }
0254: }
0255:
0256: public void setPortlet(
0257: int index,
0258: org.netbeans.modules.visualweb.api.portlet.dd.PortletType value) {
0259: _Portlet.set(index, value);
0260: }
0261:
0262: public org.netbeans.modules.visualweb.api.portlet.dd.PortletType[] getPortlet() {
0263: PortletType[] arr = new PortletType[_Portlet.size()];
0264: return (PortletType[]) _Portlet.toArray(arr);
0265: }
0266:
0267: public java.util.List fetchPortletList() {
0268: return _Portlet;
0269: }
0270:
0271: public org.netbeans.modules.visualweb.api.portlet.dd.PortletType getPortlet(
0272: int index) {
0273: return (PortletType) _Portlet.get(index);
0274: }
0275:
0276: // Return the number of portlet
0277: public int sizePortlet() {
0278: return _Portlet.size();
0279: }
0280:
0281: public int addPortlet(
0282: org.netbeans.modules.visualweb.api.portlet.dd.PortletType value) {
0283: _Portlet.add(value);
0284: int positionOfNewItem = _Portlet.size() - 1;
0285: return positionOfNewItem;
0286: }
0287:
0288: /**
0289: * Search from the end looking for @param value, and then remove it.
0290: */
0291: public int removePortlet(
0292: org.netbeans.modules.visualweb.api.portlet.dd.PortletType value) {
0293: int pos = _Portlet.indexOf(value);
0294: if (pos >= 0) {
0295: _Portlet.remove(pos);
0296: }
0297: return pos;
0298: }
0299:
0300: // This attribute is an array, possibly empty
0301: public void setCustomPortletMode(
0302: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType[] value) {
0303: if (value == null)
0304: value = new CustomPortletModeType[0];
0305: _CustomPortletMode.clear();
0306: ((java.util.ArrayList) _CustomPortletMode)
0307: .ensureCapacity(value.length);
0308: for (int i = 0; i < value.length; ++i) {
0309: _CustomPortletMode.add(value[i]);
0310: }
0311: }
0312:
0313: public void setCustomPortletMode(
0314: int index,
0315: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType value) {
0316: _CustomPortletMode.set(index, value);
0317: }
0318:
0319: public org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType[] getCustomPortletMode() {
0320: CustomPortletModeType[] arr = new CustomPortletModeType[_CustomPortletMode
0321: .size()];
0322: return (CustomPortletModeType[]) _CustomPortletMode
0323: .toArray(arr);
0324: }
0325:
0326: public java.util.List fetchCustomPortletModeList() {
0327: return _CustomPortletMode;
0328: }
0329:
0330: public org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType getCustomPortletMode(
0331: int index) {
0332: return (CustomPortletModeType) _CustomPortletMode.get(index);
0333: }
0334:
0335: // Return the number of customPortletMode
0336: public int sizeCustomPortletMode() {
0337: return _CustomPortletMode.size();
0338: }
0339:
0340: public int addCustomPortletMode(
0341: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType value) {
0342: _CustomPortletMode.add(value);
0343: int positionOfNewItem = _CustomPortletMode.size() - 1;
0344: return positionOfNewItem;
0345: }
0346:
0347: /**
0348: * Search from the end looking for @param value, and then remove it.
0349: */
0350: public int removeCustomPortletMode(
0351: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType value) {
0352: int pos = _CustomPortletMode.indexOf(value);
0353: if (pos >= 0) {
0354: _CustomPortletMode.remove(pos);
0355: }
0356: return pos;
0357: }
0358:
0359: // This attribute is an array, possibly empty
0360: public void setCustomWindowState(
0361: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType[] value) {
0362: if (value == null)
0363: value = new CustomWindowStateType[0];
0364: _CustomWindowState.clear();
0365: ((java.util.ArrayList) _CustomWindowState)
0366: .ensureCapacity(value.length);
0367: for (int i = 0; i < value.length; ++i) {
0368: _CustomWindowState.add(value[i]);
0369: }
0370: }
0371:
0372: public void setCustomWindowState(
0373: int index,
0374: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType value) {
0375: _CustomWindowState.set(index, value);
0376: }
0377:
0378: public org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType[] getCustomWindowState() {
0379: CustomWindowStateType[] arr = new CustomWindowStateType[_CustomWindowState
0380: .size()];
0381: return (CustomWindowStateType[]) _CustomWindowState
0382: .toArray(arr);
0383: }
0384:
0385: public java.util.List fetchCustomWindowStateList() {
0386: return _CustomWindowState;
0387: }
0388:
0389: public org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType getCustomWindowState(
0390: int index) {
0391: return (CustomWindowStateType) _CustomWindowState.get(index);
0392: }
0393:
0394: // Return the number of customWindowState
0395: public int sizeCustomWindowState() {
0396: return _CustomWindowState.size();
0397: }
0398:
0399: public int addCustomWindowState(
0400: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType value) {
0401: _CustomWindowState.add(value);
0402: int positionOfNewItem = _CustomWindowState.size() - 1;
0403: return positionOfNewItem;
0404: }
0405:
0406: /**
0407: * Search from the end looking for @param value, and then remove it.
0408: */
0409: public int removeCustomWindowState(
0410: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType value) {
0411: int pos = _CustomWindowState.indexOf(value);
0412: if (pos >= 0) {
0413: _CustomWindowState.remove(pos);
0414: }
0415: return pos;
0416: }
0417:
0418: // This attribute is an array, possibly empty
0419: public void setUserAttribute(
0420: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType[] value) {
0421: if (value == null)
0422: value = new UserAttributeType[0];
0423: _UserAttribute.clear();
0424: ((java.util.ArrayList) _UserAttribute)
0425: .ensureCapacity(value.length);
0426: for (int i = 0; i < value.length; ++i) {
0427: _UserAttribute.add(value[i]);
0428: }
0429: }
0430:
0431: public void setUserAttribute(
0432: int index,
0433: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType value) {
0434: _UserAttribute.set(index, value);
0435: }
0436:
0437: public org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType[] getUserAttribute() {
0438: UserAttributeType[] arr = new UserAttributeType[_UserAttribute
0439: .size()];
0440: return (UserAttributeType[]) _UserAttribute.toArray(arr);
0441: }
0442:
0443: public java.util.List fetchUserAttributeList() {
0444: return _UserAttribute;
0445: }
0446:
0447: public org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType getUserAttribute(
0448: int index) {
0449: return (UserAttributeType) _UserAttribute.get(index);
0450: }
0451:
0452: // Return the number of userAttribute
0453: public int sizeUserAttribute() {
0454: return _UserAttribute.size();
0455: }
0456:
0457: public int addUserAttribute(
0458: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType value) {
0459: _UserAttribute.add(value);
0460: int positionOfNewItem = _UserAttribute.size() - 1;
0461: return positionOfNewItem;
0462: }
0463:
0464: /**
0465: * Search from the end looking for @param value, and then remove it.
0466: */
0467: public int removeUserAttribute(
0468: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType value) {
0469: int pos = _UserAttribute.indexOf(value);
0470: if (pos >= 0) {
0471: _UserAttribute.remove(pos);
0472: }
0473: return pos;
0474: }
0475:
0476: // This attribute is an array, possibly empty
0477: public void setSecurityConstraint(
0478: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType[] value) {
0479: if (value == null)
0480: value = new SecurityConstraintType[0];
0481: _SecurityConstraint.clear();
0482: ((java.util.ArrayList) _SecurityConstraint)
0483: .ensureCapacity(value.length);
0484: for (int i = 0; i < value.length; ++i) {
0485: _SecurityConstraint.add(value[i]);
0486: }
0487: }
0488:
0489: public void setSecurityConstraint(
0490: int index,
0491: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType value) {
0492: _SecurityConstraint.set(index, value);
0493: }
0494:
0495: public org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType[] getSecurityConstraint() {
0496: SecurityConstraintType[] arr = new SecurityConstraintType[_SecurityConstraint
0497: .size()];
0498: return (SecurityConstraintType[]) _SecurityConstraint
0499: .toArray(arr);
0500: }
0501:
0502: public java.util.List fetchSecurityConstraintList() {
0503: return _SecurityConstraint;
0504: }
0505:
0506: public org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType getSecurityConstraint(
0507: int index) {
0508: return (SecurityConstraintType) _SecurityConstraint.get(index);
0509: }
0510:
0511: // Return the number of securityConstraint
0512: public int sizeSecurityConstraint() {
0513: return _SecurityConstraint.size();
0514: }
0515:
0516: public int addSecurityConstraint(
0517: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType value) {
0518: _SecurityConstraint.add(value);
0519: int positionOfNewItem = _SecurityConstraint.size() - 1;
0520: return positionOfNewItem;
0521: }
0522:
0523: /**
0524: * Search from the end looking for @param value, and then remove it.
0525: */
0526: public int removeSecurityConstraint(
0527: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType value) {
0528: int pos = _SecurityConstraint.indexOf(value);
0529: if (pos >= 0) {
0530: _SecurityConstraint.remove(pos);
0531: }
0532: return pos;
0533: }
0534:
0535: public void _setSchemaLocation(String location) {
0536: schemaLocation = location;
0537: }
0538:
0539: public String _getSchemaLocation() {
0540: return schemaLocation;
0541: }
0542:
0543: /**
0544: * Create a new bean using it's default constructor.
0545: * This does not add it to any bean graph.
0546: */
0547: public org.netbeans.modules.visualweb.api.portlet.dd.PortletType newPortletType() {
0548: return new org.netbeans.modules.visualweb.api.portlet.dd.PortletType();
0549: }
0550:
0551: /**
0552: * Create a new bean, copying from another one.
0553: * This does not add it to any bean graph.
0554: */
0555: public org.netbeans.modules.visualweb.api.portlet.dd.PortletType newPortletType(
0556: PortletType source, boolean justData) {
0557: return new org.netbeans.modules.visualweb.api.portlet.dd.PortletType(
0558: source, justData);
0559: }
0560:
0561: /**
0562: * Create a new bean using it's default constructor.
0563: * This does not add it to any bean graph.
0564: */
0565: public org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType newCustomPortletModeType() {
0566: return new org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType();
0567: }
0568:
0569: /**
0570: * Create a new bean, copying from another one.
0571: * This does not add it to any bean graph.
0572: */
0573: public org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType newCustomPortletModeType(
0574: CustomPortletModeType source, boolean justData) {
0575: return new org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType(
0576: source, justData);
0577: }
0578:
0579: /**
0580: * Create a new bean using it's default constructor.
0581: * This does not add it to any bean graph.
0582: */
0583: public org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType newCustomWindowStateType() {
0584: return new org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType();
0585: }
0586:
0587: /**
0588: * Create a new bean, copying from another one.
0589: * This does not add it to any bean graph.
0590: */
0591: public org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType newCustomWindowStateType(
0592: CustomWindowStateType source, boolean justData) {
0593: return new org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType(
0594: source, justData);
0595: }
0596:
0597: /**
0598: * Create a new bean using it's default constructor.
0599: * This does not add it to any bean graph.
0600: */
0601: public org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType newUserAttributeType() {
0602: return new org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType();
0603: }
0604:
0605: /**
0606: * Create a new bean, copying from another one.
0607: * This does not add it to any bean graph.
0608: */
0609: public org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType newUserAttributeType(
0610: UserAttributeType source, boolean justData) {
0611: return new org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType(
0612: source, justData);
0613: }
0614:
0615: /**
0616: * Create a new bean using it's default constructor.
0617: * This does not add it to any bean graph.
0618: */
0619: public org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType newSecurityConstraintType() {
0620: return new org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType();
0621: }
0622:
0623: /**
0624: * Create a new bean, copying from another one.
0625: * This does not add it to any bean graph.
0626: */
0627: public org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType newSecurityConstraintType(
0628: SecurityConstraintType source, boolean justData) {
0629: return new org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType(
0630: source, justData);
0631: }
0632:
0633: public void write(java.io.File f) throws java.io.IOException {
0634: java.io.OutputStream out = new java.io.FileOutputStream(f);
0635: try {
0636: write(out);
0637: } finally {
0638: out.close();
0639: }
0640: }
0641:
0642: public void write(java.io.OutputStream out)
0643: throws java.io.IOException {
0644: write(out, null);
0645: }
0646:
0647: public void write(java.io.OutputStream out, String encoding)
0648: throws java.io.IOException {
0649: java.io.Writer w;
0650: if (encoding == null) {
0651: encoding = "UTF-8"; // NOI18N
0652: }
0653: w = new java.io.BufferedWriter(new java.io.OutputStreamWriter(
0654: out, encoding));
0655: write(w, encoding);
0656: w.flush();
0657: }
0658:
0659: /**
0660: * Print this Java Bean to @param out including an XML header.
0661: * @param encoding is the encoding style that @param out was opened with.
0662: */
0663: public void write(java.io.Writer out, String encoding)
0664: throws java.io.IOException {
0665: out.write("<?xml version='1.0'"); // NOI18N
0666: if (encoding != null)
0667: out.write(" encoding='" + encoding + "'"); // NOI18N
0668: out.write(" ?>\n"); // NOI18N
0669: writeNode(out, "portlet-app", ""); // NOI18N
0670: }
0671:
0672: public void writeNode(java.io.Writer out)
0673: throws java.io.IOException {
0674: String myName;
0675: myName = "portlet-app";
0676: writeNode(out, myName, ""); // NOI18N
0677: }
0678:
0679: public void writeNode(java.io.Writer out, String nodeName,
0680: String indent) throws java.io.IOException {
0681: writeNode(out, nodeName, null, indent, new java.util.HashMap());
0682: }
0683:
0684: /**
0685: * It's not recommended to call this method directly.
0686: */
0687: public void writeNode(java.io.Writer out, String nodeName,
0688: String namespace, String indent, java.util.Map namespaceMap)
0689: throws java.io.IOException {
0690: out.write(indent);
0691: out.write("<");
0692: if (namespace != null) {
0693: out.write((String) namespaceMap.get(namespace));
0694: out.write(":");
0695: }
0696: out.write(nodeName);
0697: out.write(" xmlns='"); // NOI18N
0698: out
0699: .write("http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"); // NOI18N
0700: out.write("'"); // NOI18N
0701: if (schemaLocation != null) {
0702: namespaceMap.put(
0703: "http://www.w3.org/2001/XMLSchema-instance", "xsi");
0704: out
0705: .write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
0706: out.write(schemaLocation);
0707: out.write("'"); // NOI18N
0708: }
0709: // version is an attribute with namespace http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
0710: if (_Version != null) {
0711: out.write(" version='");
0712: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
0713: .writeXML(out, _Version, true);
0714: out.write("'"); // NOI18N
0715: }
0716: // id is an attribute with namespace http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
0717: if (_Id != null) {
0718: out.write(" id='");
0719: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
0720: .writeXML(out, _Id, true);
0721: out.write("'"); // NOI18N
0722: }
0723: out.write(">\n");
0724: String nextIndent = indent + " ";
0725: for (java.util.Iterator it = _Portlet.iterator(); it.hasNext();) {
0726: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it
0727: .next();
0728: if (element != null) {
0729: element.writeNode(out, "portlet", null, nextIndent,
0730: namespaceMap);
0731: }
0732: }
0733: for (java.util.Iterator it = _CustomPortletMode.iterator(); it
0734: .hasNext();) {
0735: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it
0736: .next();
0737: if (element != null) {
0738: element.writeNode(out, "custom-portlet-mode", null,
0739: nextIndent, namespaceMap);
0740: }
0741: }
0742: for (java.util.Iterator it = _CustomWindowState.iterator(); it
0743: .hasNext();) {
0744: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it
0745: .next();
0746: if (element != null) {
0747: element.writeNode(out, "custom-window-state", null,
0748: nextIndent, namespaceMap);
0749: }
0750: }
0751: for (java.util.Iterator it = _UserAttribute.iterator(); it
0752: .hasNext();) {
0753: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it
0754: .next();
0755: if (element != null) {
0756: element.writeNode(out, "user-attribute", null,
0757: nextIndent, namespaceMap);
0758: }
0759: }
0760: for (java.util.Iterator it = _SecurityConstraint.iterator(); it
0761: .hasNext();) {
0762: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it
0763: .next();
0764: if (element != null) {
0765: element.writeNode(out, "security-constraint", null,
0766: nextIndent, namespaceMap);
0767: }
0768: }
0769: out.write(indent);
0770: out.write("</");
0771: if (namespace != null) {
0772: out.write((String) namespaceMap.get(namespace));
0773: out.write(":");
0774: }
0775: out.write(nodeName);
0776: out.write(">\n");
0777: }
0778:
0779: public static PortletApp read(java.io.File f)
0780: throws javax.xml.parsers.ParserConfigurationException,
0781: org.xml.sax.SAXException, java.io.IOException {
0782: java.io.InputStream in = new java.io.FileInputStream(f);
0783: try {
0784: return read(in);
0785: } finally {
0786: in.close();
0787: }
0788: }
0789:
0790: public static PortletApp read(java.io.InputStream in)
0791: throws javax.xml.parsers.ParserConfigurationException,
0792: org.xml.sax.SAXException, java.io.IOException {
0793: return read(new org.xml.sax.InputSource(in), false, null, null);
0794: }
0795:
0796: /**
0797: * Warning: in readNoEntityResolver character and entity references will
0798: * not be read from any DTD in the XML source.
0799: * However, this way is faster since no DTDs are looked up
0800: * (possibly skipping network access) or parsed.
0801: */
0802: public static PortletApp readNoEntityResolver(java.io.InputStream in)
0803: throws javax.xml.parsers.ParserConfigurationException,
0804: org.xml.sax.SAXException, java.io.IOException {
0805: return read(new org.xml.sax.InputSource(in), false,
0806: new org.xml.sax.EntityResolver() {
0807: public org.xml.sax.InputSource resolveEntity(
0808: String publicId, String systemId) {
0809: java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(
0810: new byte[0]);
0811: return new org.xml.sax.InputSource(bin);
0812: }
0813: }, null);
0814: }
0815:
0816: public static PortletApp read(org.xml.sax.InputSource in,
0817: boolean validate, org.xml.sax.EntityResolver er,
0818: org.xml.sax.ErrorHandler eh)
0819: throws javax.xml.parsers.ParserConfigurationException,
0820: org.xml.sax.SAXException, java.io.IOException {
0821: javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory
0822: .newInstance();
0823: dbf.setValidating(validate);
0824: dbf.setNamespaceAware(true);
0825: javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
0826: if (er != null)
0827: db.setEntityResolver(er);
0828: if (eh != null)
0829: db.setErrorHandler(eh);
0830: org.w3c.dom.Document doc = db.parse(in);
0831: return read(doc);
0832: }
0833:
0834: public static PortletApp read(org.w3c.dom.Document document) {
0835: PortletApp aPortletApp = new PortletApp();
0836: aPortletApp.readFromDocument(document);
0837: return aPortletApp;
0838: }
0839:
0840: protected void readFromDocument(org.w3c.dom.Document document) {
0841: readNode(document.getDocumentElement());
0842: }
0843:
0844: public void readNode(org.w3c.dom.Node node) {
0845: readNode(node, new java.util.HashMap());
0846: }
0847:
0848: public void readNode(org.w3c.dom.Node node,
0849: java.util.Map namespacePrefixes) {
0850: if (node.hasAttributes()) {
0851: org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
0852: org.w3c.dom.Attr attr;
0853: java.lang.String attrValue;
0854: boolean firstNamespaceDef = true;
0855: for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
0856: attr = (org.w3c.dom.Attr) attrs.item(attrNum);
0857: String attrName = attr.getName();
0858: if (attrName.startsWith("xmlns:")) {
0859: if (firstNamespaceDef) {
0860: firstNamespaceDef = false;
0861: // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
0862: namespacePrefixes = new java.util.HashMap(
0863: namespacePrefixes);
0864: }
0865: String attrNSPrefix = attrName.substring(6,
0866: attrName.length());
0867: namespacePrefixes
0868: .put(attrNSPrefix, attr.getValue());
0869: }
0870: }
0871: String xsiPrefix = "xsi";
0872: for (java.util.Iterator it = namespacePrefixes.keySet()
0873: .iterator(); it.hasNext();) {
0874: String prefix = (String) it.next();
0875: String ns = (String) namespacePrefixes.get(prefix);
0876: if ("http://www.w3.org/2001/XMLSchema-instance"
0877: .equals(ns)) {
0878: xsiPrefix = prefix;
0879: break;
0880: }
0881: }
0882: attr = (org.w3c.dom.Attr) attrs.getNamedItem("" + xsiPrefix
0883: + ":schemaLocation");
0884: if (attr != null) {
0885: attrValue = attr.getValue();
0886: schemaLocation = attrValue;
0887: }
0888: attr = (org.w3c.dom.Attr) attrs.getNamedItem("version");
0889: if (attr != null) {
0890: attrValue = attr.getValue();
0891: _Version = attrValue;
0892: }
0893: attr = (org.w3c.dom.Attr) attrs.getNamedItem("id");
0894: if (attr != null) {
0895: attrValue = attr.getValue();
0896: _Id = attrValue;
0897: }
0898: }
0899: org.w3c.dom.NodeList children = node.getChildNodes();
0900: for (int i = 0, size = children.getLength(); i < size; ++i) {
0901: org.w3c.dom.Node childNode = children.item(i);
0902: String childNodeName = (childNode.getLocalName() == null ? childNode
0903: .getNodeName().intern()
0904: : childNode.getLocalName().intern());
0905: String childNodeValue = "";
0906: if (childNode.getFirstChild() != null) {
0907: childNodeValue = childNode.getFirstChild()
0908: .getNodeValue();
0909: }
0910: if (childNodeName == "portlet") {
0911: PortletType aPortlet = newPortletType();
0912: aPortlet.readNode(childNode, namespacePrefixes);
0913: _Portlet.add(aPortlet);
0914: } else if (childNodeName == "custom-portlet-mode") {
0915: CustomPortletModeType aCustomPortletMode = newCustomPortletModeType();
0916: aCustomPortletMode.readNode(childNode,
0917: namespacePrefixes);
0918: _CustomPortletMode.add(aCustomPortletMode);
0919: } else if (childNodeName == "custom-window-state") {
0920: CustomWindowStateType aCustomWindowState = newCustomWindowStateType();
0921: aCustomWindowState.readNode(childNode,
0922: namespacePrefixes);
0923: _CustomWindowState.add(aCustomWindowState);
0924: } else if (childNodeName == "user-attribute") {
0925: UserAttributeType aUserAttribute = newUserAttributeType();
0926: aUserAttribute.readNode(childNode, namespacePrefixes);
0927: _UserAttribute.add(aUserAttribute);
0928: } else if (childNodeName == "security-constraint") {
0929: SecurityConstraintType aSecurityConstraint = newSecurityConstraintType();
0930: aSecurityConstraint.readNode(childNode,
0931: namespacePrefixes);
0932: _SecurityConstraint.add(aSecurityConstraint);
0933: } else {
0934: // Found extra unrecognized childNode
0935: }
0936: }
0937: }
0938:
0939: /**
0940: * Takes some text to be printed into an XML stream and escapes any
0941: * characters that might make it invalid XML (like '<').
0942: */
0943: public static void writeXML(java.io.Writer out, String msg)
0944: throws java.io.IOException {
0945: writeXML(out, msg, true);
0946: }
0947:
0948: public static void writeXML(java.io.Writer out, String msg,
0949: boolean attribute) throws java.io.IOException {
0950: if (msg == null)
0951: return;
0952: int msgLength = msg.length();
0953: for (int i = 0; i < msgLength; ++i) {
0954: char c = msg.charAt(i);
0955: writeXML(out, c, attribute);
0956: }
0957: }
0958:
0959: public static void writeXML(java.io.Writer out, char msg,
0960: boolean attribute) throws java.io.IOException {
0961: if (msg == '&')
0962: out.write("&");
0963: else if (msg == '<')
0964: out.write("<");
0965: else if (msg == '>')
0966: out.write(">");
0967: else if (attribute) {
0968: if (msg == '"')
0969: out.write(""");
0970: else if (msg == '\'')
0971: out.write("'");
0972: else if (msg == '\n')
0973: out.write("
");
0974: else if (msg == '\t')
0975: out.write("	");
0976: else
0977: out.write(msg);
0978: } else
0979: out.write(msg);
0980: }
0981:
0982: public static class ValidateException extends Exception {
0983: private org.netbeans.modules.visualweb.api.portlet.dd.CommonBean failedBean;
0984: private String failedPropertyName;
0985: private FailureType failureType;
0986:
0987: public ValidateException(
0988: String msg,
0989: String failedPropertyName,
0990: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean failedBean) {
0991: super (msg);
0992: this .failedBean = failedBean;
0993: this .failedPropertyName = failedPropertyName;
0994: }
0995:
0996: public ValidateException(
0997: String msg,
0998: FailureType ft,
0999: String failedPropertyName,
1000: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean failedBean) {
1001: super (msg);
1002: this .failureType = ft;
1003: this .failedBean = failedBean;
1004: this .failedPropertyName = failedPropertyName;
1005: }
1006:
1007: public String getFailedPropertyName() {
1008: return failedPropertyName;
1009: }
1010:
1011: public FailureType getFailureType() {
1012: return failureType;
1013: }
1014:
1015: public org.netbeans.modules.visualweb.api.portlet.dd.CommonBean getFailedBean() {
1016: return failedBean;
1017: }
1018:
1019: public static class FailureType {
1020: private final String name;
1021:
1022: private FailureType(String name) {
1023: this .name = name;
1024: }
1025:
1026: public String toString() {
1027: return name;
1028: }
1029:
1030: public static final FailureType NULL_VALUE = new FailureType(
1031: "NULL_VALUE");
1032: public static final FailureType DATA_RESTRICTION = new FailureType(
1033: "DATA_RESTRICTION");
1034: public static final FailureType ENUM_RESTRICTION = new FailureType(
1035: "ENUM_RESTRICTION");
1036: public static final FailureType ALL_RESTRICTIONS = new FailureType(
1037: "ALL_RESTRICTIONS");
1038: public static final FailureType MUTUALLY_EXCLUSIVE = new FailureType(
1039: "MUTUALLY_EXCLUSIVE");
1040: }
1041: }
1042:
1043: public void validate()
1044: throws org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException {
1045: boolean restrictionFailure = false;
1046: boolean restrictionPassed = false;
1047: // Validating property version
1048: if (getVersion() == null) {
1049: throw new org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException(
1050: "getVersion() == null",
1051: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException.FailureType.NULL_VALUE,
1052: "version", this ); // NOI18N
1053: }
1054: // Validating property id
1055: // Validating property portlet
1056: for (int _index = 0; _index < sizePortlet(); ++_index) {
1057: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element = getPortlet(_index);
1058: if (element != null) {
1059: element.validate();
1060: }
1061: }
1062: // Validating property customPortletMode
1063: for (int _index = 0; _index < sizeCustomPortletMode(); ++_index) {
1064: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element = getCustomPortletMode(_index);
1065: if (element != null) {
1066: element.validate();
1067: }
1068: }
1069: // Validating property customWindowState
1070: for (int _index = 0; _index < sizeCustomWindowState(); ++_index) {
1071: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element = getCustomWindowState(_index);
1072: if (element != null) {
1073: element.validate();
1074: }
1075: }
1076: // Validating property userAttribute
1077: for (int _index = 0; _index < sizeUserAttribute(); ++_index) {
1078: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element = getUserAttribute(_index);
1079: if (element != null) {
1080: element.validate();
1081: }
1082: }
1083: // Validating property securityConstraint
1084: for (int _index = 0; _index < sizeSecurityConstraint(); ++_index) {
1085: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element = getSecurityConstraint(_index);
1086: if (element != null) {
1087: element.validate();
1088: }
1089: }
1090: }
1091:
1092: public void changePropertyByName(String name, Object value) {
1093: if (name == null)
1094: return;
1095: name = name.intern();
1096: if (name == "version")
1097: setVersion((java.lang.String) value);
1098: else if (name == "id")
1099: setId((java.lang.String) value);
1100: else if (name == "portlet")
1101: addPortlet((PortletType) value);
1102: else if (name == "portlet[]")
1103: setPortlet((PortletType[]) value);
1104: else if (name == "customPortletMode")
1105: addCustomPortletMode((CustomPortletModeType) value);
1106: else if (name == "customPortletMode[]")
1107: setCustomPortletMode((CustomPortletModeType[]) value);
1108: else if (name == "customWindowState")
1109: addCustomWindowState((CustomWindowStateType) value);
1110: else if (name == "customWindowState[]")
1111: setCustomWindowState((CustomWindowStateType[]) value);
1112: else if (name == "userAttribute")
1113: addUserAttribute((UserAttributeType) value);
1114: else if (name == "userAttribute[]")
1115: setUserAttribute((UserAttributeType[]) value);
1116: else if (name == "securityConstraint")
1117: addSecurityConstraint((SecurityConstraintType) value);
1118: else if (name == "securityConstraint[]")
1119: setSecurityConstraint((SecurityConstraintType[]) value);
1120: else
1121: throw new IllegalArgumentException(name
1122: + " is not a valid property name for PortletApp");
1123: }
1124:
1125: public Object fetchPropertyByName(String name) {
1126: if (name == "version")
1127: return getVersion();
1128: if (name == "id")
1129: return getId();
1130: if (name == "portlet[]")
1131: return getPortlet();
1132: if (name == "customPortletMode[]")
1133: return getCustomPortletMode();
1134: if (name == "customWindowState[]")
1135: return getCustomWindowState();
1136: if (name == "userAttribute[]")
1137: return getUserAttribute();
1138: if (name == "securityConstraint[]")
1139: return getSecurityConstraint();
1140: throw new IllegalArgumentException(name
1141: + " is not a valid property name for PortletApp");
1142: }
1143:
1144: public String nameSelf() {
1145: return "/PortletApp";
1146: }
1147:
1148: public String nameChild(Object childObj) {
1149: return nameChild(childObj, false, false);
1150: }
1151:
1152: /**
1153: * @param childObj The child object to search for
1154: * @param returnSchemaName Whether or not the schema name should be returned or the property name
1155: * @return null if not found
1156: */
1157: public String nameChild(Object childObj, boolean returnConstName,
1158: boolean returnSchemaName) {
1159: return nameChild(childObj, returnConstName, returnSchemaName,
1160: false);
1161: }
1162:
1163: /**
1164: * @param childObj The child object to search for
1165: * @param returnSchemaName Whether or not the schema name should be returned or the property name
1166: * @return null if not found
1167: */
1168: public String nameChild(Object childObj, boolean returnConstName,
1169: boolean returnSchemaName, boolean returnXPathName) {
1170: if (childObj instanceof java.lang.String) {
1171: java.lang.String child = (java.lang.String) childObj;
1172: if (child == _Version) {
1173: if (returnConstName) {
1174: return VERSION;
1175: } else if (returnSchemaName) {
1176: return "version";
1177: } else if (returnXPathName) {
1178: return "@version";
1179: } else {
1180: return "Version";
1181: }
1182: }
1183: if (child == _Id) {
1184: if (returnConstName) {
1185: return ID;
1186: } else if (returnSchemaName) {
1187: return "id";
1188: } else if (returnXPathName) {
1189: return "@id";
1190: } else {
1191: return "Id";
1192: }
1193: }
1194: }
1195: if (childObj instanceof SecurityConstraintType) {
1196: SecurityConstraintType child = (SecurityConstraintType) childObj;
1197: int index = 0;
1198: for (java.util.Iterator it = _SecurityConstraint.iterator(); it
1199: .hasNext();) {
1200: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it
1201: .next();
1202: if (child == element) {
1203: if (returnConstName) {
1204: return SECURITY_CONSTRAINT;
1205: } else if (returnSchemaName) {
1206: return "security-constraint";
1207: } else if (returnXPathName) {
1208: return "security-constraint[position()="
1209: + index + "]";
1210: } else {
1211: return "SecurityConstraint."
1212: + Integer.toHexString(index);
1213: }
1214: }
1215: ++index;
1216: }
1217: }
1218: if (childObj instanceof CustomWindowStateType) {
1219: CustomWindowStateType child = (CustomWindowStateType) childObj;
1220: int index = 0;
1221: for (java.util.Iterator it = _CustomWindowState.iterator(); it
1222: .hasNext();) {
1223: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it
1224: .next();
1225: if (child == element) {
1226: if (returnConstName) {
1227: return CUSTOM_WINDOW_STATE;
1228: } else if (returnSchemaName) {
1229: return "custom-window-state";
1230: } else if (returnXPathName) {
1231: return "custom-window-state[position()="
1232: + index + "]";
1233: } else {
1234: return "CustomWindowState."
1235: + Integer.toHexString(index);
1236: }
1237: }
1238: ++index;
1239: }
1240: }
1241: if (childObj instanceof PortletType) {
1242: PortletType child = (PortletType) childObj;
1243: int index = 0;
1244: for (java.util.Iterator it = _Portlet.iterator(); it
1245: .hasNext();) {
1246: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it
1247: .next();
1248: if (child == element) {
1249: if (returnConstName) {
1250: return PORTLET;
1251: } else if (returnSchemaName) {
1252: return "portlet";
1253: } else if (returnXPathName) {
1254: return "portlet[position()=" + index + "]";
1255: } else {
1256: return "Portlet." + Integer.toHexString(index);
1257: }
1258: }
1259: ++index;
1260: }
1261: }
1262: if (childObj instanceof UserAttributeType) {
1263: UserAttributeType child = (UserAttributeType) childObj;
1264: int index = 0;
1265: for (java.util.Iterator it = _UserAttribute.iterator(); it
1266: .hasNext();) {
1267: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it
1268: .next();
1269: if (child == element) {
1270: if (returnConstName) {
1271: return USER_ATTRIBUTE;
1272: } else if (returnSchemaName) {
1273: return "user-attribute";
1274: } else if (returnXPathName) {
1275: return "user-attribute[position()=" + index
1276: + "]";
1277: } else {
1278: return "UserAttribute."
1279: + Integer.toHexString(index);
1280: }
1281: }
1282: ++index;
1283: }
1284: }
1285: if (childObj instanceof CustomPortletModeType) {
1286: CustomPortletModeType child = (CustomPortletModeType) childObj;
1287: int index = 0;
1288: for (java.util.Iterator it = _CustomPortletMode.iterator(); it
1289: .hasNext();) {
1290: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it
1291: .next();
1292: if (child == element) {
1293: if (returnConstName) {
1294: return CUSTOM_PORTLET_MODE;
1295: } else if (returnSchemaName) {
1296: return "custom-portlet-mode";
1297: } else if (returnXPathName) {
1298: return "custom-portlet-mode[position()="
1299: + index + "]";
1300: } else {
1301: return "CustomPortletMode."
1302: + Integer.toHexString(index);
1303: }
1304: }
1305: ++index;
1306: }
1307: }
1308: return null;
1309: }
1310:
1311: /**
1312: * Return an array of all of the properties that are beans and are set.
1313: */
1314: public org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] childBeans(
1315: boolean recursive) {
1316: java.util.List children = new java.util.LinkedList();
1317: childBeans(recursive, children);
1318: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] result = new org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[children
1319: .size()];
1320: return (org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[]) children
1321: .toArray(result);
1322: }
1323:
1324: /**
1325: * Put all child beans into the beans list.
1326: */
1327: public void childBeans(boolean recursive, java.util.List beans) {
1328: for (java.util.Iterator it = _Portlet.iterator(); it.hasNext();) {
1329: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it
1330: .next();
1331: if (element != null) {
1332: if (recursive) {
1333: element.childBeans(true, beans);
1334: }
1335: beans.add(element);
1336: }
1337: }
1338: for (java.util.Iterator it = _CustomPortletMode.iterator(); it
1339: .hasNext();) {
1340: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it
1341: .next();
1342: if (element != null) {
1343: if (recursive) {
1344: element.childBeans(true, beans);
1345: }
1346: beans.add(element);
1347: }
1348: }
1349: for (java.util.Iterator it = _CustomWindowState.iterator(); it
1350: .hasNext();) {
1351: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it
1352: .next();
1353: if (element != null) {
1354: if (recursive) {
1355: element.childBeans(true, beans);
1356: }
1357: beans.add(element);
1358: }
1359: }
1360: for (java.util.Iterator it = _UserAttribute.iterator(); it
1361: .hasNext();) {
1362: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it
1363: .next();
1364: if (element != null) {
1365: if (recursive) {
1366: element.childBeans(true, beans);
1367: }
1368: beans.add(element);
1369: }
1370: }
1371: for (java.util.Iterator it = _SecurityConstraint.iterator(); it
1372: .hasNext();) {
1373: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it
1374: .next();
1375: if (element != null) {
1376: if (recursive) {
1377: element.childBeans(true, beans);
1378: }
1379: beans.add(element);
1380: }
1381: }
1382: }
1383:
1384: public boolean equals(Object o) {
1385: return o instanceof org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
1386: && equals((org.netbeans.modules.visualweb.api.portlet.dd.PortletApp) o);
1387: }
1388:
1389: public boolean equals(
1390: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp inst) {
1391: if (inst == this ) {
1392: return true;
1393: }
1394: if (inst == null) {
1395: return false;
1396: }
1397: if (!(_Version == null ? inst._Version == null : _Version
1398: .equals(inst._Version))) {
1399: return false;
1400: }
1401: if (!(_Id == null ? inst._Id == null : _Id.equals(inst._Id))) {
1402: return false;
1403: }
1404: if (sizePortlet() != inst.sizePortlet())
1405: return false;
1406: // Compare every element.
1407: for (java.util.Iterator it = _Portlet.iterator(), it2 = inst._Portlet
1408: .iterator(); it.hasNext() && it2.hasNext();) {
1409: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it
1410: .next();
1411: org.netbeans.modules.visualweb.api.portlet.dd.PortletType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.PortletType) it2
1412: .next();
1413: if (!(element == null ? element2 == null : element
1414: .equals(element2))) {
1415: return false;
1416: }
1417: }
1418: if (sizeCustomPortletMode() != inst.sizeCustomPortletMode())
1419: return false;
1420: // Compare every element.
1421: for (java.util.Iterator it = _CustomPortletMode.iterator(), it2 = inst._CustomPortletMode
1422: .iterator(); it.hasNext() && it2.hasNext();) {
1423: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it
1424: .next();
1425: org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.CustomPortletModeType) it2
1426: .next();
1427: if (!(element == null ? element2 == null : element
1428: .equals(element2))) {
1429: return false;
1430: }
1431: }
1432: if (sizeCustomWindowState() != inst.sizeCustomWindowState())
1433: return false;
1434: // Compare every element.
1435: for (java.util.Iterator it = _CustomWindowState.iterator(), it2 = inst._CustomWindowState
1436: .iterator(); it.hasNext() && it2.hasNext();) {
1437: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it
1438: .next();
1439: org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.CustomWindowStateType) it2
1440: .next();
1441: if (!(element == null ? element2 == null : element
1442: .equals(element2))) {
1443: return false;
1444: }
1445: }
1446: if (sizeUserAttribute() != inst.sizeUserAttribute())
1447: return false;
1448: // Compare every element.
1449: for (java.util.Iterator it = _UserAttribute.iterator(), it2 = inst._UserAttribute
1450: .iterator(); it.hasNext() && it2.hasNext();) {
1451: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it
1452: .next();
1453: org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.UserAttributeType) it2
1454: .next();
1455: if (!(element == null ? element2 == null : element
1456: .equals(element2))) {
1457: return false;
1458: }
1459: }
1460: if (sizeSecurityConstraint() != inst.sizeSecurityConstraint())
1461: return false;
1462: // Compare every element.
1463: for (java.util.Iterator it = _SecurityConstraint.iterator(), it2 = inst._SecurityConstraint
1464: .iterator(); it.hasNext() && it2.hasNext();) {
1465: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it
1466: .next();
1467: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) it2
1468: .next();
1469: if (!(element == null ? element2 == null : element
1470: .equals(element2))) {
1471: return false;
1472: }
1473: }
1474: return true;
1475: }
1476:
1477: public int hashCode() {
1478: int result = 17;
1479: result = 37 * result
1480: + (_Version == null ? 0 : _Version.hashCode());
1481: result = 37 * result + (_Id == null ? 0 : _Id.hashCode());
1482: result = 37 * result
1483: + (_Portlet == null ? 0 : _Portlet.hashCode());
1484: result = 37
1485: * result
1486: + (_CustomPortletMode == null ? 0 : _CustomPortletMode
1487: .hashCode());
1488: result = 37
1489: * result
1490: + (_CustomWindowState == null ? 0 : _CustomWindowState
1491: .hashCode());
1492: result = 37
1493: * result
1494: + (_UserAttribute == null ? 0 : _UserAttribute
1495: .hashCode());
1496: result = 37
1497: * result
1498: + (_SecurityConstraint == null ? 0
1499: : _SecurityConstraint.hashCode());
1500: return result;
1501: }
1502:
1503: public String toString() {
1504: java.io.StringWriter sw = new java.io.StringWriter();
1505: try {
1506: writeNode(sw);
1507: } catch (java.io.IOException e) {
1508: // How can we actually get an IOException on a StringWriter?
1509: throw new RuntimeException(e);
1510: }
1511: return sw.toString();
1512: }
1513:
1514: }
|