001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * Initial developer: JOnAS team
023: * --------------------------------------------------------------------------
024: * $Id: EjbRelationshipRole.java 4716 2004-05-10 11:45:44Z sauthieg $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ejb.deployment.xml;
027:
028: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
029:
030: /**
031: * This class defines the implementation of the element ejb-relationship-role
032: *
033: * @author JOnAS team
034: */
035:
036: public class EjbRelationshipRole extends AbsElement {
037:
038: /**
039: * description
040: */
041: private String description = null;
042:
043: /**
044: * ejb-relationship-role-name
045: */
046: private String ejbRelationshipRoleName = null;
047:
048: /**
049: * multiplicity
050: */
051: private String multiplicity = null;
052:
053: /**
054: * cascade-delete
055: */
056: private boolean cascadeDelete = false;
057:
058: /**
059: * relationship-role-source
060: */
061: private RelationshipRoleSource relationshipRoleSource = null;
062:
063: /**
064: * cmr-field
065: */
066: private CmrField cmrField = null;
067:
068: /**
069: * Constructor
070: */
071: public EjbRelationshipRole() {
072: super ();
073: }
074:
075: /**
076: * Gets the description
077: * @return the description
078: */
079: public String getDescription() {
080: return description;
081: }
082:
083: /**
084: * Set the description
085: * @param description description
086: */
087: public void setDescription(String description) {
088: this .description = description;
089: }
090:
091: /**
092: * Gets the ejb-relationship-role-name
093: * @return the ejb-relationship-role-name
094: */
095: public String getEjbRelationshipRoleName() {
096: return ejbRelationshipRoleName;
097: }
098:
099: /**
100: * Set the ejb-relationship-role-name
101: * @param ejbRelationshipRoleName ejbRelationshipRoleName
102: */
103: public void setEjbRelationshipRoleName(
104: String ejbRelationshipRoleName) {
105: this .ejbRelationshipRoleName = ejbRelationshipRoleName;
106: }
107:
108: /**
109: * Gets the multiplicity
110: * @return the multiplicity
111: */
112: public String getMultiplicity() {
113: return multiplicity;
114: }
115:
116: /**
117: * Set the multiplicity
118: * @param multiplicity multiplicity
119: */
120: public void setMultiplicity(String multiplicity) {
121: this .multiplicity = multiplicity;
122: }
123:
124: /**
125: * Gets the cascade-delete
126: * @return true if cascade-delete
127: */
128: public boolean isCascadeDelete() {
129: return cascadeDelete;
130: }
131:
132: /**
133: * Set the cascade-delete
134: */
135: public void setCascadeDelete() {
136: this .cascadeDelete = true;
137: }
138:
139: /**
140: * Gets the relationship-role-source
141: * @return the relationship-role-source
142: */
143: public RelationshipRoleSource getRelationshipRoleSource() {
144: return relationshipRoleSource;
145: }
146:
147: /**
148: * Set the relationship-role-source
149: * @param relationshipRoleSource relationshipRoleSource
150: */
151: public void setRelationshipRoleSource(
152: RelationshipRoleSource relationshipRoleSource) {
153: this .relationshipRoleSource = relationshipRoleSource;
154: }
155:
156: /**
157: * Gets the cmr-field
158: * @return the cmr-field
159: */
160: public CmrField getCmrField() {
161: return cmrField;
162: }
163:
164: /**
165: * Set the cmr-field
166: * @param cmrField cmrField
167: */
168: public void setCmrField(CmrField cmrField) {
169: this .cmrField = cmrField;
170: }
171:
172: /**
173: * Represents this element by it's XML description.
174: * @param indent use this indent for prexifing XML representation.
175: * @return the XML description of this object.
176: */
177: public String toXML(int indent) {
178: StringBuffer sb = new StringBuffer();
179: sb.append(indent(indent));
180: sb.append("<ejb-relationship-role>\n");
181:
182: indent += 2;
183:
184: // description
185: sb.append(xmlElement(description, "description", indent));
186: // ejb-relationship-role-name
187: sb.append(xmlElement(ejbRelationshipRoleName,
188: "ejb-relationship-role-name", indent));
189: // multiplicity
190: sb.append(xmlElement(multiplicity, "multiplicity", indent));
191: // cascade-delete
192: if (cascadeDelete) {
193: sb.append(indent(indent));
194: sb.append("<cascade-delete>\n");
195: sb.append(indent(indent));
196: sb.append("</cascade-delete>\n");
197: }
198: // relationship-role-source
199: if (relationshipRoleSource != null) {
200: sb.append(relationshipRoleSource.toXML(indent));
201: }
202: // cmr-field
203: if (cmrField != null) {
204: sb.append(cmrField.toXML(indent));
205: }
206: indent -= 2;
207: sb.append(indent(indent));
208: sb.append("</ejb-relationship-role>\n");
209:
210: return sb.toString();
211: }
212: }
|