1 21 package oracle.toplink.essentials.internal.ejb.cmp3.xml.queries; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import org.w3c.dom.Node ; 28 import org.w3c.dom.NodeList ; 29 30 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper; 31 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; 32 33 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries.MetadataEntityResult; 34 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries.MetadataSQLResultSetMapping; 35 36 42 public class XMLSQLResultSetMapping extends MetadataSQLResultSetMapping { 43 protected Node m_node; 44 protected XMLHelper m_helper; 45 46 49 public XMLSQLResultSetMapping(Node node, XMLHelper helper) { 50 m_node = node; 51 m_helper = helper; 52 } 53 54 57 public List <MetadataEntityResult> getEntityResults() { 58 if (m_entityResults == null) { 59 m_entityResults = new ArrayList <MetadataEntityResult>(); 60 NodeList entityResultNodes = m_helper.getNodes(m_node, XMLConstants.ENTITY_RESULT); 61 62 if (entityResultNodes != null) { 63 for (int i = 0; i < entityResultNodes.getLength(); i++) { 64 m_entityResults.add(new XMLEntityResult(entityResultNodes.item(i), m_helper)); 65 } 66 } 67 } 68 69 return m_entityResults; 70 } 71 72 75 public List <String > getColumnResults() { 76 if (m_columnResults == null) { 77 m_columnResults = new ArrayList <String >(); 78 NodeList columnResultList = m_helper.getNodes(m_node, XMLConstants.COLUMN_RESULT); 79 80 if (columnResultList != null) { 81 for (int i = 0; i < columnResultList.getLength(); i++) { 82 m_columnResults.add(m_helper.getNodeValue(columnResultList.item(i), XMLConstants.ATT_NAME)); 83 } 84 } 85 } 86 87 return m_columnResults; 88 } 89 90 93 public String getName() { 94 return m_helper.getNodeValue(m_node, XMLConstants.ATT_NAME); 95 } 96 } 97 | Popular Tags |