-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#724 - new input to configure the separator
- Loading branch information
1 parent
6546f4c
commit f794725
Showing
5 changed files
with
87 additions
and
21 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
41 changes: 41 additions & 0 deletions
41
...terServer/src/main/java/de/deadlocker8/budgetmaster/transactions/csvImport/CsvImport.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,41 @@ | ||
package de.deadlocker8.budgetmaster.transactions.csvImport; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public record CsvImport(MultipartFile file, String separator) | ||
{ | ||
@Override | ||
public String toString() | ||
{ | ||
return "CsvImport{" + | ||
"file=" + file + | ||
", separator='" + separator + '\'' + | ||
'}'; | ||
} | ||
|
||
public boolean isValidSeparator() | ||
{ | ||
if(separator == null) | ||
{ | ||
return false; | ||
} | ||
|
||
return separator.strip().length() == 1; | ||
} | ||
|
||
public String getFileName() | ||
{ | ||
if(file == null) | ||
{ | ||
return null; | ||
} | ||
|
||
final String fileName = file.getOriginalFilename(); | ||
if(fileName == null) | ||
{ | ||
return file.getName(); | ||
} | ||
|
||
return fileName; | ||
} | ||
} |
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