KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > xml > EjbRelationshipRole


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: EjbRelationshipRole.java,v 1.6 2004/05/10 11:45:44 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ejb.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 /**
31  * This class defines the implementation of the element ejb-relationship-role
32  *
33  * @author JOnAS team
34  */

35
36 public class EjbRelationshipRole extends AbsElement {
37
38     /**
39      * description
40      */

41     private String JavaDoc description = null;
42
43     /**
44      * ejb-relationship-role-name
45      */

46     private String JavaDoc ejbRelationshipRoleName = null;
47
48     /**
49      * multiplicity
50      */

51     private String JavaDoc multiplicity = null;
52
53     /**
54      * cascade-delete
55      */

56     private boolean cascadeDelete = false;
57
58     /**
59      * relationship-role-source
60      */

61     private RelationshipRoleSource relationshipRoleSource = null;
62
63     /**
64      * cmr-field
65      */

66     private CmrField cmrField = null;
67
68
69     /**
70      * Constructor
71      */

72     public EjbRelationshipRole() {
73         super();
74     }
75
76     /**
77      * Gets the description
78      * @return the description
79      */

80     public String JavaDoc getDescription() {
81         return description;
82     }
83
84     /**
85      * Set the description
86      * @param description description
87      */

88     public void setDescription(String JavaDoc description) {
89         this.description = description;
90     }
91
92     /**
93      * Gets the ejb-relationship-role-name
94      * @return the ejb-relationship-role-name
95      */

96     public String JavaDoc getEjbRelationshipRoleName() {
97         return ejbRelationshipRoleName;
98     }
99
100     /**
101      * Set the ejb-relationship-role-name
102      * @param ejbRelationshipRoleName ejbRelationshipRoleName
103      */

104     public void setEjbRelationshipRoleName(String JavaDoc ejbRelationshipRoleName) {
105         this.ejbRelationshipRoleName = ejbRelationshipRoleName;
106     }
107
108     /**
109      * Gets the multiplicity
110      * @return the multiplicity
111      */

112     public String JavaDoc getMultiplicity() {
113         return multiplicity;
114     }
115
116     /**
117      * Set the multiplicity
118      * @param multiplicity multiplicity
119      */

120     public void setMultiplicity(String JavaDoc 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(RelationshipRoleSource relationshipRoleSource) {
152         this.relationshipRoleSource = relationshipRoleSource;
153     }
154
155     /**
156      * Gets the cmr-field
157      * @return the cmr-field
158      */

159     public CmrField getCmrField() {
160         return cmrField;
161     }
162
163     /**
164      * Set the cmr-field
165      * @param cmrField cmrField
166      */

167     public void setCmrField(CmrField cmrField) {
168         this.cmrField = cmrField;
169     }
170
171     /**
172      * Represents this element by it's XML description.
173      * @param indent use this indent for prexifing XML representation.
174      * @return the XML description of this object.
175      */

176     public String JavaDoc toXML(int indent) {
177         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
178         sb.append(indent(indent));
179         sb.append("<ejb-relationship-role>\n");
180
181         indent += 2;
182
183         // description
184
sb.append(xmlElement(description, "description", indent));
185         // ejb-relationship-role-name
186
sb.append(xmlElement(ejbRelationshipRoleName, "ejb-relationship-role-name", indent));
187         // multiplicity
188
sb.append(xmlElement(multiplicity, "multiplicity", indent));
189         // cascade-delete
190
if (cascadeDelete) {
191             sb.append(indent(indent));
192             sb.append("<cascade-delete>\n");
193             sb.append(indent(indent));
194             sb.append("</cascade-delete>\n");
195         }
196         // relationship-role-source
197
if (relationshipRoleSource != null) {
198             sb.append(relationshipRoleSource.toXML(indent));
199         }
200         // cmr-field
201
if (cmrField != null) {
202             sb.append(cmrField.toXML(indent));
203         }
204         indent -= 2;
205         sb.append(indent(indent));
206         sb.append("</ejb-relationship-role>\n");
207
208         return sb.toString();
209     }
210 }
211
Popular Tags