Search in sources :

Example 1 with DfLoadedFile

use of org.dbflute.logic.replaceschema.loaddata.base.DfLoadedFile in project dbflute-core by dbflute.

the class DfLoadDataProcess method createFinalInfo.

// ===================================================================================
// Final Info
// ==========
protected DfLoadDataFinalInfo createFinalInfo(RuntimeException loadEx, long processPerformanceMillis) {
    final DfLoadDataFinalInfo finalInfo = new DfLoadDataFinalInfo();
    finalInfo.setResultMessage("Load Data" + ": " + buildEnvTypeCountExp());
    final List<DfLoadedFile> loadedFileList = _loadedDataInfo.getLoadedFileList();
    final int loadedFileCount = loadedFileList.size();
    final boolean failure;
    final List<String> detailMessageList = new ArrayList<String>();
    if (_success) {
        failure = false;
        if (loadedFileCount > 0) {
            // has the last line separator
            setupDetailMessage(detailMessageList);
        } else {
            detailMessageList.add("- (no data file)");
        }
    } else {
        // it is the precondition that LoadData stops at the first failure
        failure = true;
        if (loadedFileCount > 0) {
            // has the last line separator
            setupDetailMessage(detailMessageList);
        }
        detailMessageList.add("x (failed: Look at the exception message)");
    }
    for (String detailMessage : detailMessageList) {
        finalInfo.addDetailMessage(detailMessage);
    }
    finalInfo.setFailure(failure);
    finalInfo.setLoadEx(loadEx);
    finalInfo.setProcessPerformanceMillis(processPerformanceMillis);
    return finalInfo;
}
Also used : DfLoadDataFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfLoadDataFinalInfo) DfLoadedFile(org.dbflute.logic.replaceschema.loaddata.base.DfLoadedFile) ArrayList(java.util.ArrayList)

Example 2 with DfLoadedFile

use of org.dbflute.logic.replaceschema.loaddata.base.DfLoadedFile in project dbflute-core by dbflute.

the class DfLoadDataProcess method doSetupDetailMessageFileType.

protected void doSetupDetailMessageFileType(List<String> detailMessageList, List<DfLoadedFile> loadedFileList, int limit) {
    if (loadedFileList == null || loadedFileList.isEmpty()) {
        // means no files for the file type
        return;
    }
    // for example:
    // 
    // (common)
    // o 10-master.xls
    // (ut)
    // o 10-TABLE_NAME.tsv
    // o (and other tsv files...)
    // o 20-member.xls
    // o 30-product.xls
    String fileType4Etc = null;
    boolean etcExists = false;
    boolean etcWarned = false;
    int index = 0;
    for (DfLoadedFile loadedFile : loadedFileList) {
        if (fileType4Etc == null) {
            // first loop
            fileType4Etc = loadedFile.getFileType();
        }
        if (index >= limit) {
            etcExists = true;
            if (loadedFile.isWarned()) {
                etcWarned = true;
            }
            continue;
        }
        final String fileName = loadedFile.getFileName();
        final String mark = loadedFile.isWarned() ? "v " : "o ";
        detailMessageList.add(mark + fileName);
        ++index;
    }
    if (etcExists) {
        final String mark = etcWarned ? "v " : "o ";
        detailMessageList.add(mark + "(and other " + fileType4Etc + " files...)");
    }
}
Also used : DfLoadedFile(org.dbflute.logic.replaceschema.loaddata.base.DfLoadedFile)

Aggregations

DfLoadedFile (org.dbflute.logic.replaceschema.loaddata.base.DfLoadedFile)2 ArrayList (java.util.ArrayList)1 DfLoadDataFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfLoadDataFinalInfo)1