Package org.mybatis.generator.api.dom.xml

Examples of org.mybatis.generator.api.dom.xml.Attribute


  @Override
  public boolean sqlMapSelectByExampleWithBLOBsElementGenerated(XmlElement element,
      IntrospectedTable introspectedTable) {
    if (databaseType.contains("oracle")) {
      XmlElement oracleHeadIncludeElement = new XmlElement("include");
      oracleHeadIncludeElement.addAttribute(new Attribute("refid", "common.Oracle_Pagination_Head"));
      // 在第一个地方增加
      element.addElement(0, oracleHeadIncludeElement);

      XmlElement oracleTailIncludeElement = new XmlElement("include");
      oracleTailIncludeElement.addAttribute(new Attribute("refid", "common.Oracle_Pagination_Tail"));
      // 在最后增加
      element.addElement(element.getElements().size(), oracleTailIncludeElement);
    } else if (databaseType.contains("mysql")) {
      XmlElement mysqlLimitIncludeElement = new XmlElement("include");
      mysqlLimitIncludeElement.addAttribute(new Attribute("refid", "common.Mysql_Pagination_Limit"));
      // 在最后增加
      element.addElement(element.getElements().size(), mysqlLimitIncludeElement);
    }
    return true;
  }
View Full Code Here


  @Override
  public List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles(IntrospectedTable introspectedTable) {
    Document document = new Document(XmlConstants.MYBATIS3_MAPPER_PUBLIC_ID, XmlConstants.MYBATIS3_MAPPER_SYSTEM_ID);
    XmlElement answer = new XmlElement("mapper"); //$NON-NLS-1$
    document.setRootElement(answer);
    answer.addAttribute(new Attribute("namespace", //$NON-NLS-1$
        "common"));

    if (databaseType.contains("oracle")) {
      answer.addElement(getOracleHead());
      answer.addElement(getOracleTail());
View Full Code Here

  }

  private XmlElement getOracleHead() {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", "Oracle_Pagination_Head")); //$NON-NLS-1$

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement("<![CDATA[ select * from ( select row_.*, rownum rownum_ from ( ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

  }

  private XmlElement getOracleTail() {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", "Oracle_Pagination_Tail")); //$NON-NLS-1$

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement(
        "<![CDATA[ ) row_ where rownum <= (#{limit} + #{start}) ) where rownum_ > #{start} ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

  }

  private XmlElement getMysqlLimit() {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", "Mysql_Pagination_Limit")); //$NON-NLS-1$

    XmlElement outerisNotEmptyElement = new XmlElement("if");
    outerisNotEmptyElement.addAttribute(new Attribute("test", "limit != null and start != null"));
    outerisNotEmptyElement.addElement(new TextElement("<![CDATA[ limit #{start} , #{limit} ]]>"));
    answer.addElement(outerisNotEmptyElement);
    return answer;
  }
View Full Code Here

  public XmlElement toXmlElement() {
    XmlElement answer = new XmlElement("sqlMapGenerator"); //$NON-NLS-1$

    if (targetPackage != null) {
      answer.addAttribute(new Attribute("targetPackage", targetPackage)); //$NON-NLS-1$
    }

    if (targetProject != null) {
      answer.addAttribute(new Attribute("targetProject", targetProject)); //$NON-NLS-1$
    }

    addPropertyXmlElements(answer);

    return answer;
View Full Code Here

  }

  public XmlElement toXmlElement() {
    XmlElement answer = new XmlElement("commentGenerator"); //$NON-NLS-1$
    if (getConfigurationType() != null) {
      answer.addAttribute(new Attribute("type", getConfigurationType())); //$NON-NLS-1$
    }

    addPropertyXmlElements(answer);

    return answer;
View Full Code Here

  public XmlElement toXmlElement() {
    XmlElement answer = new XmlElement("javaModelGenerator"); //$NON-NLS-1$

    if (targetPackage != null) {
      answer.addAttribute(new Attribute("targetPackage", targetPackage)); //$NON-NLS-1$
    }

    if (targetProject != null) {
      answer.addAttribute(new Attribute("targetProject", targetProject)); //$NON-NLS-1$
    }

    addPropertyXmlElements(answer);

    return answer;
View Full Code Here

    Enumeration<?> enumeration = properties.propertyNames();
    while (enumeration.hasMoreElements()) {
      String propertyName = (String) enumeration.nextElement();

      XmlElement propertyElement = new XmlElement("property"); //$NON-NLS-1$
      propertyElement.addAttribute(new Attribute("name", propertyName)); //$NON-NLS-1$
      propertyElement.addAttribute(new Attribute("value", properties.getProperty(propertyName))); //$NON-NLS-1$
      xmlElement.addElement(propertyElement);
    }
  }
View Full Code Here

    XmlElement rootElement = new XmlElement("generatorConfiguration"); //$NON-NLS-1$
    document.setRootElement(rootElement);

    for (String classPathEntry : classPathEntries) {
      XmlElement cpeElement = new XmlElement("classPathEntry"); //$NON-NLS-1$
      cpeElement.addAttribute(new Attribute("location", classPathEntry)); //$NON-NLS-1$
      rootElement.addElement(cpeElement);
    }

    for (Context context : contexts) {
      rootElement.addElement(context.toXmlElement());
View Full Code Here

TOP

Related Classes of org.mybatis.generator.api.dom.xml.Attribute

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.