Search in sources :

Example 6 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfColumnListToStringBuilder method getColumnArgsSetupString.

public static String getColumnArgsSetupString(String beanName, List<Column> columnList) {
    validateColumnList(columnList);
    final boolean hasPrefix = beanName != null;
    final String beanPrefix = (hasPrefix ? beanName + "." : "");
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguageImplStyle implStyle = lang.getLanguageImplStyle();
    String result = "";
    for (Iterator<Column> ite = columnList.iterator(); ite.hasNext(); ) {
        final Column column = (Column) ite.next();
        final String javaName = column.getJavaName();
        final String variable = column.getUncapitalisedJavaName();
        final String cls = column.getClassificationName();
        final String basic;
        if (column.isForceClassificationSetting()) {
            basic = "set" + javaName + "As" + cls + "(" + variable + ")";
        } else {
            basic = "set" + javaName + "(" + variable + ")";
        }
        final String adjusted = implStyle.adjustEntitySetMethodCall(basic, !hasPrefix);
        final String setter = beanPrefix + adjusted + ";";
        if ("".equals(result)) {
            result = setter;
        } else {
            result = result + setter;
        }
    }
    return result;
}
Also used : Column(org.apache.torque.engine.database.model.Column) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 7 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfColumnListToStringBuilder method doGetColumnArgsConditionSetupString.

private static String doGetColumnArgsConditionSetupString(List<Column> columnList) {
    validateColumnList(columnList);
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguageImplStyle implStyle = lang.getLanguageImplStyle();
    final String query = implStyle.adjustConditionBeanLocalCQCall("cb");
    final StringBuilder sb = new StringBuilder();
    for (Column column : columnList) {
        final String javaName = column.getJavaName();
        final String variable = column.getUncapitalisedJavaName();
        final String setter;
        if (column.isForceClassificationSetting()) {
            final String cls = column.getClassificationName();
            final String basic = "set" + javaName + "_Equal_As" + cls + "(" + variable + ")";
            final String adjusted = implStyle.adjustConditionQuerySetMethodCall(basic);
            setter = query + "." + adjusted + ";";
        } else {
            final String basic = "set" + javaName + "_Equal(" + variable + ")";
            final String adjusted = implStyle.adjustConditionQuerySetMethodCall(basic);
            setter = query + "." + adjusted + ";";
        }
        sb.append(setter);
    }
    return sb.toString();
}
Also used : Column(org.apache.torque.engine.database.model.Column) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Example 8 with DfLanguageImplStyle

use of org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle in project dbflute-core by dbflute.

the class DfOutsideSqlTestTask method createOutsideSqlChecker.

protected DfOutsideSqlChecker createOutsideSqlChecker(DfOutsideSqlProperties outsideSqlProp) {
    final DfOutsideSqlChecker checker = new DfOutsideSqlChecker();
    if (outsideSqlProp.isRequiredSqlTitle()) {
        checker.enableRequiredTitleCheck();
    }
    if (outsideSqlProp.isSuppressSqlTitleUniqueCheck()) {
        checker.suppressTitleUniqueCheck();
    }
    if (outsideSqlProp.isRequiredSqlDescription()) {
        checker.enableRequiredDescriptionCheck();
    }
    if (outsideSqlProp.isSuppressSqlDescriptionUniqueCheck()) {
        checker.suppressDescriptionUniqueCheck();
    }
    final DfLanguageImplStyle languageImplStyle = getBasicProperties().getLanguageDependency().getLanguageImplStyle();
    if (languageImplStyle.isIfCommentExpressionCheckEnabled()) {
        // might be different specification between language
        checker.enableIfCommentExpressionCheck();
    }
    return checker;
}
Also used : DfOutsideSqlChecker(org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker) DfLanguageImplStyle(org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)

Aggregations

DfLanguageImplStyle (org.dbflute.logic.generate.language.implstyle.DfLanguageImplStyle)8 Column (org.apache.torque.engine.database.model.Column)3 DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)3 DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)2 DfColumnListToStringBuilder (org.dbflute.logic.generate.column.DfColumnListToStringBuilder)1 DfOutsideSqlChecker (org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)1