public void validate(List<String> errors, String contextId) {
    if (!StringUtility.stringHasValue(targetProject)) {
      errors.add(Messages.getString("ValidationError.1", contextId)); // $NON-NLS-1$
    }

    if (!StringUtility.stringHasValue(targetPackage)) {
      errors.add(
          Messages.getString(
              "ValidationError.12", //$NON-NLS-1$
              "SQLMapGenerator",
              contextId)); //$NON-NLS-1$
    }
  }
  public void addConfigurationProperties(Properties properties) {
    this.properties.putAll(properties);

    suppressDate =
        StringUtility.isTrue(
            properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
  }
Пример #3
0
  public XmlElement toXmlElement() {
    XmlElement xmlElement = new XmlElement("ignoreColumn"); // $NON-NLS-1$
    xmlElement.addAttribute(new Attribute("column", columnName)); // $NON-NLS-1$

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

    return xmlElement;
  }
Пример #4
0
 public IgnoredColumn(String columnName) {
   super();
   this.columnName = columnName;
   isColumnNameDelimited = StringUtility.stringContainsSpace(columnName);
 }
  @Override
  public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("resultMap"); // $NON-NLS-1$
    answer.addAttribute(
        new Attribute(
            "id", //$NON-NLS-1$
            introspectedTable.getBaseResultMapId()));

    String returnType;
    if (introspectedTable.getRules().generateBaseRecordClass()) {
      returnType = introspectedTable.getBaseRecordType();
    } else {
      returnType = introspectedTable.getPrimaryKeyType();
    }

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

    ibatorContext.getCommentGenerator().addComment(answer);

    int i = 1;
    if (StringUtility.stringHasValue(introspectedTable.getSelectByPrimaryKeyQueryId())
        || StringUtility.stringHasValue(introspectedTable.getSelectByExampleQueryId())) {
      i++;
    }

    for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
      XmlElement resultElement = new XmlElement("id"); // $NON-NLS-1$

      resultElement.addAttribute(
          new Attribute(
              "column",
              Ibatis3FormattingUtilities.getRenamedColumnNameForResultMap(
                  introspectedColumn))); //$NON-NLS-1$
      resultElement.addAttribute(
          new Attribute("property", introspectedColumn.getJavaProperty())); // $NON-NLS-1$
      resultElement.addAttribute(
          new Attribute(
              "jdbcType", //$NON-NLS-1$
              introspectedColumn.getJdbcTypeName()));

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

      answer.addElement(resultElement);
    }

    for (IntrospectedColumn introspectedColumn : introspectedTable.getBaseColumns()) {
      XmlElement resultElement = new XmlElement("result"); // $NON-NLS-1$

      resultElement.addAttribute(
          new Attribute(
              "column",
              Ibatis3FormattingUtilities.getRenamedColumnNameForResultMap(
                  introspectedColumn))); //$NON-NLS-1$
      resultElement.addAttribute(
          new Attribute("property", introspectedColumn.getJavaProperty())); // $NON-NLS-1$
      resultElement.addAttribute(
          new Attribute(
              "jdbcType", //$NON-NLS-1$
              introspectedColumn.getJdbcTypeName()));

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

      answer.addElement(resultElement);
    }

    if (ibatorContext
        .getPlugins()
        .sqlMapResultMapWithoutBLOBsElementGenerated(answer, introspectedTable)) {
      parentElement.addElement(answer);
    }
  }