Search in sources :

Example 1 with DfOutsideSqlPack

use of org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack in project dbflute-core by dbflute.

the class TorqueDataModelTask method setupBehaviorQueryPath.

// ===================================================================================
// Behavior Query Path
// ===================
protected void setupBehaviorQueryPath() {
    final DfOutsideSqlPack outsideSqlPack = collectOutsideSqlChecked();
    final DfBehaviorQueryPathSetupper setupper = new DfBehaviorQueryPathSetupper();
    setupper.setupBehaviorQueryPath(outsideSqlPack);
}
Also used : DfOutsideSqlPack(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack) DfBehaviorQueryPathSetupper(org.dbflute.logic.sql2entity.bqp.DfBehaviorQueryPathSetupper)

Example 2 with DfOutsideSqlPack

use of org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack in project dbflute-core by dbflute.

the class DfSql2EntityTask method getTargetSqlFileList.

// ===================================================================================
// Executing Element
// =================
protected DfOutsideSqlPack getTargetSqlFileList() {
    final DfOutsideSqlPack sqlFileList = collectOutsideSqlChecked();
    final String specifiedSqlFile = DfSpecifiedSqlFile.getInstance().getSpecifiedSqlFile();
    if (specifiedSqlFile != null) {
        final DfOutsideSqlPack filteredList = new DfOutsideSqlPack();
        for (DfOutsideSqlFile outsideSqlFile : sqlFileList.getOutsideSqlFileList()) {
            final String fileName = outsideSqlFile.getPhysicalFile().getName();
            if (specifiedSqlFile.equals(fileName)) {
                filteredList.add(outsideSqlFile);
            }
        }
        return filteredList;
    } else {
        return sqlFileList;
    }
}
Also used : DfOutsideSqlFile(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlFile) DfOutsideSqlPack(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack)

Example 3 with DfOutsideSqlPack

use of org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack in project dbflute-core by dbflute.

the class DfOutsideSqlTestTask method getTargetSqlFileList.

// ===================================================================================
// Main Override
// =============
protected List<File> getTargetSqlFileList() {
    final DfOutsideSqlPack outsideSqlPack = collectOutsideSqlChecked();
    final String specifiedSqlFile = DfSpecifiedSqlFile.getInstance().getSpecifiedSqlFile();
    if (specifiedSqlFile != null) {
        final List<File> filteredList = new ArrayList<File>();
        for (File sqlFile : outsideSqlPack.getPhysicalFileList()) {
            final String fileName = sqlFile.getName();
            if (specifiedSqlFile.equals(fileName)) {
                filteredList.add(sqlFile);
            }
        }
        return filteredList;
    } else {
        return outsideSqlPack.getPhysicalFileList();
    }
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) DfSpecifiedSqlFile(org.dbflute.task.bs.assistant.DfSpecifiedSqlFile) DfOutsideSqlPack(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack)

Example 4 with DfOutsideSqlPack

use of org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack in project dbflute-core by dbflute.

the class DfSql2EntityTask method setupBehaviorQueryPath.

// ===================================================================================
// Behavior Query Path
// ===================
protected void setupBehaviorQueryPath() {
    final DfOutsideSqlPack sqlFileList = collectOutsideSqlChecked();
    final DfBehaviorQueryPathSetupper setupper = new DfBehaviorQueryPathSetupper();
    setupper.setupBehaviorQueryPath(sqlFileList);
}
Also used : DfOutsideSqlPack(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack) DfBehaviorQueryPathSetupper(org.dbflute.logic.sql2entity.bqp.DfBehaviorQueryPathSetupper)

Example 5 with DfOutsideSqlPack

use of org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack in project dbflute-core by dbflute.

the class DfSql2EntityTask method doExecute.

// ===================================================================================
// Execute
// =======
@Override
protected void doExecute() {
    setupControlTemplate();
    setupSchemaInformation();
    final DfRunnerInformation runInfo = new DfRunnerInformation();
    runInfo.setDriver(getDriver());
    runInfo.setUrl(getUrl());
    runInfo.setUser(getUser());
    runInfo.setPassword(getPassword());
    // Sql2Entity task immediately breaks the process by error
    runInfo.setBreakCauseThrow(true);
    runInfo.setErrorContinue(false);
    runInfo.setAutoCommit(false);
    // this task does not commit
    runInfo.setRollbackOnly(true);
    // requires to be roll-backed correctly
    runInfo.setIgnoreTxError(false);
    runInfo.setEncoding(getOutsideSqlProperties().getSqlFileEncoding());
    // FireMan's fire result is ignored here because runner's option breakCauseThrow=true
    final DfSqlFileFireMan fireMan = new DfSqlFileFireMan();
    final DfOutsideSqlPack outsideSqlPack = getTargetSqlFileList();
    final DfSqlFileRunner runner = createSqlFileRunner(runInfo, outsideSqlPack);
    fireMan.fire(runner, outsideSqlPack.getPhysicalFileList());
    setupProcedure();
    fireVelocityProcess();
    setupBehaviorQueryPath();
    setupExtendedClassDescription();
    reflectGapileClassIfNeeds();
    showTargetSqlFileInformation(outsideSqlPack);
    showSkippedFileInformation();
    handleException();
    refreshResources();
}
Also used : DfSqlFileFireMan(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan) DfSqlFileRunner(org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunner) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation) DfOutsideSqlPack(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack)

Aggregations

DfOutsideSqlPack (org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack)5 DfBehaviorQueryPathSetupper (org.dbflute.logic.sql2entity.bqp.DfBehaviorQueryPathSetupper)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 DfRunnerInformation (org.dbflute.helper.jdbc.DfRunnerInformation)1 DfSqlFileFireMan (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan)1 DfSqlFileRunner (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunner)1 DfOutsideSqlFile (org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlFile)1 DfSpecifiedSqlFile (org.dbflute.task.bs.assistant.DfSpecifiedSqlFile)1