1 21 package oracle.toplink.essentials.internal.ejb.cmp3.xml.accessors; 23 24 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.OneToManyAccessor; 25 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject; 26 27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.tables.MetadataJoinTable; 28 29 import oracle.toplink.essentials.internal.ejb.cmp3.xml.tables.XMLJoinTable; 30 31 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; 32 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper; 33 34 import org.w3c.dom.Node ; 35 36 42 public class XMLOneToManyAccessor extends OneToManyAccessor { 43 protected Node m_node; 44 protected XMLHelper m_helper; 45 46 49 public XMLOneToManyAccessor(MetadataAccessibleObject accessibleObject, Node node, XMLClassAccessor classAccessor) { 50 super(accessibleObject, classAccessor); 51 m_node = node; 52 m_helper = classAccessor.getHelper(); 53 54 XMLAccessorHelper.setRelationshipAccessorData(this, m_node, m_helper); 55 } 56 57 60 public MetadataJoinTable getJoinTable() { 61 Node node = m_helper.getNode(m_node, XMLConstants.JOIN_TABLE); 62 63 if (node == null) { 64 return super.getJoinTable(); 65 } else { 66 return new XMLJoinTable(node, m_helper); 67 } 68 } 69 70 75 public String getMapKey() { 76 Node mapKeyNode = m_helper.getNode(m_node, XMLConstants.MAPKEY); 77 String mapKeyValue = m_helper.getNodeValue(mapKeyNode, XMLConstants.ATT_NAME); 78 79 if (mapKeyNode == null) { 80 return super.getMapKey(); 81 } else { 82 return mapKeyValue; 83 } 84 } 85 86 90 public String getOrderBy() { 91 if (hasOrderBy()) { 92 return m_helper.getNodeTextValue(m_node, XMLConstants.ORDER_BY); 93 } else { 94 return super.getOrderBy(); 95 } 96 } 97 98 103 public boolean hasOrderBy() { 104 Node orderByNode = m_helper.getNode(m_node, XMLConstants.ORDER_BY); 105 106 if (orderByNode == null) { 107 return super.hasOrderBy(); 108 } else { 109 return true; 110 } 111 } 112 } 113 | Popular Tags |