use of com.baidu.hugegraph.entity.load.ListFormat in project incubator-hugegraph-toolchain by apache.
the class LoadTaskService method buildFileSource.
private FileSource buildFileSource(FileMapping fileMapping) {
// Set input source
FileSource source = new FileSource();
source.path(fileMapping.getPath());
FileSetting setting = fileMapping.getFileSetting();
Ex.check(setting.getColumnNames() != null, "Must do file setting firstly");
source.header(setting.getColumnNames().toArray(new String[] {}));
// NOTE: format and delimiter must be CSV and "," temporarily
source.format(FileFormat.valueOf(setting.getFormat()));
source.delimiter(setting.getDelimiter());
source.charset(setting.getCharset());
source.dateFormat(setting.getDateFormat());
source.timeZone(setting.getTimeZone());
source.skippedLine().regex(setting.getSkippedLine());
// Set list format
source.listFormat(new com.baidu.hugegraph.loader.source.file.ListFormat());
ListFormat listFormat = setting.getListFormat();
source.listFormat().startSymbol(listFormat.getStartSymbol());
source.listFormat().endSymbol(listFormat.getEndSymbol());
source.listFormat().elemDelimiter(listFormat.getElemDelimiter());
return source;
}
Aggregations