1 27 28 package org.objectweb.jonas_ejb.deployment.xml; 29 30 import java.util.Iterator ; 31 import org.objectweb.jonas_lib.deployment.xml.AbsElement; 32 import org.objectweb.jonas_lib.deployment.xml.JLinkedList; 33 34 38 39 public class EjbRelation extends AbsElement { 40 41 44 private String description = null; 45 46 49 private String ejbRelationName = null; 50 51 52 55 private JLinkedList ejbRelationshipRoleList = null; 56 57 58 61 public EjbRelation() { 62 super(); 63 ejbRelationshipRoleList = new JLinkedList("ejb-relationship-role"); 64 } 65 66 70 public String getDescription() { 71 return description; 72 } 73 74 78 public void setDescription(String description) { 79 this.description = description; 80 } 81 82 86 public String getEjbRelationName() { 87 return ejbRelationName; 88 } 89 90 94 public void setEjbRelationName(String ejbRelationName) { 95 this.ejbRelationName = ejbRelationName; 96 } 97 98 102 public void addEjbRelationshipRole(EjbRelationshipRole ejbRelationshipRole) { 103 ejbRelationshipRoleList.add(ejbRelationshipRole); 104 } 105 106 110 public JLinkedList getEjbRelationshipRoleList() { 111 return ejbRelationshipRoleList; 112 } 113 114 118 public EjbRelationshipRole getEjbRelationshipRole() { 119 Iterator i = ejbRelationshipRoleList.iterator(); 120 EjbRelationshipRole ejbRelationshipRole1 = (EjbRelationshipRole) i.next(); 121 return ejbRelationshipRole1; 122 } 123 124 125 129 public EjbRelationshipRole getEjbRelationshipRole2() { 130 Iterator i = ejbRelationshipRoleList.iterator(); 131 EjbRelationshipRole ejbRelationshipRole2 = (EjbRelationshipRole) i.next(); 132 ejbRelationshipRole2 = (EjbRelationshipRole) i.next(); 133 return ejbRelationshipRole2; 134 } 135 136 137 138 143 public String toXML(int indent) { 144 StringBuffer sb = new StringBuffer (); 145 sb.append(indent(indent)); 146 sb.append("<ejb-relation>\n"); 147 148 indent += 2; 149 150 sb.append(xmlElement(description, "description", indent)); 152 sb.append(xmlElement(ejbRelationName, "ejb-relation-name", indent)); 154 if (ejbRelationshipRoleList != null) { 156 for (Iterator i = ejbRelationshipRoleList.iterator(); i.hasNext();) { 157 sb.append(((EjbRelationshipRole) i.next()).toXML(indent)); 158 } 159 } 160 161 indent -= 2; 162 sb.append(indent(indent)); 163 sb.append("</ejb-relation>\n"); 164 165 return sb.toString(); 166 } 167 } 168 | Popular Tags |