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

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


    return isIdentity ? "AFTER" : "BEFORE"; //$NON-NLS-1$ //$NON-NLS-2$
  }

  public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("generatedKey"); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("column", column)); //$NON-NLS-1$
    xmlElement.addAttribute(new Attribute("sqlStatement", configuredSqlStatement)); //$NON-NLS-1$
    if (stringHasValue(type)) {
      xmlElement.addAttribute(new Attribute("type", type)); //$NON-NLS-1$
    }
    xmlElement.addAttribute(new Attribute("identity", //$NON-NLS-1$
        isIdentity ? "true" : "false")); //$NON-NLS-1$ //$NON-NLS-2$

    return xmlElement;
  }
View Full Code Here


  }

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

    addPropertyXmlElements(answer);

    return answer;
View Full Code Here

    return columnName.hashCode();
  }

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

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

    return xmlElement;
  }
View Full Code Here

    root.addElement(mappers);

    XmlElement mapper;
    for (String mapperFile : mapperFiles) {
      mapper = new XmlElement("mapper"); //$NON-NLS-1$
      mapper.addAttribute(new Attribute("resource", mapperFile)); //$NON-NLS-1$
      mappers.addElement(mapper);
    }

    GeneratedXmlFile gxf = new GeneratedXmlFile(document, properties.getProperty("fileName", "MapperConfig.xml"), //$NON-NLS-1$ //$NON-NLS-2$
        properties.getProperty("targetPackage"), //$NON-NLS-1$
View Full Code Here

    root.addElement(new TextElement(sb.toString()));

    root.addElement(new TextElement("-->")); //$NON-NLS-1$

    XmlElement settings = new XmlElement("settings"); //$NON-NLS-1$
    settings.addAttribute(new Attribute("useStatementNamespaces", "true")); //$NON-NLS-1$ //$NON-NLS-2$
    root.addElement(settings);

    XmlElement sqlMap;
    for (String sqlMapFile : sqlMapFiles) {
      sqlMap = new XmlElement("sqlMap"); //$NON-NLS-1$
      sqlMap.addAttribute(new Attribute("resource", sqlMapFile)); //$NON-NLS-1$
      root.addElement(sqlMap);
    }

    GeneratedXmlFile gxf = new GeneratedXmlFile(document, properties.getProperty("fileName", "SqlMapConfig.xml"), //$NON-NLS-1$ //$NON-NLS-2$
        properties.getProperty("targetPackage"), //$NON-NLS-1$
View Full Code Here

    String namespace = introspectedTable.getMyBatis3JavaMapperType();
    if (namespace == null) {
      // TODO - this is wierd for mybatis3
      namespace = introspectedTable.getIbatis2SqlMapNamespace();
    }
    answer.addAttribute(new Attribute("namespace", //$NON-NLS-1$
        namespace));

    context.getCommentGenerator().addRootComment(answer);

    addResultMapWithoutBLOBsElement(answer);
View Full Code Here

   */
  public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("context"); //$NON-NLS-1$

    if (defaultModelType != ModelType.CONDITIONAL) {
      xmlElement.addAttribute(new Attribute("defaultModelType", defaultModelType.getModelType())); //$NON-NLS-1$
    }

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

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

    addPropertyXmlElements(xmlElement);

    if (commentGeneratorConfiguration != null) {
View Full Code Here

    this.wildcardEscapingEnabled = wildcardEscapingEnabled;
  }

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

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

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

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

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

    if (!insertStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableInsert", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!selectByPrimaryKeyStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableSelectByPrimaryKey", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!selectByExampleStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableSelectByExample", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!updateByPrimaryKeyStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableUpdateByPrimaryKey", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!deleteByPrimaryKeyStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableDeleteByPrimaryKey", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!deleteByExampleStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableDeleteByExample", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!countByExampleStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableCountByExample", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (!updateByExampleStatementEnabled) {
      xmlElement.addAttribute(new Attribute("enableUpdateByExample", "false")); //$NON-NLS-1$ //$NON-NLS-2$
    }

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

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

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

    if (wildcardEscapingEnabled) {
      xmlElement.addAttribute(new Attribute("escapeWildcards", "true")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (isAllColumnDelimitingEnabled) {
      xmlElement.addAttribute(new Attribute("delimitAllColumns", "true")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (delimitIdentifiers) {
      xmlElement.addAttribute(new Attribute("delimitIdentifiers", "true")); //$NON-NLS-1$ //$NON-NLS-2$
    }

    addPropertyXmlElements(xmlElement);

    if (generatedKey != null) {
View Full Code Here

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

    StringBuilder sb = new StringBuilder();
    XmlElement dynamicElement = new XmlElement("trim"); //$NON-NLS-1$
    dynamicElement.addAttribute(new Attribute("prefix", "where")); //$NON-NLS-1$ //$NON-NLS-2$
    dynamicElement.addAttribute(new Attribute("prefixOverrides", "and|or")); //$NON-NLS-1$ //$NON-NLS-2$
    Where_Clause.addElement(dynamicElement);

    for (IntrospectedColumn introspectedColumn : introspectedTable.getNonPrimaryKeyColumns()) {
      XmlElement isNotNullElement = new XmlElement("if"); //$NON-NLS-1$
        String va = introspectedColumn.getJavaProperty("condition.") + " != null";
        isNotNullElement.addAttribute(new Attribute("test", va)); //$NON-NLS-1$ //$NON-NLS-2$
      dynamicElement.addElement(isNotNullElement);

      sb.setLength(0);
      sb.append(" and "); //$NON-NLS-1$
      sb.append(Ibatis2FormattingUtilities.getEscapedColumnName(introspectedColumn));
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

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.