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: * This generated bean class SecurityConstraintType
043: * matches the schema element 'security-constraintType'.
044: * The root bean class is PortletApp
045: *
046: * ===============================================================
047: *
048: * The security-constraintType is used to associate
049: * intended security constraints with one or more portlets.
050: * Used in: portlet-app
051: *
052: * ===============================================================
053: * Generated on Tue Apr 26 19:08:25 MDT 2005
054: * @Generated
055: */package org.netbeans.modules.visualweb.api.portlet.dd;
056:
057: public class SecurityConstraintType
058: implements
059: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintTypeInterface,
060: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean {
061: public static final String ID = "Id"; // NOI18N
062: public static final String DISPLAY_NAME = "DisplayName"; // NOI18N
063: public static final String DISPLAYNAMEXMLLANG = "DisplayNameXmlLang"; // NOI18N
064: public static final String PORTLET_COLLECTION = "PortletCollection"; // NOI18N
065: public static final String USER_DATA_CONSTRAINT = "UserDataConstraint"; // NOI18N
066:
067: private java.lang.String _Id;
068: private java.util.List _DisplayName = new java.util.ArrayList(); // List<java.lang.String>
069: private java.util.List _DisplayNameXmlLang = new java.util.ArrayList(); // List<java.lang.String>
070: private PortletCollectionType _PortletCollection;
071: private UserDataConstraintType _UserDataConstraint;
072:
073: /**
074: * Normal starting point constructor.
075: */
076: public SecurityConstraintType() {
077: _PortletCollection = newPortletCollectionType();
078: _UserDataConstraint = newUserDataConstraintType();
079: }
080:
081: /**
082: * Required parameters constructor
083: */
084: public SecurityConstraintType(
085: org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType portletCollection,
086: org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType userDataConstraint) {
087: _PortletCollection = portletCollection;
088: _UserDataConstraint = userDataConstraint;
089: }
090:
091: /**
092: * Deep copy
093: */
094: public SecurityConstraintType(
095: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType source) {
096: this (source, false);
097: }
098:
099: /**
100: * Deep copy
101: * @param justData just copy the XML relevant data
102: */
103: public SecurityConstraintType(
104: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType source,
105: boolean justData) {
106: _Id = source._Id;
107: for (java.util.Iterator it = source._DisplayName.iterator(); it
108: .hasNext();) {
109: java.lang.String srcElement = (java.lang.String) it.next();
110: _DisplayName.add(srcElement);
111: }
112: for (java.util.Iterator it = source._DisplayNameXmlLang
113: .iterator(); it.hasNext();) {
114: java.lang.String srcElement = (java.lang.String) it.next();
115: _DisplayNameXmlLang.add(srcElement);
116: }
117: _PortletCollection = (source._PortletCollection == null) ? null
118: : newPortletCollectionType(source._PortletCollection,
119: justData);
120: _UserDataConstraint = (source._UserDataConstraint == null) ? null
121: : newUserDataConstraintType(source._UserDataConstraint,
122: justData);
123: }
124:
125: // This attribute is optional
126: public void setId(java.lang.String value) {
127: _Id = value;
128: }
129:
130: public java.lang.String getId() {
131: return _Id;
132: }
133:
134: // This attribute is an array, possibly empty
135: public void setDisplayName(java.lang.String[] value) {
136: if (value == null)
137: value = new java.lang.String[0];
138: _DisplayName.clear();
139: ((java.util.ArrayList) _DisplayName)
140: .ensureCapacity(value.length);
141: for (int i = 0; i < value.length; ++i) {
142: _DisplayName.add(value[i]);
143: }
144: }
145:
146: public void setDisplayName(int index, java.lang.String value) {
147: _DisplayName.set(index, value);
148: }
149:
150: public java.lang.String[] getDisplayName() {
151: java.lang.String[] arr = new java.lang.String[_DisplayName
152: .size()];
153: return (java.lang.String[]) _DisplayName.toArray(arr);
154: }
155:
156: public java.util.List fetchDisplayNameList() {
157: return _DisplayName;
158: }
159:
160: public java.lang.String getDisplayName(int index) {
161: return (java.lang.String) _DisplayName.get(index);
162: }
163:
164: // Return the number of displayName
165: public int sizeDisplayName() {
166: return _DisplayName.size();
167: }
168:
169: public int addDisplayName(java.lang.String value) {
170: _DisplayName.add(value);
171: int positionOfNewItem = _DisplayName.size() - 1;
172: return positionOfNewItem;
173: }
174:
175: /**
176: * Search from the end looking for @param value, and then remove it.
177: */
178: public int removeDisplayName(java.lang.String value) {
179: int pos = _DisplayName.indexOf(value);
180: if (pos >= 0) {
181: _DisplayName.remove(pos);
182: }
183: return pos;
184: }
185:
186: // This attribute is an array, possibly empty
187: public void setDisplayNameXmlLang(java.lang.String[] value) {
188: if (value == null)
189: value = new java.lang.String[0];
190: _DisplayNameXmlLang.clear();
191: ((java.util.ArrayList) _DisplayNameXmlLang)
192: .ensureCapacity(value.length);
193: for (int i = 0; i < value.length; ++i) {
194: _DisplayNameXmlLang.add(value[i]);
195: }
196: }
197:
198: public void setDisplayNameXmlLang(int index, java.lang.String value) {
199: for (int size = _DisplayNameXmlLang.size(); index >= size; ++size) {
200: _DisplayNameXmlLang.add(null);
201: }
202: _DisplayNameXmlLang.set(index, value);
203: }
204:
205: public java.lang.String[] getDisplayNameXmlLang() {
206: java.lang.String[] arr = new java.lang.String[_DisplayNameXmlLang
207: .size()];
208: return (java.lang.String[]) _DisplayNameXmlLang.toArray(arr);
209: }
210:
211: public java.util.List fetchDisplayNameXmlLangList() {
212: return _DisplayNameXmlLang;
213: }
214:
215: public java.lang.String getDisplayNameXmlLang(int index) {
216: return (java.lang.String) _DisplayNameXmlLang.get(index);
217: }
218:
219: // Return the number of displayNameXmlLang
220: public int sizeDisplayNameXmlLang() {
221: return _DisplayNameXmlLang.size();
222: }
223:
224: public int addDisplayNameXmlLang(java.lang.String value) {
225: _DisplayNameXmlLang.add(value);
226: int positionOfNewItem = _DisplayNameXmlLang.size() - 1;
227: return positionOfNewItem;
228: }
229:
230: /**
231: * Search from the end looking for @param value, and then remove it.
232: */
233: public int removeDisplayNameXmlLang(java.lang.String value) {
234: int pos = _DisplayNameXmlLang.indexOf(value);
235: if (pos >= 0) {
236: _DisplayNameXmlLang.remove(pos);
237: }
238: return pos;
239: }
240:
241: // This attribute is mandatory
242: public void setPortletCollection(
243: org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType value) {
244: _PortletCollection = value;
245: }
246:
247: public org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType getPortletCollection() {
248: return _PortletCollection;
249: }
250:
251: // This attribute is mandatory
252: public void setUserDataConstraint(
253: org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType value) {
254: _UserDataConstraint = value;
255: }
256:
257: public org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType getUserDataConstraint() {
258: return _UserDataConstraint;
259: }
260:
261: /**
262: * Create a new bean using it's default constructor.
263: * This does not add it to any bean graph.
264: */
265: public org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType newPortletCollectionType() {
266: return new org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType();
267: }
268:
269: /**
270: * Create a new bean, copying from another one.
271: * This does not add it to any bean graph.
272: */
273: public org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType newPortletCollectionType(
274: PortletCollectionType source, boolean justData) {
275: return new org.netbeans.modules.visualweb.api.portlet.dd.PortletCollectionType(
276: source, justData);
277: }
278:
279: /**
280: * Create a new bean using it's default constructor.
281: * This does not add it to any bean graph.
282: */
283: public org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType newUserDataConstraintType() {
284: return new org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType();
285: }
286:
287: /**
288: * Create a new bean, copying from another one.
289: * This does not add it to any bean graph.
290: */
291: public org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType newUserDataConstraintType(
292: UserDataConstraintType source, boolean justData) {
293: return new org.netbeans.modules.visualweb.api.portlet.dd.UserDataConstraintType(
294: source, justData);
295: }
296:
297: public void writeNode(java.io.Writer out)
298: throws java.io.IOException {
299: String myName;
300: myName = "security-constraintType";
301: writeNode(out, myName, ""); // NOI18N
302: }
303:
304: public void writeNode(java.io.Writer out, String nodeName,
305: String indent) throws java.io.IOException {
306: writeNode(out, nodeName, null, indent, new java.util.HashMap());
307: }
308:
309: /**
310: * It's not recommended to call this method directly.
311: */
312: public void writeNode(java.io.Writer out, String nodeName,
313: String namespace, String indent, java.util.Map namespaceMap)
314: throws java.io.IOException {
315: out.write(indent);
316: out.write("<");
317: if (namespace != null) {
318: out.write((String) namespaceMap.get(namespace));
319: out.write(":");
320: }
321: out.write(nodeName);
322: // id is an attribute with namespace http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
323: if (_Id != null) {
324: out.write(" id='");
325: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
326: .writeXML(out, _Id, true);
327: out.write("'"); // NOI18N
328: }
329: out.write(">\n");
330: String nextIndent = indent + " ";
331: int index = 0;
332: for (java.util.Iterator it = _DisplayName.iterator(); it
333: .hasNext();) {
334: java.lang.String element = (java.lang.String) it.next();
335: if (element != null) {
336: out.write(nextIndent);
337: out.write("<display-name"); // NOI18N
338: if (index < sizeDisplayNameXmlLang()) {
339: // xml:lang is an attribute with namespace http://www.w3.org/XML/1998/namespace
340: if (getDisplayNameXmlLang(index) != null) {
341: out.write(" xml:lang='");
342: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
343: .writeXML(out,
344: getDisplayNameXmlLang(index),
345: true);
346: out.write("'"); // NOI18N
347: }
348: }
349: out.write(">"); // NOI18N
350: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
351: .writeXML(out, element, false);
352: out.write("</display-name>\n"); // NOI18N
353: }
354: ++index;
355: }
356: if (_PortletCollection != null) {
357: _PortletCollection.writeNode(out, "portlet-collection",
358: null, nextIndent, namespaceMap);
359: }
360: if (_UserDataConstraint != null) {
361: _UserDataConstraint.writeNode(out, "user-data-constraint",
362: null, nextIndent, namespaceMap);
363: }
364: out.write(indent);
365: out.write("</");
366: if (namespace != null) {
367: out.write((String) namespaceMap.get(namespace));
368: out.write(":");
369: }
370: out.write(nodeName);
371: out.write(">\n");
372: }
373:
374: public void readNode(org.w3c.dom.Node node) {
375: readNode(node, new java.util.HashMap());
376: }
377:
378: public void readNode(org.w3c.dom.Node node,
379: java.util.Map namespacePrefixes) {
380: if (node.hasAttributes()) {
381: org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
382: org.w3c.dom.Attr attr;
383: java.lang.String attrValue;
384: boolean firstNamespaceDef = true;
385: for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
386: attr = (org.w3c.dom.Attr) attrs.item(attrNum);
387: String attrName = attr.getName();
388: if (attrName.startsWith("xmlns:")) {
389: if (firstNamespaceDef) {
390: firstNamespaceDef = false;
391: // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
392: namespacePrefixes = new java.util.HashMap(
393: namespacePrefixes);
394: }
395: String attrNSPrefix = attrName.substring(6,
396: attrName.length());
397: namespacePrefixes
398: .put(attrNSPrefix, attr.getValue());
399: }
400: }
401: attr = (org.w3c.dom.Attr) attrs.getNamedItem("id");
402: if (attr != null) {
403: attrValue = attr.getValue();
404: _Id = attrValue;
405: }
406: }
407: org.w3c.dom.NodeList children = node.getChildNodes();
408: for (int i = 0, size = children.getLength(); i < size; ++i) {
409: org.w3c.dom.Node childNode = children.item(i);
410: String childNodeName = (childNode.getLocalName() == null ? childNode
411: .getNodeName().intern()
412: : childNode.getLocalName().intern());
413: String childNodeValue = "";
414: if (childNode.getFirstChild() != null) {
415: childNodeValue = childNode.getFirstChild()
416: .getNodeValue();
417: }
418: org.w3c.dom.NamedNodeMap attrs = childNode.getAttributes();
419: org.w3c.dom.Attr attr;
420: java.lang.String attrValue;
421: if (childNodeName == "display-name") {
422: java.lang.String aDisplayName;
423: aDisplayName = childNodeValue;
424: attr = (org.w3c.dom.Attr) attrs
425: .getNamedItem("xml:lang");
426: if (attr != null) {
427: attrValue = attr.getValue();
428: } else {
429: attrValue = null;
430: }
431: java.lang.String processedValueFor_DisplayNameXmlLang;
432: processedValueFor_DisplayNameXmlLang = attrValue;
433: addDisplayNameXmlLang(processedValueFor_DisplayNameXmlLang);
434: _DisplayName.add(aDisplayName);
435: } else if (childNodeName == "portlet-collection") {
436: _PortletCollection = newPortletCollectionType();
437: _PortletCollection.readNode(childNode,
438: namespacePrefixes);
439: } else if (childNodeName == "user-data-constraint") {
440: _UserDataConstraint = newUserDataConstraintType();
441: _UserDataConstraint.readNode(childNode,
442: namespacePrefixes);
443: } else {
444: // Found extra unrecognized childNode
445: }
446: }
447: }
448:
449: public void validate()
450: throws org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException {
451: boolean restrictionFailure = false;
452: boolean restrictionPassed = false;
453: // Validating property id
454: // Validating property displayName
455: for (int _index = 0; _index < sizeDisplayName(); ++_index) {
456: java.lang.String element = getDisplayName(_index);
457: if (element != null) {
458: // has whitespace restriction
459: if (restrictionFailure) {
460: throw new org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException(
461: "element whiteSpace (collapse)",
462: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException.FailureType.DATA_RESTRICTION,
463: "displayName", this ); // NOI18N
464: }
465: }
466: }
467: // Validating property displayNameXmlLang
468: // Validating property portletCollection
469: if (getPortletCollection() == null) {
470: throw new org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException(
471: "getPortletCollection() == null",
472: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException.FailureType.NULL_VALUE,
473: "portletCollection", this ); // NOI18N
474: }
475: getPortletCollection().validate();
476: // Validating property userDataConstraint
477: if (getUserDataConstraint() == null) {
478: throw new org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException(
479: "getUserDataConstraint() == null",
480: org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException.FailureType.NULL_VALUE,
481: "userDataConstraint", this ); // NOI18N
482: }
483: getUserDataConstraint().validate();
484: }
485:
486: public void changePropertyByName(String name, Object value) {
487: if (name == null)
488: return;
489: name = name.intern();
490: if (name == "id")
491: setId((java.lang.String) value);
492: else if (name == "displayName")
493: addDisplayName((java.lang.String) value);
494: else if (name == "displayName[]")
495: setDisplayName((java.lang.String[]) value);
496: else if (name == "displayNameXmlLang")
497: addDisplayNameXmlLang((java.lang.String) value);
498: else if (name == "displayNameXmlLang[]")
499: setDisplayNameXmlLang((java.lang.String[]) value);
500: else if (name == "portletCollection")
501: setPortletCollection((PortletCollectionType) value);
502: else if (name == "userDataConstraint")
503: setUserDataConstraint((UserDataConstraintType) value);
504: else
505: throw new IllegalArgumentException(
506: name
507: + " is not a valid property name for SecurityConstraintType");
508: }
509:
510: public Object fetchPropertyByName(String name) {
511: if (name == "id")
512: return getId();
513: if (name == "displayName[]")
514: return getDisplayName();
515: if (name == "displayNameXmlLang[]")
516: return getDisplayNameXmlLang();
517: if (name == "portletCollection")
518: return getPortletCollection();
519: if (name == "userDataConstraint")
520: return getUserDataConstraint();
521: throw new IllegalArgumentException(
522: name
523: + " is not a valid property name for SecurityConstraintType");
524: }
525:
526: public String nameSelf() {
527: return "SecurityConstraintType";
528: }
529:
530: public String nameChild(Object childObj) {
531: return nameChild(childObj, false, false);
532: }
533:
534: /**
535: * @param childObj The child object to search for
536: * @param returnSchemaName Whether or not the schema name should be returned or the property name
537: * @return null if not found
538: */
539: public String nameChild(Object childObj, boolean returnConstName,
540: boolean returnSchemaName) {
541: return nameChild(childObj, returnConstName, returnSchemaName,
542: false);
543: }
544:
545: /**
546: * @param childObj The child object to search for
547: * @param returnSchemaName Whether or not the schema name should be returned or the property name
548: * @return null if not found
549: */
550: public String nameChild(Object childObj, boolean returnConstName,
551: boolean returnSchemaName, boolean returnXPathName) {
552: if (childObj instanceof java.lang.String) {
553: java.lang.String child = (java.lang.String) childObj;
554: if (child == _Id) {
555: if (returnConstName) {
556: return ID;
557: } else if (returnSchemaName) {
558: return "id";
559: } else if (returnXPathName) {
560: return "@id";
561: } else {
562: return "Id";
563: }
564: }
565: int index = 0;
566: for (java.util.Iterator it = _DisplayName.iterator(); it
567: .hasNext();) {
568: java.lang.String element = (java.lang.String) it.next();
569: if (child == element) {
570: if (returnConstName) {
571: return DISPLAY_NAME;
572: } else if (returnSchemaName) {
573: return "display-name";
574: } else if (returnXPathName) {
575: return "display-name[position()=" + index + "]";
576: } else {
577: return "DisplayName."
578: + Integer.toHexString(index);
579: }
580: }
581: ++index;
582: }
583: index = 0;
584: for (java.util.Iterator it = _DisplayNameXmlLang.iterator(); it
585: .hasNext();) {
586: java.lang.String element = (java.lang.String) it.next();
587: if (child == element) {
588: if (returnConstName) {
589: return DISPLAYNAMEXMLLANG;
590: } else if (returnSchemaName) {
591: return "xml:lang";
592: } else if (returnXPathName) {
593: return "@xml:lang[position()=" + index + "]";
594: } else {
595: return "DisplayNameXmlLang."
596: + Integer.toHexString(index);
597: }
598: }
599: ++index;
600: }
601: }
602: if (childObj instanceof UserDataConstraintType) {
603: UserDataConstraintType child = (UserDataConstraintType) childObj;
604: if (child == _UserDataConstraint) {
605: if (returnConstName) {
606: return USER_DATA_CONSTRAINT;
607: } else if (returnSchemaName) {
608: return "user-data-constraint";
609: } else if (returnXPathName) {
610: return "user-data-constraint";
611: } else {
612: return "UserDataConstraint";
613: }
614: }
615: }
616: if (childObj instanceof PortletCollectionType) {
617: PortletCollectionType child = (PortletCollectionType) childObj;
618: if (child == _PortletCollection) {
619: if (returnConstName) {
620: return PORTLET_COLLECTION;
621: } else if (returnSchemaName) {
622: return "portlet-collection";
623: } else if (returnXPathName) {
624: return "portlet-collection";
625: } else {
626: return "PortletCollection";
627: }
628: }
629: }
630: return null;
631: }
632:
633: /**
634: * Return an array of all of the properties that are beans and are set.
635: */
636: public org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] childBeans(
637: boolean recursive) {
638: java.util.List children = new java.util.LinkedList();
639: childBeans(recursive, children);
640: org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] result = new org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[children
641: .size()];
642: return (org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[]) children
643: .toArray(result);
644: }
645:
646: /**
647: * Put all child beans into the beans list.
648: */
649: public void childBeans(boolean recursive, java.util.List beans) {
650: if (_PortletCollection != null) {
651: if (recursive) {
652: _PortletCollection.childBeans(true, beans);
653: }
654: beans.add(_PortletCollection);
655: }
656: if (_UserDataConstraint != null) {
657: if (recursive) {
658: _UserDataConstraint.childBeans(true, beans);
659: }
660: beans.add(_UserDataConstraint);
661: }
662: }
663:
664: public boolean equals(Object o) {
665: return o instanceof org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType
666: && equals((org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType) o);
667: }
668:
669: public boolean equals(
670: org.netbeans.modules.visualweb.api.portlet.dd.SecurityConstraintType inst) {
671: if (inst == this ) {
672: return true;
673: }
674: if (inst == null) {
675: return false;
676: }
677: if (!(_Id == null ? inst._Id == null : _Id.equals(inst._Id))) {
678: return false;
679: }
680: if (sizeDisplayName() != inst.sizeDisplayName())
681: return false;
682: // Compare every element.
683: for (java.util.Iterator it = _DisplayName.iterator(), it2 = inst._DisplayName
684: .iterator(); it.hasNext() && it2.hasNext();) {
685: java.lang.String element = (java.lang.String) it.next();
686: java.lang.String element2 = (java.lang.String) it2.next();
687: if (!(element == null ? element2 == null : element
688: .equals(element2))) {
689: return false;
690: }
691: }
692: if (sizeDisplayNameXmlLang() != inst.sizeDisplayNameXmlLang())
693: return false;
694: // Compare every element.
695: for (java.util.Iterator it = _DisplayNameXmlLang.iterator(), it2 = inst._DisplayNameXmlLang
696: .iterator(); it.hasNext() && it2.hasNext();) {
697: java.lang.String element = (java.lang.String) it.next();
698: java.lang.String element2 = (java.lang.String) it2.next();
699: if (!(element == null ? element2 == null : element
700: .equals(element2))) {
701: return false;
702: }
703: }
704: if (!(_PortletCollection == null ? inst._PortletCollection == null
705: : _PortletCollection.equals(inst._PortletCollection))) {
706: return false;
707: }
708: if (!(_UserDataConstraint == null ? inst._UserDataConstraint == null
709: : _UserDataConstraint.equals(inst._UserDataConstraint))) {
710: return false;
711: }
712: return true;
713: }
714:
715: public int hashCode() {
716: int result = 17;
717: result = 37 * result + (_Id == null ? 0 : _Id.hashCode());
718: result = 37 * result
719: + (_DisplayName == null ? 0 : _DisplayName.hashCode());
720: result = 37
721: * result
722: + (_DisplayNameXmlLang == null ? 0
723: : _DisplayNameXmlLang.hashCode());
724: result = 37
725: * result
726: + (_PortletCollection == null ? 0 : _PortletCollection
727: .hashCode());
728: result = 37
729: * result
730: + (_UserDataConstraint == null ? 0
731: : _UserDataConstraint.hashCode());
732: return result;
733: }
734:
735: public String toString() {
736: java.io.StringWriter sw = new java.io.StringWriter();
737: try {
738: writeNode(sw);
739: } catch (java.io.IOException e) {
740: // How can we actually get an IOException on a StringWriter?
741: throw new RuntimeException(e);
742: }
743: return sw.toString();
744: }
745:
746: }
|