1 21 package oracle.toplink.essentials.internal.ejb.cmp3.xml.queries; 23 24 import org.w3c.dom.Node ; 25 import org.w3c.dom.NodeList ; 26 27 import java.util.List ; 28 import java.util.ArrayList ; 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.MetadataQueryHint; 34 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries.MetadataNamedQuery; 35 36 43 public class XMLNamedQuery extends MetadataNamedQuery { 44 protected Node m_node; 45 protected XMLHelper m_helper; 46 47 50 public XMLNamedQuery(Node node, XMLHelper helper) { 51 m_node = node; 52 m_helper = helper; 53 } 54 55 58 public String getEJBQLString() { 59 return m_helper.getNodeTextValue(m_node, XMLConstants.QUERY); 60 } 61 62 65 public List <MetadataQueryHint> getHints() { 66 if (m_hints == null) { 67 m_hints = new ArrayList <MetadataQueryHint>(); 68 69 NodeList hints = m_helper.getNodes(m_node, XMLConstants.QUERY_HINT); 70 71 if (hints != null) { 72 for (int i = 0; i < hints.getLength(); i++) { 73 m_hints.add(new XMLQueryHint(hints.item(i), m_helper)); 74 } 75 } 76 } 77 78 return m_hints; 79 } 80 81 84 public String getName() { 85 return m_helper.getNodeValue(m_node, XMLConstants.ATT_NAME); 86 } 87 88 91 public boolean loadedFromAnnotations() { 92 return false; 93 } 94 95 98 public boolean loadedFromXML() { 99 return true; 100 } 101 } 102 | Popular Tags |