private boolean checkExports(List<OutputDescription> outputs) { assert outputs != null; boolean valid = true; for (OutputDescription output : outputs) { BulkLoadExporterDescription desc = extract(output); Set<String> columns = new HashSet<String>(desc.getColumnNames()); if (columns.containsAll(desc.getTargetColumnNames()) == false) { getEnvironment() .error( "\"{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; }
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))); } }