Package com.asakusafw.vocabulary.bulkloader.BulkLoadExporterDescription

Examples of com.asakusafw.vocabulary.bulkloader.BulkLoadExporterDescription.DuplicateRecordCheck


            return new TableInfo<V>(
                    definition,
                    description.getTableName(),
                    description.getTargetColumnNames());
        } else {
            DuplicateRecordCheck dup = description.getDuplicateRecordCheck();
            List<String> columns = dup.getColumnNames();
            if (columns.contains(dup.getErrorCodeColumnName()) == false) {
                // restore error code column name
                columns = new ArrayList<String>(columns);
                columns.add(dup.getErrorCodeColumnName());
            }
            return new TableInfo<V>(
                    definition,
                    dup.getTableName(),
                    columns);
        }
    }
View Full Code Here


            BulkLoadExporterDescription description) throws IOException {
        assert definition != null;
        assert description != null;
        LOG.debug("Detecting export target");
        Class<?> modelClass = definition.getModelClass();
        DuplicateRecordCheck dupcheck = description.getDuplicateRecordCheck();
        if (dupcheck != null && modelClass == dupcheck.getTableModelClass()) {
            return false;
        } else if (modelClass == description.getTableModelClass()) {
            return true;
        } else {
            throw new IOException(MessageFormat.format(
View Full Code Here

                        "\"{0}\"の正常テーブルには全体の出力カラムに含まれないカラムが存在します: {1}",
                        desc.getClass().getName(),
                        diff(desc.getTargetColumnNames(), columns));
                valid = false;
            }
            DuplicateRecordCheck dupCheck = desc.getDuplicateRecordCheck();
            if (dupCheck != null) {
                if (columns.containsAll(dupCheck.getColumnNames()) == false) {
                    getEnvironment().error(
                            "\"{0}\"の重複エラーテーブルには全体の出力カラムに含まれないカラムが存在します",
                            desc.getClass().getName(),
                            diff(dupCheck.getColumnNames(), columns));
                    valid = false;
                }
                if (columns.containsAll(dupCheck.getCheckColumnNames()) == false) {
                    getEnvironment().error(
                            "\"{0}\"の重複検査項目には全体の出力カラムに含まれないカラムが存在します",
                            diff(dupCheck.getCheckColumnNames(), columns));
                    valid = false;
                }
            }
        }
        return valid;
View Full Code Here

    }

    private ExportTable convert(OutputDescription output) {
        assert output != null;
        BulkLoadExporterDescription desc = extract(output);
        DuplicateRecordCheck duplicate = desc.getDuplicateRecordCheck();
        if (duplicate == null) {
            return new ExportTable(
                    desc.getModelType(),
                    desc.getTableName(),
                    desc.getColumnNames(),
                    desc.getTargetColumnNames(),
                    null,
                    Collections.singletonList(getOutputLocation(output)));
        } else {
            return new ExportTable(
                    desc.getModelType(),
                    desc.getTableName(),
                    desc.getColumnNames(),
                    desc.getTargetColumnNames(),
                    new DuplicateRecordErrorTable(
                            duplicate.getTableName(),
                            duplicate.getColumnNames(),
                            duplicate.getCheckColumnNames(),
                            duplicate.getErrorCodeColumnName(),
                            duplicate.getErrorCodeValue()),
                    Collections.singletonList(getOutputLocation(output)));
        }
    }
View Full Code Here

     * 重複チェックの情報一覧。
     */
    @Test
    public void duplicateRecordCheck() {
        BulkLoadExporterDescription desc = new MockDupCheckDbExporterDescription();
        DuplicateRecordCheck dup = desc.getDuplicateRecordCheck();
        assertThat(dup, not(nullValue()));
        assertThat(dup.getTableName(), is("MOCK_ERROR"));
        assertThat(dup.getColumnNames(), is(Arrays.asList("A", "B", "C", "D")));
        assertThat(dup.getCheckColumnNames(), is(Arrays.asList("A")));
        assertThat(dup.getErrorCodeColumnName(), is("E"));
        assertThat(dup.getErrorCodeValue(), is("DUP!"));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.vocabulary.bulkloader.BulkLoadExporterDescription.DuplicateRecordCheck

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.