1 27 package org.objectweb.jonas_ejb.deployment.xml; 28 29 import org.objectweb.jonas_lib.deployment.xml.AbsElement; 30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList; 31 36 37 public class JdbcMapping extends AbsElement { 38 39 42 private String jndiName = null; 43 44 47 private String jdbcTableName = null; 48 49 52 private String automaticPk = null; 53 54 57 private String jdbcAutomaticPkFieldName = null; 58 59 62 private JLinkedList cmpFieldJdbcMappingList = null; 63 64 67 private JLinkedList finderMethodJdbcMappingList = null; 68 69 70 73 public JdbcMapping() { 74 super(); 75 cmpFieldJdbcMappingList = new JLinkedList("cmp-field-jdbc-mapping"); 76 finderMethodJdbcMappingList = new JLinkedList("finder-method-jdbc-mapping"); 77 } 78 79 83 public String getJndiName() { 84 return jndiName; 85 } 86 87 91 public void setJndiName(String jndiName) { 92 this.jndiName = jndiName; 93 } 94 95 99 public String getJdbcTableName() { 100 return jdbcTableName; 101 } 102 103 107 public void setJdbcTableName(String jdbcTableName) { 108 this.jdbcTableName = jdbcTableName; 109 } 110 111 115 public void setJdbcAutomaticPkFieldName(String jdbcAutomaticPkFieldName) { 116 this.jdbcAutomaticPkFieldName = jdbcAutomaticPkFieldName; 117 } 118 119 123 public String getJdbcAutomaticPkFieldName() { 124 return jdbcAutomaticPkFieldName; 125 } 126 127 131 public JLinkedList getCmpFieldJdbcMappingList() { 132 return cmpFieldJdbcMappingList; 133 } 134 135 139 public String getAutomaticPk() { 140 return automaticPk; 141 } 142 143 147 public void setAutomaticPk(String automaticPk) { 148 this.automaticPk = automaticPk; 149 } 150 151 155 public void setCmpFieldJdbcMappingList(JLinkedList cmpFieldJdbcMappingList) { 156 this.cmpFieldJdbcMappingList = cmpFieldJdbcMappingList; 157 } 158 159 163 public void addCmpFieldJdbcMapping(CmpFieldJdbcMapping cmpFieldJdbcMapping) { 164 cmpFieldJdbcMappingList.add(cmpFieldJdbcMapping); 165 } 166 167 171 public JLinkedList getFinderMethodJdbcMappingList() { 172 return finderMethodJdbcMappingList; 173 } 174 175 179 public void setFinderMethodJdbcMappingList(JLinkedList finderMethodJdbcMappingList) { 180 this.finderMethodJdbcMappingList = finderMethodJdbcMappingList; 181 } 182 183 187 public void addFinderMethodJdbcMapping(FinderMethodJdbcMapping finderMethodJdbcMapping) { 188 finderMethodJdbcMappingList.add(finderMethodJdbcMapping); 189 } 190 191 196 public String toXML(int indent) { 197 StringBuffer sb = new StringBuffer (); 198 sb.append(indent(indent)); 199 sb.append("<jdbc-mapping>\n"); 200 201 indent += 2; 202 203 sb.append(xmlElement(jndiName, "jndi-name", indent)); 205 sb.append(xmlElement(jdbcTableName, "jdbc-table-name", indent)); 207 sb.append(xmlElement(automaticPk, "automatic-pk", indent)); 209 sb.append(xmlElement(jdbcAutomaticPkFieldName, "jdbcAutomaticPkFieldName", indent)); 211 sb.append(cmpFieldJdbcMappingList.toXML(indent)); 213 sb.append(finderMethodJdbcMappingList.toXML(indent)); 215 indent -= 2; 216 sb.append(indent(indent)); 217 sb.append("</jdbc-mapping>\n"); 218 219 return sb.toString(); 220 } 221 } 222 | Popular Tags |