-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simplify build gradle version (#108) * Simplify build gradle version * Simplify build gradle version - readme * ColumnList Sorting (#110) - js -> java * Apply Table Import (#116) * Table import * Query Editor Column List (#112) * Query Editor Column List - apply sorting(with partition, clustering key) * modify js file
- Loading branch information
Showing
26 changed files
with
614 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
cassdio-core/src/main/java/kr/hakdang/cassdio/common/utils/CsvHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.hakdang.cassdio.common.utils; | ||
|
||
/** | ||
* CsvHelper | ||
* | ||
* @author akageun | ||
* @since 2024-08-19 | ||
*/ | ||
public class CsvHelper { | ||
} |
69 changes: 69 additions & 0 deletions
69
...c/main/java/kr/hakdang/cassdio/core/domain/cluster/keyspace/table/ClusterCsvProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster.keyspace.table; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.csv.CSVFormat; | ||
import org.apache.commons.csv.CSVPrinter; | ||
import org.apache.commons.csv.CSVRecord; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.io.IOException; | ||
import java.io.Reader; | ||
import java.io.Writer; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* ClusterTableCsvProvider | ||
* | ||
* @author akageun | ||
* @since 2024-08-08 | ||
*/ | ||
@Slf4j | ||
@Service | ||
public class ClusterCsvProvider { | ||
|
||
public void importerCsvSampleDownload(Writer writer, List<String> headerList) { | ||
CSVFormat csvFormat = CSVFormat.DEFAULT.builder() | ||
.setHeader(headerList.toArray(String[]::new)) | ||
.build(); | ||
|
||
try (final CSVPrinter printer = new CSVPrinter(writer, csvFormat)) { | ||
log.info("create complete importer csv sample"); | ||
|
||
printer.flush(); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
} | ||
|
||
public List<Map<String, Object>> importCsvReader(Reader reader, List<String> columnList) throws IOException { | ||
CSVFormat csvFormat = CSVFormat.DEFAULT.builder() | ||
.setHeader(columnList.toArray(String[]::new)) | ||
.setSkipHeaderRecord(true) | ||
.setTrim(true) | ||
.build(); | ||
|
||
Iterable<CSVRecord> records = csvFormat.parse(reader); | ||
//Validation 방식에 대해 고민 필요 | ||
|
||
List<Map<String, Object>> values = new ArrayList<>(); | ||
|
||
for (CSVRecord record : records) { | ||
|
||
Map<String, Object> map = new HashMap<>(); | ||
|
||
for (String column : columnList) { | ||
map.put(column, StringUtils.defaultIfBlank(record.get(column), "")); | ||
} | ||
|
||
values.add(map); | ||
} | ||
|
||
return values; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...n/java/kr/hakdang/cassdio/core/domain/cluster/keyspace/table/ClusterTableCsvProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package kr.hakdang.cassdio.core.domain.cluster.keyspace.table; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.csv.CSVFormat; | ||
import org.apache.commons.csv.CSVPrinter; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.List; | ||
|
||
/** | ||
* ClusterTableCsvProvider | ||
* | ||
* @author akageun | ||
* @since 2024-08-08 | ||
*/ | ||
@Slf4j | ||
@Service | ||
public class ClusterTableCsvProvider { | ||
|
||
public void importerCsvSampleDownload(Writer writer, List<String> sortedColumnList) { | ||
CSVFormat csvFormat = CSVFormat.DEFAULT.builder() | ||
.setHeader(sortedColumnList.toArray(String[]::new)) | ||
.build(); | ||
|
||
try (final CSVPrinter printer = new CSVPrinter(writer, csvFormat)) { | ||
//printer.printRecord(author, title); | ||
log.info("create complete importer csv sample"); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
...re/src/main/java/kr/hakdang/cassdio/core/domain/cluster/keyspace/table/column/Column.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.