Java Code Examples for org.mybatis.generator.config.TableConfiguration#getDomainObjectName()

The following examples show how to use org.mybatis.generator.config.TableConfiguration#getDomainObjectName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableRenamePlugin.java    From mybatis-generator-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean validate(List<String> warnings) {

    // 如果配置了searchString 或者 replaceString,二者不允许单独存在
    if ((getProperties().getProperty(PRO_SEARCH_STRING) == null && getProperties().getProperty(PRO_REPLACE_STRING) != null)
            || (getProperties().getProperty(PRO_SEARCH_STRING) != null && getProperties().getProperty(PRO_REPLACE_STRING) == null)) {
        warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件的searchString、replaceString属性需配合使用,不能单独存在!");
        return false;
    }

    // 如果table配置了domainObjectName或者mapperName就不要再启动该插件了
    for (TableConfiguration tableConfiguration : context.getTableConfigurations()) {
        if (tableConfiguration.getDomainObjectName() != null || tableConfiguration.getMapperName() != null) {
            warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件请不要配合table的domainObjectName或者mapperName一起使用!");
            return false;
        }
    }

    return super.validate(warnings);
}
 
Example 2
Source File: TablePrefixPlugin.java    From mybatis-generator-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean validate(List<String> warnings) {
    // 如果table配置了domainObjectName或者mapperName就不要再启动该插件了
    for (TableConfiguration tableConfiguration : context.getTableConfigurations()) {
        if (tableConfiguration.getDomainObjectName() != null || tableConfiguration.getMapperName() != null) {
            warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件请不要配合table的domainObjectName或者mapperName一起使用!");
            return false;
        }
    }

    return super.validate(warnings);
}
 
Example 3
Source File: DatabaseIntrospector.java    From mapper-generator-javafx with Apache License 2.0 4 votes vote down vote up
private List<IntrospectedTable> calculateIntrospectedTables(
        TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    boolean delimitIdentifiers = tc.isDelimitIdentifiers()
            || stringContainsSpace(tc.getCatalog())
            || stringContainsSpace(tc.getSchema())
            || stringContainsSpace(tc.getTableName());

    List<IntrospectedTable> answer = new ArrayList<>();

    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
            .entrySet()) {
        ActualTableName atn = entry.getKey();

        // we only use the returned catalog and schema if something was
        // actually
        // specified on the table configuration. If something was returned
        // from the DB for these fields, but nothing was specified on the
        // table
        // configuration, then some sort of DB default is being returned
        // and we don't want that in our SQL
        FullyQualifiedTable table = new FullyQualifiedTable(
                stringHasValue(tc.getCatalog()) ? atn.getCatalog() : null,
                stringHasValue(tc.getSchema()) ? atn.getSchema() : null,
                atn.getTableName(),
                tc.getDomainObjectName(),
                tc.getAlias(),
                isTrue(tc.getProperty(PropertyRegistry.TABLE_IGNORE_QUALIFIERS_AT_RUNTIME)),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_CATALOG),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_SCHEMA),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_TABLE_NAME),
                delimitIdentifiers,
                tc.getDomainObjectRenamingRule(),
                context);

        IntrospectedTable introspectedTable = ObjectFactory
                .createIntrospectedTable(tc, table, context);

        for (IntrospectedColumn introspectedColumn : entry.getValue()) {
            introspectedTable.addColumn(introspectedColumn);
        }

        calculatePrimaryKey(table, introspectedTable);

        enhanceIntrospectedTable(introspectedTable);

        answer.add(introspectedTable);
    }

    return answer;
}
 
Example 4
Source File: DatabaseIntrospector.java    From mybatis-generator-plus with Apache License 2.0 4 votes vote down vote up
private List<IntrospectedTable> calculateIntrospectedTables(
        TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    boolean delimitIdentifiers = tc.isDelimitIdentifiers()
            || stringContainsSpace(tc.getCatalog())
            || stringContainsSpace(tc.getSchema())
            || stringContainsSpace(tc.getTableName());

    List<IntrospectedTable> answer = new ArrayList<IntrospectedTable>();

    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
            .entrySet()) {
        ActualTableName atn = entry.getKey();

        // we only use the returned catalog and schema if something was
        // actually
        // specified on the table configuration. If something was returned
        // from the DB for these fields, but nothing was specified on the
        // table
        // configuration, then some sort of DB default is being returned
        // and we don't want that in our SQL
        FullyQualifiedTable table = new FullyQualifiedTable(
                stringHasValue(tc.getCatalog()) ? atn
                        .getCatalog() : null,
                stringHasValue(tc.getSchema()) ? atn
                        .getSchema() : null,
                atn.getTableName(),
                tc.getDomainObjectName(),
                tc.getAlias(),
                isTrue(tc.getProperty(PropertyRegistry.TABLE_IGNORE_QUALIFIERS_AT_RUNTIME)),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_CATALOG),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_SCHEMA),
                tc.getProperty(PropertyRegistry.TABLE_RUNTIME_TABLE_NAME),
                delimitIdentifiers, context);

        IntrospectedTable introspectedTable = ObjectFactory
                .createIntrospectedTable(tc, table, context);

        for (IntrospectedColumn introspectedColumn : entry.getValue()) {
            introspectedTable.addColumn(introspectedColumn);
        }

        calculatePrimaryKey(table, introspectedTable);

        answer.add(introspectedTable);
    }

    return answer;
}