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

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


        "select * from (select a.*, rownum rn from ("));
    element.addElement(new TextElement(") a"));

    XmlElement whereElement_1 = new XmlElement("where");
    XmlElement ifElement_1 = new XmlElement("if");
    ifElement_1.addAttribute(new Attribute("test",
        "startIndex != null and pageSize != null"));
    ifElement_1.addElement(new TextElement(
        "rownum <= (${startIndex} + ${pageSize})"));
    whereElement_1.addElement(ifElement_1);
    element.addElement(whereElement_1);

    element.addElement(new TextElement(")"));

    XmlElement whereElement_2 = new XmlElement("where");
    XmlElement ifElement_2 = new XmlElement("if");
    ifElement_2.addAttribute(new Attribute("test", "startIndex != null"));
    ifElement_2.addElement(new TextElement("rn >= ${startIndex}"));
    whereElement_2.addElement(ifElement_2);
    element.addElement(whereElement_2);

    return true;
View Full Code Here


    try
    {
      props.load(new FileInputStream(new File(this.getClass()
          .getResource("/com/eatle/persistent/generator/generatorConfig.properties").toURI())));
      XmlElement selectKeyElement = new XmlElement("selectKey");
      selectKeyElement.addAttribute(new Attribute("resultType", "long"));
      selectKeyElement.addAttribute(new Attribute("keyProperty", "id"));
      selectKeyElement.addAttribute(new Attribute("order", "BEFORE"));
      selectKeyElement.addElement(new TextElement("select "
          + props.getProperty("sequenceName")
          + ".NEXTVAL as ID from dual "));

      element.addElement(selectKeyElement);
View Full Code Here

    this.typeHandler = typeHandler;
  }

  public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("columnOverride"); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("column", columnName)); //$NON-NLS-1$

    if (stringHasValue(javaProperty)) {
      xmlElement.addAttribute(new Attribute("property", javaProperty)); //$NON-NLS-1$
    }

    if (stringHasValue(javaType)) {
      xmlElement.addAttribute(new Attribute("javaType", javaType)); //$NON-NLS-1$
    }

    if (stringHasValue(jdbcType)) {
      xmlElement.addAttribute(new Attribute("jdbcType", jdbcType)); //$NON-NLS-1$
    }

    if (stringHasValue(typeHandler)) {
      xmlElement.addAttribute(new Attribute("typeHandler", typeHandler)); //$NON-NLS-1$
    }

    if (stringHasValue(configuredDelimitedColumnName)) {
      xmlElement.addAttribute(new Attribute("delimitedColumnName", configuredDelimitedColumnName)); //$NON-NLS-1$
    }

    addPropertyXmlElements(xmlElement);

    return xmlElement;
View Full Code Here

    // 移除第一个
    Where_Clause.removeElement(0);

    StringBuilder sb = new StringBuilder();
    XmlElement dynamicElement = new XmlElement("dynamic"); //$NON-NLS-1$
    dynamicElement.addAttribute(new Attribute("prepend", "where")); //$NON-NLS-1$ //$NON-NLS-2$
    Where_Clause.addElement(dynamicElement);

    for (IntrospectedColumn introspectedColumn : introspectedTable.getNonPrimaryKeyColumns()) {
      XmlElement isNotNullElement = new XmlElement("isNotNull"); //$NON-NLS-1$
      isNotNullElement.addAttribute(new Attribute("prepend", "and")); //$NON-NLS-1$ //$NON-NLS-2$
      isNotNullElement.addAttribute(new Attribute("property", introspectedColumn.getJavaProperty("condition."))); //$NON-NLS-1$
      dynamicElement.addElement(isNotNullElement);

      sb.setLength(0);
      sb.append(Ibatis2FormattingUtilities.getEscapedColumnName(introspectedColumn));
      sb.append(" = "); //$NON-NLS-1$
View Full Code Here

  @Override
  public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(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 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.IBATIS2_SQL_MAP_PUBLIC_ID, XmlConstants.IBATIS2_SQL_MAP_SYSTEM_ID);
    XmlElement answer = new XmlElement("sqlMap"); //$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 dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement("<![CDATA[ select * from ( select row_.*, rownum rownum_ from ( ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
    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 dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement(
        "<![CDATA[ ) row_ where rownum <= (#limit# + #start#) ) where rownum_ > #start# ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
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 dynamicElement = new XmlElement("dynamic");
    XmlElement outerisNotEmptyElement = new XmlElement("isNotNull");
    outerisNotEmptyElement.addAttribute(new Attribute("property", "limit"));
    XmlElement innerisNotEmptyElement = new XmlElement("isNotNull");
    innerisNotEmptyElement.addAttribute(new Attribute("property", "start"));
    innerisNotEmptyElement.addElement(new TextElement("<![CDATA[ limit #start# , #limit# ]]>"));
    outerisNotEmptyElement.addElement(innerisNotEmptyElement);
    dynamicElement.addElement(outerisNotEmptyElement);
    answer.addElement(dynamicElement);
    return answer;
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.