Package com.avaje.ebeaninternal.server.lib.util

Examples of com.avaje.ebeaninternal.server.lib.util.Dnode


  /**
   * Register the native queries in this particular orm xml deployment.
   */
  private void initialiseNativeQueries(Dnode ormXml) {

    Dnode entityMappings = ormXml.find("entity-mappings");
    if (entityMappings != null) {
      List<Dnode> nq = entityMappings.findAll("named-native-query", 1);
      for (int i = 0; i < nq.size(); i++) {
        Dnode nqNode = nq.get(i);
        Dnode nqQueryNode = nqNode.find("query");
        if (nqQueryNode != null) {
          String queryContent = nqQueryNode.getNodeContent();
          String queryName = (String) nqNode.getAttribute("name");

          if (queryName != null && queryContent != null) {
            DNativeQuery query = new DNativeQuery(queryContent);
            nativeQueryCache.put(queryName, query);
View Full Code Here


  }

  private boolean readOrmXml(String ormXmlName, ArrayList<Dnode> ormXmlList) {

    try {
      Dnode ormXml = null;
      ResourceContent content = resSource.getContent(ormXmlName);
      if (content != null) {
        // servlet resource or file system...
        ormXml = readOrmXml(content.getInputStream());

      } else {
        // try the classpath...
        ormXml = readOrmXmlFromClasspath(ormXmlName);
      }

      if (ormXml != null) {
        ormXml.setAttribute("ebean.filename", ormXmlName);
        ormXmlList.add(ormXml);
        return true;

      } else {
        return false;
View Full Code Here

    }
  }

  private Dnode readOrmXml(InputStream in) throws IOException {
    DnodeReader reader = new DnodeReader();
    Dnode ormXml = reader.parseXml(in);
    in.close();
    return ormXml;
  }
View Full Code Here

   * </p>
   */
  public Dnode findEntityDeploymentXml(String className) {

    for (Dnode ormXml : ormXmlList) {
      Dnode entityMappings = ormXml.find("entity-mappings");

      List<Dnode> entities = entityMappings.findAll("entity", "class", className, 1);
      if (entities.size() == 1) {
        return entities.get(0);
      }
    }

View Full Code Here

    public List<Dnode> findEntityXml(String className) {

        ArrayList<Dnode> hits = new ArrayList<Dnode>(2);
       
        for (Dnode ormXml : allXml) {
            Dnode entityMappings = ormXml.find("entity-mappings");

            List<Dnode> entities = entityMappings.findAll("entity", "class", className, 1);
            if (entities.size() == 1) {
                hits.add(entities.get(0));
            }
        }
View Full Code Here

  public void testSimple() {

    String xmlString = "<doc><div class=\"hello\"><h1>heading</h1><p>paragraph</p></div></doc>";

    DnodeReader r = new DnodeReader();
    Dnode n = r.parseXml(xmlString);

    String convertedTo = n.toXml();

    Assert.assertEquals(xmlString, convertedTo);

  }
View Full Code Here

  }

  private void processInputStream(ArrayList<Dnode> xmlList, InputStream is) throws IOException {

    DnodeReader reader = new DnodeReader();
    Dnode xmlDoc = reader.parseXml(is);
    is.close();

    xmlList.add(xmlDoc);
  }
View Full Code Here

  private void readXml(DeployBeanDescriptor<?> deployDesc) {

    List<Dnode> eXml = xmlConfig.findEntityXml(deployDesc.getFullName());
    readXmlRawSql(deployDesc, eXml);

    Dnode entityXml = deployOrmXml.findEntityDeploymentXml(deployDesc.getFullName());

    if (entityXml != null) {
      readXmlNamedQueries(deployDesc, entityXml);
      readXmlSql(deployDesc, entityXml);
    }
View Full Code Here

   */
  private void readXmlSql(DeployBeanDescriptor<?> deployDesc, Dnode entityXml) {

    List<Dnode> sqlSelectList = entityXml.findAll("sql-select", entityXml.getLevel() + 1);
    for (int i = 0; i < sqlSelectList.size(); i++) {
      Dnode sqlSelect = sqlSelectList.get(i);
      readSqlSelect(deployDesc, sqlSelect);
    }
  }
View Full Code Here

      readSqlSelect(deployDesc, sqlSelect);
    }
  }

  private String findContent(Dnode node, String nodeName) {
    Dnode found = node.find(nodeName);
    if (found != null) {
      return found.getNodeContent();
    } else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.lib.util.Dnode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.