database creation runs now.
This commit is contained in:
parent
f71fe83a10
commit
1b3e512819
121 changed files with 5912 additions and 102 deletions
20
pom.xml
20
pom.xml
|
|
@ -38,20 +38,38 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId> <!--`-->
|
||||
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>1.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf-spring6</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
11
src/main/java/de/avatic/taricdb/TaricConfiguration.java
Normal file
11
src/main/java/de/avatic/taricdb/TaricConfiguration.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package de.avatic.taricdb;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class TaricConfiguration {
|
||||
|
||||
|
||||
}
|
||||
25
src/main/java/de/avatic/taricdb/helper/file/InMemFile.java
Normal file
25
src/main/java/de/avatic/taricdb/helper/file/InMemFile.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package de.avatic.taricdb.helper.file;
|
||||
|
||||
public class InMemFile {
|
||||
private String name;
|
||||
private byte[] blob;
|
||||
|
||||
|
||||
public InMemFile(String name, byte[] blob) {
|
||||
this.name = name;
|
||||
this.blob = blob;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getFileSize() {
|
||||
return blob.length;
|
||||
}
|
||||
|
||||
public byte[] getBlob() {
|
||||
return blob;
|
||||
}
|
||||
|
||||
}
|
||||
14
src/main/java/de/avatic/taricdb/helper/stats/HeapStat.java
Normal file
14
src/main/java/de/avatic/taricdb/helper/stats/HeapStat.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package de.avatic.taricdb.helper.stats;
|
||||
|
||||
public class HeapStat {
|
||||
|
||||
public static String getHeapUtilization() {
|
||||
|
||||
long maxMemory = Runtime.getRuntime().maxMemory() / 1024 / 1024;
|
||||
long allocatedMemory = Runtime.getRuntime().totalMemory() / 1024 / 1024;
|
||||
long freeMemory = Runtime.getRuntime().freeMemory() / 1024 / 1024;
|
||||
|
||||
return "[ Memory used: " + (allocatedMemory - freeMemory) + " MB | total utilization: " + ((((allocatedMemory - freeMemory))*100)/maxMemory) + "%]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package de.avatic.taricdb.model;
|
||||
package de.avatic.taricdb.helper.workbook;
|
||||
|
||||
public enum UploadFileType {
|
||||
ZIP("null"),
|
||||
public enum ExcelFileType {
|
||||
DUTIES("Duties Import 01-99.xlsx"),
|
||||
BUSINESS_CODE("TARIC Business codes.xlsx"),
|
||||
GEO_COMPOSITION("Geographical areas composition.xlsx"),
|
||||
|
|
@ -14,13 +13,29 @@ public enum UploadFileType {
|
|||
NOMENCLATURE_FR("Nomenclature FR.xlsx"),
|
||||
NOMENCLATURE_EN("Nomenclature EN.xlsx"),
|
||||
DECLARABLE_CODES("Declarable codes.xlsx"),
|
||||
ADDITIONAL_CODES("Additional codes descriptions.xlsx"),
|
||||
ADDITIONAL_CODES("Additional codes descriptions.xlsx"), //OK
|
||||
BOX_44("Box 44 codes of the SAD.xlsx"),
|
||||
FOOTNOTES("Footnotes descriptions.xlsx"),
|
||||
NOMENCLATURE_FOOTNOTES("Nomenclature footnotes.xlsx");
|
||||
|
||||
UploadFileType(String fileName) {
|
||||
|
||||
private String fileName;
|
||||
|
||||
|
||||
ExcelFileType(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public static ExcelFileType fromFileName(String fileName) {
|
||||
for (ExcelFileType type : values()) {
|
||||
if (type.fileName.equals(fileName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package de.avatic.taricdb.helper.workbook;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
|
||||
public class ExcelHeader {
|
||||
|
||||
private List<String> header = new ArrayList<String>();
|
||||
|
||||
public ExcelHeader(XSSFRow row) {
|
||||
row.cellIterator().forEachRemaining(cell -> {
|
||||
header.add(cell.getStringCellValue().trim());
|
||||
});
|
||||
}
|
||||
|
||||
public int getIndex(String string) {
|
||||
return header.indexOf(string);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return header.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
138
src/main/java/de/avatic/taricdb/helper/workbook/ExcelRow.java
Normal file
138
src/main/java/de/avatic/taricdb/helper/workbook/ExcelRow.java
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
package de.avatic.taricdb.helper.workbook;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
public class ExcelRow {
|
||||
|
||||
private static final String DATE_FORMAT = "dd-MM-yyyy";
|
||||
private static final String DATE_FORMAT2 = "dd.MM.yyyy";
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
||||
private static final DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern(DATE_FORMAT2);
|
||||
|
||||
|
||||
private List<String> values = new ArrayList<>();
|
||||
|
||||
private ExcelHeader header;
|
||||
|
||||
private int index;
|
||||
|
||||
private Row row;
|
||||
|
||||
private List<LocalDate> date;
|
||||
|
||||
public ExcelRow(Row row, ExcelHeader header) {
|
||||
this.date = new ArrayList<>();
|
||||
this.row = row;
|
||||
|
||||
row.cellIterator().forEachRemaining(cell -> {
|
||||
LocalDate cellDate = null;
|
||||
|
||||
switch(cell.getCellType())
|
||||
{
|
||||
case NUMERIC:
|
||||
double value = cell.getNumericCellValue();
|
||||
|
||||
if(DateUtil.isCellDateFormatted(cell))
|
||||
{
|
||||
cellDate = cell.getLocalDateTimeCellValue().toLocalDate();
|
||||
}
|
||||
if(isInteger(value)) {
|
||||
values.add(String.valueOf((int)value));
|
||||
} else {
|
||||
values.add(String.valueOf(value));
|
||||
}
|
||||
|
||||
break;
|
||||
case BLANK:
|
||||
case STRING:
|
||||
values.add(cell.getStringCellValue());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported cell type: " + cell.getCellType());
|
||||
}
|
||||
|
||||
date.add(cellDate);
|
||||
});
|
||||
|
||||
this.header = header;
|
||||
this.index = row.getRowNum();
|
||||
|
||||
}
|
||||
|
||||
public boolean isInteger(double number){
|
||||
return Math.ceil(number) == Math.floor(number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getAs(String string, Class<T> clazz) {
|
||||
int columnIdx = getColumnIdx(string.trim());
|
||||
|
||||
|
||||
if (columnIdx == -1) {
|
||||
throw new IllegalArgumentException("Column " + string + " not found, available columns are: " + header);
|
||||
}
|
||||
|
||||
if ( clazz == String.class) {
|
||||
return (T) values.get(columnIdx);
|
||||
}
|
||||
|
||||
if (clazz == Integer.class) {
|
||||
if (values.get(columnIdx).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (T) Integer.valueOf(values.get(columnIdx));
|
||||
}
|
||||
|
||||
if (clazz == Boolean.class) {
|
||||
if (values.get(columnIdx).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (T) Boolean.valueOf(Integer.valueOf(values.get(columnIdx)) == 1);
|
||||
}
|
||||
|
||||
if (clazz == LocalDate.class) {
|
||||
|
||||
|
||||
if (this.date.get(columnIdx) != null) {
|
||||
return (T) this.date.get(columnIdx);
|
||||
}
|
||||
|
||||
if (values.get(header.getIndex(string)).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return (T) LocalDate.parse(values.get(columnIdx), formatter2);
|
||||
} catch (Exception e) {
|
||||
return (T) LocalDate.parse(values.get(columnIdx), formatter);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getColumnIdx(String string) {
|
||||
int idx = header.getIndex(string);
|
||||
|
||||
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package de.avatic.taricdb.helper.workbook;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import de.avatic.taricdb.helper.file.InMemFile;
|
||||
|
||||
public class ExcelTable {
|
||||
|
||||
private ExcelTableType type;
|
||||
|
||||
private InMemFile file;
|
||||
|
||||
private XSSFWorkbook workbook;
|
||||
|
||||
private XSSFSheet sheet;
|
||||
|
||||
private int recordCount;
|
||||
|
||||
private ExcelHeader header;
|
||||
|
||||
public ExcelTable(ExcelTableType type, InMemFile file) throws IOException {
|
||||
this.file = file;
|
||||
this.type = type;
|
||||
|
||||
this.workbook = new XSSFWorkbook(new ByteArrayInputStream(file.getBlob()));
|
||||
this.sheet = getSheet();
|
||||
this.recordCount = countRecords();
|
||||
|
||||
this.header = new ExcelHeader(sheet.getRow(0));
|
||||
|
||||
}
|
||||
|
||||
private XSSFSheet getSheet() {
|
||||
if (type.getSheetIndex() == -1) {
|
||||
return workbook.getSheet(type.getSheetName());
|
||||
}
|
||||
|
||||
return workbook.getSheetAt(type.getSheetIndex());
|
||||
}
|
||||
|
||||
private int countRecords() {
|
||||
if (sheet == null) {
|
||||
return -1;
|
||||
}
|
||||
return sheet.getPhysicalNumberOfRows();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ExcelFileType getFileType() {
|
||||
return type.getFileType();
|
||||
}
|
||||
|
||||
public ExcelTableType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<ExcelRow> getRows() {
|
||||
ArrayList<ExcelRow> rows = new ArrayList<>();
|
||||
|
||||
sheet.iterator().forEachRemaining(row -> {
|
||||
if (row.getRowNum() != 0) {
|
||||
rows.add(new ExcelRow(row , header));
|
||||
}
|
||||
});
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return recordCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
|
||||
package de.avatic.taricdb.helper.workbook;
|
||||
|
||||
public enum ExcelTableType {
|
||||
ADDITIONAL_CODE(ExcelFileType.ADDITIONAL_CODES, "Sheet1", 0),
|
||||
APPLIED_MEASURES(ExcelFileType.DUTIES, "Sheet 1", 0),
|
||||
APPLIED_MEASURE_CONDITION(ExcelFileType.MEASURE_CONDITIONS, "Sheet 1", 0),
|
||||
CERTIFICATE_TYPE(ExcelFileType.BUSINESS_CODE, "Certificate types", -1),
|
||||
CERTIFICATE(ExcelFileType.BOX_44, "Sheet 1 ", 0),
|
||||
CONDITION_TYPE(ExcelFileType.BUSINESS_CODE, "Condition types", -1),
|
||||
FOOTNOTES(ExcelFileType.FOOTNOTES, "Sheet1", 0),
|
||||
GEO_GROUP(ExcelFileType.GEO, "Sheet 1", 0),
|
||||
GEO_MEMBERSHIP(ExcelFileType.GEO_COMPOSITION, "Sheet 1", 0),
|
||||
LEGAL_BASE(ExcelFileType.LEGAL_BASES, "Sheet1 1", 0),
|
||||
MEASURE(ExcelFileType.BUSINESS_CODE, "Measure types", -1),
|
||||
MEASURE_FOOTNOTES(ExcelFileType.MEASURE_FOOTNOTES, "Sheet 1", 0),
|
||||
MEASURE_SERIES(ExcelFileType.BUSINESS_CODE, "Measure type series", -1),
|
||||
MEASURE_ACTION(ExcelFileType.BUSINESS_CODE, "Measure actions", -1),
|
||||
MEASURE_EXCLUSION(ExcelFileType.MEASURE_EXCLUSIONS, "Sheet 1", 0),
|
||||
MONETARY_UNIT(ExcelFileType.BUSINESS_CODE, "Monetary Units", -1),
|
||||
NOMENCLATURE_DE(ExcelFileType.NOMENCLATURE_DE, "Sheet1", 0),
|
||||
NOMENCLATURE_EN(ExcelFileType.NOMENCLATURE_EN, "Sheet1", 0),
|
||||
NOMENCLATURE_FR(ExcelFileType.NOMENCLATURE_FR, "Sheet1", 0),
|
||||
NOMENCLATURE_DECLAREABLE(ExcelFileType.DECLARABLE_CODES, "Sheet 1", 0),
|
||||
NOMENCLATURE_FOOTNOTE(ExcelFileType.NOMENCLATURE_FOOTNOTES, "Sheet 1", 0),
|
||||
UNIT(ExcelFileType.BUSINESS_CODE, "Measurement Units & Qualifiers", -1);
|
||||
|
||||
|
||||
private String sheetName;
|
||||
private int sheetIndex;
|
||||
private ExcelFileType fileType;
|
||||
|
||||
ExcelTableType(ExcelFileType fileType, String sheetName, int sheetIndex) {
|
||||
this.sheetName = sheetName;
|
||||
this.sheetIndex = sheetIndex;
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
static ExcelTableType fromFileName(String name) {
|
||||
ExcelFileType fileType = ExcelFileType.fromFileName(name);
|
||||
|
||||
if (fileType == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (ExcelTableType tableType : values()) {
|
||||
if (fileType.equals(tableType.getFileType())) {
|
||||
return tableType;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
int getSheetIndex() {
|
||||
return sheetIndex;
|
||||
}
|
||||
|
||||
String getSheetName() {
|
||||
return sheetName;
|
||||
}
|
||||
|
||||
public ExcelFileType getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.AdditionalCode;
|
||||
import de.avatic.taricdb.model.AdditionalCodeDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class AdditionalCodeConverter implements ExcelTableConverter<AdditionalCode> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public AdditionalCodeConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<AdditionalCode> convert(ExcelTable table) {
|
||||
Collection<AdditionalCode> codes = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String code = row.getAs("Add code", String.class);
|
||||
|
||||
AdditionalCode addCode = codes.stream().filter(c -> c.getAdditionalCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (addCode == null) {
|
||||
addCode = new AdditionalCode(code, row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class));
|
||||
codes.add(addCode);
|
||||
}
|
||||
|
||||
addCode.addDesc(new AdditionalCodeDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)));
|
||||
|
||||
|
||||
});
|
||||
|
||||
return codes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.AppliedMeasureConditionWrapper;
|
||||
import de.avatic.taricdb.model.AppliedMeasureCondition;
|
||||
import de.avatic.taricdb.model.Certificate;
|
||||
import de.avatic.taricdb.model.ConditionType;
|
||||
import de.avatic.taricdb.model.MeasureAction;
|
||||
import de.avatic.taricdb.model.MonetaryUnit;
|
||||
import de.avatic.taricdb.model.Unit;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class AppliedMeasureConditionConverter implements ExcelTableConverter<AppliedMeasureConditionWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public AppliedMeasureConditionConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<AppliedMeasureConditionWrapper> convert(ExcelTable table) {
|
||||
Collection<AppliedMeasureConditionWrapper> conditions = new ArrayList<>();
|
||||
Collection<ConditionType> conditionTypes = referenceStorage.getEntites(ConditionType.class);
|
||||
Collection<Certificate> certificates = referenceStorage.getEntites(Certificate.class);
|
||||
Collection<MonetaryUnit> monetaryUnits = referenceStorage.getEntites(MonetaryUnit.class);
|
||||
Collection<Unit> units = referenceStorage.getEntites(Unit.class);
|
||||
Collection<MeasureAction> actions = referenceStorage.getEntites(MeasureAction.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String hsCode = row.getAs("Goods code", String.class);
|
||||
String originCode = row.getAs("Origin code", String.class);
|
||||
String additionalCode = row.getAs("Add code", String.class);
|
||||
String orderNumber = row.getAs("Order No.", String.class);
|
||||
|
||||
String monetaryUnitCode = row.getAs("Mon. unit", String.class);
|
||||
String unitCode = row.getAs("Meas. unit", String.class);
|
||||
String amount = row.getAs("Cond. amount", String.class);
|
||||
Integer sequenceNumber = row.getAs("Sequence", Integer.class);
|
||||
|
||||
Integer measureCode = row.getAs("Meas. type code", Integer.class);
|
||||
|
||||
Certificate certificate = certificates.stream()
|
||||
.filter(c -> c.getCertificateCode().equals(row.getAs("Certificate", String.class))).findAny()
|
||||
.orElse(null);
|
||||
MeasureAction action = actions.stream()
|
||||
.filter(c -> c.getMeasureActionCode().equals(row.getAs("Meas. action", String.class))).findAny()
|
||||
.orElse(null);
|
||||
ConditionType conditionType = conditionTypes.stream()
|
||||
.filter(c -> c.getConditionTypeCode().equals(row.getAs("Meas. cond", String.class))).findAny()
|
||||
.orElse(null);
|
||||
|
||||
Unit unit = null;
|
||||
if (unitCode != null) {
|
||||
unit = units.stream().filter(c -> c.getUnitCode().equals(unitCode)).findAny().orElse(null);
|
||||
}
|
||||
|
||||
MonetaryUnit monetaryUnit = null;
|
||||
if (monetaryUnitCode != null) {
|
||||
monetaryUnit = monetaryUnits.stream().filter(c -> c.getMonetaryUnitCode().equals(monetaryUnitCode))
|
||||
.findAny().orElse(null);
|
||||
}
|
||||
|
||||
AppliedMeasureConditionWrapper condition = conditions.stream()
|
||||
.filter(c -> c.getHsCode().equals(hsCode)
|
||||
&& c.getOriginCode().equals(originCode)
|
||||
&& c.getAdditionalCode().equals(additionalCode)
|
||||
&& c.getOrderNumber().equals(orderNumber)
|
||||
&& c.getAppliedMeasureCondition().getSequenceNo().equals(sequenceNumber)
|
||||
&& c.getAppliedMeasureCondition().getConditionType().getId().equals(conditionType.getId())
|
||||
&& c.getMeasureCode().equals(measureCode))
|
||||
.findAny().orElse(null);
|
||||
|
||||
if (condition == null) {
|
||||
condition = new AppliedMeasureConditionWrapper(
|
||||
new AppliedMeasureCondition(AggregateReference.to(action.getId()),
|
||||
monetaryUnit == null ? null : AggregateReference.to(monetaryUnit.getId()),
|
||||
unit == null ? null : AggregateReference.to(unit.getId()),
|
||||
certificate == null ? null : AggregateReference.to(certificate.getId()),
|
||||
AggregateReference.to(conditionType.getId()), amount, sequenceNumber),
|
||||
hsCode, originCode, additionalCode, orderNumber, measureCode);
|
||||
conditions.add(condition);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Duplicate applied measure condtion found: " + hsCode + " "
|
||||
+ originCode + " " + additionalCode + " " + orderNumber);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return conditions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.stats.HeapStat;
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.AppliedMeasureConditionWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.AppliedMeasureWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.MeasureExclusionWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.MeasureFootnoteWrapper;
|
||||
import de.avatic.taricdb.model.AppliedMeasure;
|
||||
import de.avatic.taricdb.model.AppliedMeasureCondition;
|
||||
import de.avatic.taricdb.model.LegalBase;
|
||||
import de.avatic.taricdb.model.Measure;
|
||||
import de.avatic.taricdb.model.MeasureExclusion;
|
||||
import de.avatic.taricdb.model.MeasureFootnote;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
import de.avatic.taricdb.service.SetupStatusService;
|
||||
|
||||
public class AppliedMeasureConverter implements ExcelTableConverter<AppliedMeasureWrapper> {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(AppliedMeasureConverter.class);
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
private SetupStatusService statusService;
|
||||
private int recordOffset;
|
||||
private int count = 0;
|
||||
|
||||
public AppliedMeasureConverter(ReferenceStorageService referenceStorage, SetupStatusService statusService, int recordCurrentCount) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
this.statusService = statusService;
|
||||
this.recordOffset = recordCurrentCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<AppliedMeasureWrapper> convert(ExcelTable table) {
|
||||
Collection<AppliedMeasureWrapper> appliedMeasures = new ArrayList<>();
|
||||
|
||||
Collection<MeasureFootnoteWrapper> measureFootnoteWrappers = referenceStorage
|
||||
.getEntites(MeasureFootnoteWrapper.class);
|
||||
Collection<Measure> measures = referenceStorage.getEntites(Measure.class);
|
||||
Collection<MeasureExclusionWrapper> measureExclusions = referenceStorage
|
||||
.getEntites(MeasureExclusionWrapper.class);
|
||||
Collection<AppliedMeasureConditionWrapper> appliedMeasureConditions = referenceStorage
|
||||
.getEntites(AppliedMeasureConditionWrapper.class);
|
||||
|
||||
Collection<LegalBase> legalBases = referenceStorage.getEntites(LegalBase.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
count++;
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (count % 10000 == 0) {
|
||||
int percentage = Math.round((count*100)/table.getRows().size());
|
||||
log.info("applied measures processed: "+percentage+"% - " + count + " of " + table.getRows().size() + " " + HeapStat.getHeapUtilization(), true, null);
|
||||
statusService.setStatus(recordOffset, "Convert applied measures ... " + percentage + "% ", true , null);
|
||||
}
|
||||
|
||||
String hsCode = row.getAs("Goods code", String.class);
|
||||
String origin = row.getAs("Origin code", String.class);
|
||||
String addCode = row.getAs("Add code", String.class);
|
||||
Integer measureCode = row.getAs("Meas. type code", Integer.class);
|
||||
String measureCodeStr = row.getAs("Meas. type code", String.class);
|
||||
String legalBase = row.getAs("Legal base", String.class);
|
||||
String orderNumber = row.getAs("Order No.", String.class);
|
||||
Integer orderNumberInt = row.getAs("Order No.", Integer.class);
|
||||
|
||||
LocalDate startDate = row.getAs("Start date", LocalDate.class);
|
||||
LocalDate endDate = row.getAs("End date", LocalDate.class);
|
||||
String amount = row.getAs("Duty", String.class);
|
||||
|
||||
Measure measure = measures.stream().filter(c -> c.getMeasureCode().equals(measureCodeStr)).findAny()
|
||||
.orElse(null);
|
||||
|
||||
if (null == measure) {
|
||||
throw new RuntimeException("Measure not found: " + row.getAs("Meas. type code", String.class));
|
||||
}
|
||||
|
||||
Set<MeasureFootnote> foundMeasureFootnotes = measureFootnoteWrappers.stream()
|
||||
.filter(s -> s.getMeasureCode().equals(measureCode) && s.getHsCode().equals(hsCode)
|
||||
&& s.getOrigin().equals(origin) && s.getAddCode().equals(addCode) && s.getOrderNumber().equals(orderNumber))
|
||||
.map(MeasureFootnoteWrapper::getMeasureFootnote).collect(Collectors.toSet());
|
||||
|
||||
Set<MeasureExclusion> foundMeasureExclusions = null;
|
||||
|
||||
if(isNumeric(origin)) {
|
||||
Integer originCode = Integer.parseInt(origin);
|
||||
foundMeasureExclusions = measureExclusions.stream()
|
||||
.filter(s -> s.getMeasureCode().equals(measureCode) && s.getHsCode().equals(hsCode)
|
||||
&& s.getOriginCode().equals(originCode) && s.getAddCode().equals(addCode) && s.getOrderNumber().equals(orderNumber))
|
||||
.map(MeasureExclusionWrapper::getMeasureExclusion).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
Set<AppliedMeasureCondition> foundMeasureConditions = appliedMeasureConditions.stream()
|
||||
.filter(s -> s.getHsCode().equals(hsCode) && s.getOriginCode().equals(origin)
|
||||
&& s.getAdditionalCode().equals(addCode) && s.getOrderNumber().equals(orderNumber) && s.getMeasureCode().equals(measureCode))
|
||||
.map(AppliedMeasureConditionWrapper::getAppliedMeasureCondition).collect(Collectors.toSet());
|
||||
|
||||
LegalBase foundLegalBase = legalBases.stream().filter(s -> s.getLegalBase().equals(legalBase)).findAny()
|
||||
.orElse(null);
|
||||
|
||||
if (legalBase == null) {
|
||||
throw new RuntimeException("Legal base not found: " + legalBase);
|
||||
}
|
||||
|
||||
AppliedMeasureWrapper appliedMeasure = new AppliedMeasureWrapper(
|
||||
new AppliedMeasure(AggregateReference.to(measure.getId()), foundMeasureFootnotes,
|
||||
foundLegalBase == null ? null : AggregateReference.to(foundLegalBase.getId()), foundLegalBase == null ? legalBase : null, foundMeasureExclusions,
|
||||
foundMeasureConditions, startDate, endDate, amount, orderNumberInt),
|
||||
hsCode, addCode, origin);
|
||||
|
||||
appliedMeasures.add(appliedMeasure);
|
||||
|
||||
});
|
||||
|
||||
return appliedMeasures;
|
||||
}
|
||||
|
||||
|
||||
private boolean isNumeric(String str) {
|
||||
return str.matches("-?\\d+(\\.\\d+)?"); // match a number with optional '-' and decimal.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.Certificate;
|
||||
import de.avatic.taricdb.model.CertificateDesc;
|
||||
import de.avatic.taricdb.model.CertificateType;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class CertificateConverter implements ExcelTableConverter<Certificate> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
|
||||
public CertificateConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<Certificate> convert(ExcelTable table) {
|
||||
Collection<Certificate> certs = new ArrayList<>();
|
||||
Collection<CertificateType> certTypes = referenceStorage.getEntites(CertificateType.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("Certificate code", String.class);
|
||||
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Certificate cert = certs.stream().filter(s -> s.getCertificateCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (cert == null) {
|
||||
String certTypeCode = String.valueOf(code.charAt(0));
|
||||
CertificateType foundCertType = referenceStorage.getEntites(CertificateType.class).stream().filter(s -> s.getCertificateTypeCode().equals(certTypeCode)).findAny().orElse(null);
|
||||
|
||||
cert = new Certificate(code, row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class), AggregateReference.to(foundCertType.getId()));
|
||||
certs.add(cert);
|
||||
}
|
||||
|
||||
cert.addCertificateDesc(new CertificateDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Description start date", LocalDate.class)));
|
||||
|
||||
});
|
||||
|
||||
|
||||
return certs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.CertificateType;
|
||||
import de.avatic.taricdb.model.CertificateTypeDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class CertificateTypeConverter implements ExcelTableConverter<CertificateType> {
|
||||
|
||||
public CertificateTypeConverter(ReferenceStorageService referenceStorage) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CertificateType> convert(ExcelTable table) {
|
||||
Collection<CertificateType> certTypes = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("CERT_TYP_COD", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CertificateType certType = certTypes.stream().filter(s -> s.getCertificateTypeCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (certType == null) {
|
||||
certType = new CertificateType(code);
|
||||
certTypes.add(certType);
|
||||
}
|
||||
|
||||
certType.addCertificateTypeDesc(new CertificateTypeDesc(row.getAs("LANG_COD", String.class), row.getAs("DESCR", String.class), null));
|
||||
|
||||
});
|
||||
|
||||
|
||||
return certTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.ConditionType;
|
||||
import de.avatic.taricdb.model.ConditionTypeDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class ConditionTypeConverter implements ExcelTableConverter<ConditionType> {
|
||||
|
||||
|
||||
|
||||
public ConditionTypeConverter(ReferenceStorageService referenceStorage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConditionType> convert(ExcelTable table) {
|
||||
Collection<ConditionType> conditionTypes = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("MEAS_COND_COD", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConditionType conditionType = conditionTypes.stream().filter(s -> s.getConditionTypeCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (conditionType == null) {
|
||||
conditionType = new ConditionType(code);
|
||||
conditionTypes.add(conditionType);
|
||||
}
|
||||
|
||||
conditionType.addConditionTypeDesc(new ConditionTypeDesc(row.getAs("LANG_COD", String.class), row.getAs("DESCR", String.class), null));
|
||||
|
||||
});
|
||||
|
||||
|
||||
return conditionTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.DeclarableCodesWrapper;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class DeclarableCodesConverter implements ExcelTableConverter<DeclarableCodesWrapper> {
|
||||
|
||||
public DeclarableCodesConverter(ReferenceStorageService referenceStorageService) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<DeclarableCodesWrapper> convert(ExcelTable table) {
|
||||
Collection<DeclarableCodesWrapper> declarableGoods = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String goodsCode = row.getAs("Goods code", String.class);
|
||||
String hsCode = goodsCode.substring(0, 10);
|
||||
String suffix = goodsCode.substring(11, 13);
|
||||
Boolean isLeaf = row.getAs("IS_LEAF", Boolean.class);
|
||||
LocalDate declStartDate = row.getAs("Decl. start date", LocalDate.class);
|
||||
|
||||
declarableGoods.add(new DeclarableCodesWrapper(hsCode, suffix, declStartDate, isLeaf));
|
||||
|
||||
});
|
||||
|
||||
return declarableGoods;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
|
||||
public interface ExcelTableConverter<T> {
|
||||
|
||||
public Collection<T> convert(ExcelTable table);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.Footnote;
|
||||
import de.avatic.taricdb.model.FootnotesDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class FootnoteConverter implements ExcelTableConverter<Footnote> {
|
||||
|
||||
public FootnoteConverter(ReferenceStorageService referenceStorage) {
|
||||
}
|
||||
|
||||
public Collection<Footnote> convert(ExcelTable table) {
|
||||
List<Footnote> footnotes = new ArrayList<>();
|
||||
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String txt = row.getAs("Footnote", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Footnote footnote = footnotes.stream().filter(f -> f.getFootnote().equals(txt)).findAny().orElse(null);
|
||||
|
||||
if (footnote == null) {
|
||||
footnote = new Footnote(txt, row.getAs("Description", String.class),
|
||||
row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class));
|
||||
footnotes.add(footnote);
|
||||
}
|
||||
|
||||
footnote.addFootnotesDesc(new FootnotesDesc(row.getAs("Description", String.class),
|
||||
row.getAs("Language", String.class), row.getAs("Descr. start date", LocalDate.class)));
|
||||
});
|
||||
|
||||
|
||||
return footnotes;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.Geo;
|
||||
import de.avatic.taricdb.model.GeoDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class GeoConverter implements ExcelTableConverter<Geo> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public GeoConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Geo> convert(ExcelTable table) {
|
||||
Collection<Geo> geos = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String origin = row.getAs("Or./Dest.", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isNumeric(origin)) {
|
||||
Geo geo = geos.stream().filter(s -> s.getIso3166Code().equals(origin)).findAny().orElse(null);
|
||||
|
||||
if (geo == null) {
|
||||
geo = new Geo(origin);
|
||||
geos.add(geo);
|
||||
}
|
||||
|
||||
geo.addGeoDescription(new GeoDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
return geos;
|
||||
}
|
||||
|
||||
private boolean isNumeric(String str) {
|
||||
return str.matches("-?\\d+(\\.\\d+)?"); // match a number with optional '-' and decimal.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.GeoGroupMembershipWrapper;
|
||||
import de.avatic.taricdb.model.GeoGroup;
|
||||
import de.avatic.taricdb.model.GeoGroupDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class GeoGroupConverter implements ExcelTableConverter<GeoGroup> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public GeoGroupConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<GeoGroup> convert(ExcelTable table) {
|
||||
Collection<GeoGroup> groups = new ArrayList<>();
|
||||
Collection<GeoGroupMembershipWrapper> memberships = referenceStorage.getEntites(GeoGroupMembershipWrapper.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String origin = row.getAs("Or./Dest.", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNumeric(origin)) {
|
||||
Integer groupId = Integer.parseInt(origin);
|
||||
|
||||
GeoGroup geoGroup = groups.stream().filter(s -> s.getGeoGroupCode().equals(origin)).findAny()
|
||||
.orElse(null);
|
||||
|
||||
if (geoGroup == null) {
|
||||
Set<GeoGroupMembershipWrapper> foundMemberships = memberships.stream()
|
||||
.filter(s -> s.getGeoGroupId().equals(groupId)).collect(Collectors.toSet());
|
||||
|
||||
geoGroup = new GeoGroup(origin, row.getAs("Abbrev.", String.class),
|
||||
row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class),
|
||||
foundMemberships.stream().map(GeoGroupMembershipWrapper::getGeoGroupMembership)
|
||||
.collect(Collectors.toSet()));
|
||||
|
||||
groups.add(geoGroup);
|
||||
}
|
||||
|
||||
geoGroup.addGeoGroupDesc(new GeoGroupDesc(row.getAs("Language", String.class),
|
||||
row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
private boolean isNumeric(String str) {
|
||||
return str.matches("-?\\d+(\\.\\d+)?"); // match a number with optional '-' and decimal.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.GeoGroupMembershipWrapper;
|
||||
import de.avatic.taricdb.model.Geo;
|
||||
import de.avatic.taricdb.model.GeoGroupMembership;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class GeoGroupMembershipConverter implements ExcelTableConverter<GeoGroupMembershipWrapper> {
|
||||
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public GeoGroupMembershipConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<GeoGroupMembershipWrapper> convert(ExcelTable table) {
|
||||
Collection<GeoGroupMembershipWrapper> memberships = new ArrayList<>();
|
||||
Collection<Geo> geos = referenceStorage.getEntites(Geo.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Integer group = row.getAs("Country group", Integer.class);
|
||||
String member = row.getAs("Member country", String.class);
|
||||
Geo geo = geos.stream().filter(s -> s.getIso3166Code().equals(member)).findAny().orElse(null);
|
||||
Integer memberId = geo.getId();
|
||||
|
||||
GeoGroupMembershipWrapper membership = memberships.stream().filter(s -> s.getGeoGroupId().equals(group) && s.getGeoGroupMembership().getGeo().getId().equals(memberId)).findAny().orElse(null);
|
||||
|
||||
if (membership == null) {
|
||||
membership = new GeoGroupMembershipWrapper(group, new GeoGroupMembership(row.getAs("Mbship start date", LocalDate.class), row.getAs("Mbship end date", LocalDate.class), AggregateReference.to(memberId)));
|
||||
memberships.add(membership);
|
||||
}
|
||||
});
|
||||
|
||||
return memberships;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.stats.HeapStat;
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.AppliedMeasureWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.ImportWrapper;
|
||||
import de.avatic.taricdb.model.AdditionalCode;
|
||||
import de.avatic.taricdb.model.AppliedMeasure;
|
||||
import de.avatic.taricdb.model.Geo;
|
||||
import de.avatic.taricdb.model.GeoGroup;
|
||||
import de.avatic.taricdb.model.Import;
|
||||
import de.avatic.taricdb.model.Nomenclature;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
import de.avatic.taricdb.service.SetupStatusService;
|
||||
|
||||
public class ImportConverter implements ExcelTableConverter<Import> {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(ImportConverter.class);
|
||||
|
||||
int count = 0;
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
private SetupStatusService statusService;
|
||||
|
||||
private int recordOffset;
|
||||
|
||||
public ImportConverter(ReferenceStorageService referenceStorage, SetupStatusService statusService, int recordOffset) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
this.statusService = statusService;
|
||||
this.recordOffset = recordOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Import> convert(ExcelTable table) {
|
||||
|
||||
|
||||
|
||||
// Collection<ImportWrapper> imports = new ArrayList<>();
|
||||
//
|
||||
// Collection<Geo> geos = referenceStorage.getEntites(Geo.class);
|
||||
// Collection<GeoGroup> geoGroups = referenceStorage.getEntites(GeoGroup.class);
|
||||
// Collection<AppliedMeasureWrapper> appliedMeasures = referenceStorage.getEntites(AppliedMeasureWrapper.class);
|
||||
// Collection<AdditionalCode> additionalCodes = referenceStorage.getEntites(AdditionalCode.class);
|
||||
// Collection<Nomenclature> nomenclatures = referenceStorage.getEntites(Nomenclature.class);
|
||||
//
|
||||
// table.getRows().forEach((row) -> {
|
||||
// count++;
|
||||
// if (row.index() == 0) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (count % 10000 == 0) {
|
||||
// int percentage = Math.round((count*100)/table.getRows().size());
|
||||
// log.info("import duties processed: "+percentage+"% - " + count + " of " + table.getRows().size() + " " + HeapStat.getHeapUtilization(), true, null);
|
||||
// statusService.setStatus(recordOffset, "Convert import duties measures ... " + percentage + "%", true , null);
|
||||
// }
|
||||
//
|
||||
// String hsCode = row.getAs("Goods code", String.class);
|
||||
// String origin = row.getAs("Origin code", String.class);
|
||||
// String addCode = row.getAs("Add code", String.class);
|
||||
//
|
||||
// ImportWrapper im = imports.stream().filter(i -> i.getHsCode().equals(hsCode) && i.getOrigin().equals(origin) && i.getAddCode().equals(addCode)).findFirst().orElse(null);
|
||||
//
|
||||
// if(im == null) {
|
||||
// Nomenclature nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode)).findFirst().orElse(null);
|
||||
// AdditionalCode additionalCode = additionalCodes.stream().filter(a -> a.getAdditionalCode().equals(addCode)).findFirst().orElse(null);
|
||||
// Set<AppliedMeasure> foundAppliedMeasures = appliedMeasures.stream().filter(a -> a.getHsCode().equals(hsCode) && a.getOrigin().equals(origin) && a.getAdditionalCode().equals(addCode)).map(AppliedMeasureWrapper::getAppliedMeasure).collect(Collectors.toSet());
|
||||
//
|
||||
// Geo geo = geos.parallelStream().filter(g -> g.getIso3166Code().equals(origin)).findFirst().orElse(null);
|
||||
// GeoGroup geoGroup = geoGroups.parallelStream().filter(g -> g.getGeoGroupCode().equals(origin)).findFirst().orElse(null);
|
||||
//
|
||||
// ImportWrapper imw = new ImportWrapper(new Import(AggregateReference.to(nomenclature.getId()), additionalCode == null ? null : AggregateReference.to(additionalCode.getId()), foundAppliedMeasures, geo == null ? null : AggregateReference.to(geo.getId()), geoGroup == null ? null : AggregateReference.to(geoGroup.getId())), hsCode, origin, addCode);
|
||||
// imports.add(imw);
|
||||
// }
|
||||
// });
|
||||
|
||||
// return imports.stream().map(ImportWrapper::getImport).collect(Collectors.toSet());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.LegalBase;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class LegalBaseConverter implements ExcelTableConverter<LegalBase> {
|
||||
|
||||
public LegalBaseConverter(ReferenceStorageService referenceStorage) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LegalBase> convert(ExcelTable table) {
|
||||
Collection<LegalBase> legalBases = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
LegalBase legalBase = new LegalBase(row.getAs("Legal base", String.class),
|
||||
row.getAs("Off. Journal", String.class), row.getAs("Page", Integer.class),
|
||||
row.getAs("Publ. date", LocalDate.class));
|
||||
legalBases.add(legalBase);
|
||||
|
||||
});
|
||||
|
||||
return legalBases;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.MeasureAction;
|
||||
import de.avatic.taricdb.model.MeasureActionDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MeasureActionConverter implements ExcelTableConverter<MeasureAction> {
|
||||
|
||||
|
||||
public MeasureActionConverter(ReferenceStorageService referenceStorage) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<MeasureAction> convert(ExcelTable table) {
|
||||
Collection<MeasureAction> actions = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("MEAS_ACT_COD", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
MeasureAction measureAction = actions.stream().filter(s -> s.getMeasureActionCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (measureAction == null) {
|
||||
measureAction = new MeasureAction(code);
|
||||
actions.add(measureAction);
|
||||
}
|
||||
|
||||
measureAction.addMeasureActionDesc(new MeasureActionDesc(row.getAs("LANG_COD", String.class), row.getAs("DESCR", String.class), null));
|
||||
|
||||
});
|
||||
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.Measure;
|
||||
import de.avatic.taricdb.model.MeasureDesc;
|
||||
import de.avatic.taricdb.model.MeasureSeries;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MeasureConverter implements ExcelTableConverter<Measure> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public MeasureConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Measure> convert(ExcelTable table) {
|
||||
Collection<Measure> measures = new ArrayList<>();
|
||||
Collection<MeasureSeries> series = referenceStorage.getEntites(MeasureSeries.class);
|
||||
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("Meas. type", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Measure measure = measures.stream().filter(s -> s.getMeasureCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
|
||||
if (measure == null) {
|
||||
String seriesCode = row.getAs("Meas. Series", String.class);
|
||||
MeasureSeries foundSeries = series.stream().filter(s -> s.getMeasureSeriesCode().equals(seriesCode)).findAny().orElse(null);
|
||||
|
||||
measure = new Measure(code, row.getAs("Short descr.", String.class),
|
||||
row.getAs("TM code", Integer.class), row.getAs("Start date", LocalDate.class), AggregateReference.to(foundSeries.getId()));
|
||||
measures.add(measure);
|
||||
}
|
||||
|
||||
measure.addMeasureDesc(new MeasureDesc(row.getAs("Language", String.class),
|
||||
row.getAs("Description", String.class)));
|
||||
|
||||
});
|
||||
|
||||
return measures;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.MeasureExclusionWrapper;
|
||||
import de.avatic.taricdb.model.Geo;
|
||||
import de.avatic.taricdb.model.MeasureExclusion;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MeasureExclusionConverter implements ExcelTableConverter<MeasureExclusionWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public MeasureExclusionConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MeasureExclusionWrapper> convert(ExcelTable table) {
|
||||
|
||||
Collection<MeasureExclusionWrapper> exclusions = new ArrayList<>();
|
||||
Collection<Geo> geos = referenceStorage.getEntites(Geo.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String hsCode = row.getAs("Goods code", String.class);
|
||||
String iso3166Code = row.getAs("Excluded country", String.class);
|
||||
Integer measureCode = row.getAs("Meas. type code", Integer.class);
|
||||
Integer originCode = row.getAs("Origin code", Integer.class);
|
||||
String addCode = row.getAs("Add code", String.class);
|
||||
String orderNumber = row.getAs("Order No.", String.class);
|
||||
|
||||
Geo geo = geos.stream().filter(c -> c.getIso3166Code().equals(iso3166Code)).findAny().orElse(null);
|
||||
|
||||
MeasureExclusionWrapper exclusion = exclusions.stream()
|
||||
.filter(c -> c.getHsCode().equals(hsCode) && c.getMeasureCode().equals(measureCode)
|
||||
&& c.getOriginCode().equals(originCode) && c.getIso3166Code().equals(iso3166Code) && c.getAddCode().equals(addCode) && c.getOrderNumber().equals(orderNumber))
|
||||
.findAny().orElse(null);
|
||||
|
||||
if (exclusion == null) {
|
||||
exclusion = new MeasureExclusionWrapper(new MeasureExclusion(AggregateReference.to(geo.getId())),
|
||||
hsCode, originCode, measureCode, iso3166Code, addCode, orderNumber);
|
||||
exclusions.add(exclusion);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Duplicate measure exclusion found: measure: " + measureCode + " - origin: " + originCode + " - iso: " + iso3166Code + " - add code: " + addCode + " goods code: " + hsCode + " order number: " + orderNumber);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return exclusions;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.MeasureFootnoteWrapper;
|
||||
import de.avatic.taricdb.model.Footnote;
|
||||
import de.avatic.taricdb.model.MeasureFootnote;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MeasureFootnoteConverter implements ExcelTableConverter<MeasureFootnoteWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public MeasureFootnoteConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MeasureFootnoteWrapper> convert(ExcelTable table) {
|
||||
Collection<MeasureFootnoteWrapper> measureFootnoteWrappers = new ArrayList<>();
|
||||
Collection<Footnote> footnotes = referenceStorage.getEntites(Footnote.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String footnote = row.getAs("Footnote", String.class);
|
||||
Integer measureCode = row.getAs("Meas. type code", Integer.class);
|
||||
String hsCode = row.getAs("Goods code", String.class);
|
||||
String origin = row.getAs("Origin code", String.class);
|
||||
String addCode = row.getAs("Add code", String.class);
|
||||
Integer orderNumber = row.getAs("Order No.", Integer.class);
|
||||
|
||||
Footnote foundFootnote = footnotes.stream().filter(s -> s.getFootnote().equals(footnote)).findAny()
|
||||
.orElse(null);
|
||||
|
||||
MeasureFootnoteWrapper wrapper = measureFootnoteWrappers.stream()
|
||||
.filter(s -> s.getMeasureFootnote().getFootnote().getId().equals(foundFootnote.getId())
|
||||
&& s.getMeasureCode().equals(measureCode) && s.getHsCode().equals(hsCode)
|
||||
&& s.getOrigin().equals(origin) && s.getAddCode().equals(addCode)
|
||||
&& s.getOrderNumber().equals(orderNumber))
|
||||
.findAny().orElse(null);
|
||||
|
||||
if (wrapper == null) {
|
||||
wrapper = new MeasureFootnoteWrapper(new MeasureFootnote(AggregateReference.to(foundFootnote.getId())),
|
||||
measureCode, hsCode, addCode, origin, orderNumber);
|
||||
} else {
|
||||
throw new RuntimeException("MeasureFootnoteWrapper already exists: " + measureCode + " " + hsCode + " "
|
||||
+ origin + " " + addCode + " " + orderNumber);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return measureFootnoteWrappers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.MeasureSeries;
|
||||
import de.avatic.taricdb.model.MeasureSeriesDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MeasureSeriesConverter implements ExcelTableConverter<MeasureSeries> {
|
||||
|
||||
|
||||
public MeasureSeriesConverter(ReferenceStorageService referenceStorage) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MeasureSeries> convert(ExcelTable table) {
|
||||
|
||||
Collection<MeasureSeries> series = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("MEAS_TYP_SER_ID", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
MeasureSeries measureSeries = series.stream().filter(s -> s.getMeasureSeriesCode().equals(code)).findAny().orElse(null);
|
||||
|
||||
if (measureSeries == null) {
|
||||
measureSeries = new MeasureSeries(code);
|
||||
series.add(measureSeries);
|
||||
}
|
||||
|
||||
measureSeries.addMeasureSeriesDesc(new MeasureSeriesDesc(row.getAs("LANG_COD", String.class),
|
||||
row.getAs("DESCR", String.class)));
|
||||
});
|
||||
|
||||
return series;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.MonetaryUnit;
|
||||
import de.avatic.taricdb.model.MonetaryUnitDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class MonetaryUnitConverter implements ExcelTableConverter<MonetaryUnit> {
|
||||
|
||||
|
||||
public MonetaryUnitConverter(ReferenceStorageService referenceStorage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MonetaryUnit> convert(ExcelTable table) {
|
||||
Collection<MonetaryUnit> units = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("MON_UNIT_COD", String.class);
|
||||
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
MonetaryUnit monetaryUnit = units.stream().filter(
|
||||
s -> s.getMonetaryUnitCode().equals(code))
|
||||
.findAny().orElse(null);
|
||||
|
||||
if (monetaryUnit == null) {
|
||||
|
||||
monetaryUnit = new MonetaryUnit(code);
|
||||
units.add(monetaryUnit);
|
||||
}
|
||||
|
||||
monetaryUnit.addMonetaryUnitDesc(
|
||||
new MonetaryUnitDesc(row.getAs("LANG_COD", String.class), row.getAs("DESCR", String.class), null));
|
||||
});
|
||||
|
||||
return units;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.DeclarableCodesWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureDescEnWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureDescFrWrapper;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureFootnoteWrapper;
|
||||
import de.avatic.taricdb.model.Nomenclature;
|
||||
import de.avatic.taricdb.model.NomenclatureDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class NomenclatureDeConverter implements ExcelTableConverter<Nomenclature> {
|
||||
|
||||
private ReferenceStorageService referenceStorageService;
|
||||
|
||||
public NomenclatureDeConverter(ReferenceStorageService referenceStorageService) {
|
||||
this.referenceStorageService = referenceStorageService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Nomenclature> convert(ExcelTable table) {
|
||||
Collection<Nomenclature> nomenclatures = new ArrayList<>();
|
||||
Collection<DeclarableCodesWrapper> declarableCodes = referenceStorageService.getEntites(DeclarableCodesWrapper.class);
|
||||
Collection<NomenclatureFootnoteWrapper> nomenclatureFootnoteWrappers = referenceStorageService.getEntites(NomenclatureFootnoteWrapper.class);
|
||||
Collection<NomenclatureDescEnWrapper> nomenclatureDescEn = referenceStorageService.getEntites(NomenclatureDescEnWrapper.class);
|
||||
Collection<NomenclatureDescFrWrapper> nomenclatureDescFr = referenceStorageService.getEntites(NomenclatureDescFrWrapper.class);
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String goodsCode = row.getAs("Goods code", String.class);
|
||||
String hsCode = goodsCode.substring(0, 10);
|
||||
String suffix = goodsCode.substring(11, 13);
|
||||
|
||||
Nomenclature nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode)).findAny().orElse(null);
|
||||
NomenclatureFootnoteWrapper footnoteWrapper = nomenclatureFootnoteWrappers.stream().filter(n -> n.getHsCode().equals(hsCode) && n.getSuffix().equals(suffix)).findFirst().orElse(null);
|
||||
NomenclatureDesc descEn = nomenclatureDescEn.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).map(n -> n.getDesc()).findFirst().orElse(null);
|
||||
NomenclatureDesc descFr = nomenclatureDescFr.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).map(n -> n.getDesc()).findFirst().orElse(null);
|
||||
|
||||
|
||||
|
||||
if (nomenclature == null) {
|
||||
String line = row.getAs("Indent", String.class).trim();
|
||||
int indent = line.length() - line.replace("-", "").length();
|
||||
|
||||
DeclarableCodesWrapper declarableCode = declarableCodes.stream()
|
||||
.filter(d -> d.getHsCode().equals(hsCode)).findAny().orElse(null);
|
||||
|
||||
nomenclature = new Nomenclature(hsCode, suffix, row.getAs("Hier. Pos.", Integer.class), indent,
|
||||
row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class),
|
||||
declarableCode == null ? false : declarableCode.getIsLeaf(),
|
||||
declarableCode == null ? null : declarableCode.getDeclStartDate(),
|
||||
null, null == footnoteWrapper ? null : footnoteWrapper.getNomenclatureFootnote());
|
||||
|
||||
nomenclatures.add(nomenclature);
|
||||
}
|
||||
|
||||
nomenclature.addNomenclatureDesc(new NomenclatureDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)));
|
||||
nomenclature.addNomenclatureDesc(descEn);
|
||||
nomenclature.addNomenclatureDesc(descFr);
|
||||
|
||||
});
|
||||
|
||||
return nomenclatures;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureDescEnWrapper;
|
||||
import de.avatic.taricdb.model.NomenclatureDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class NomenclatureEnConverter implements ExcelTableConverter<NomenclatureDescEnWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorageService;
|
||||
|
||||
|
||||
public NomenclatureEnConverter(ReferenceStorageService referenceStorageService) {
|
||||
this.referenceStorageService = referenceStorageService;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NomenclatureDescEnWrapper> convert(ExcelTable table) {
|
||||
Collection<NomenclatureDescEnWrapper> nomenclatures = new ArrayList<>();
|
||||
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String goodsCode = row.getAs("Goods code", String.class);
|
||||
String hsCode = goodsCode.substring(0, 10);
|
||||
String suffix = goodsCode.substring(11, 13);
|
||||
|
||||
NomenclatureDescEnWrapper nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).findAny().orElse(null);
|
||||
|
||||
|
||||
if (nomenclature == null) {
|
||||
nomenclature = new NomenclatureDescEnWrapper(new NomenclatureDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)), hsCode, suffix);
|
||||
nomenclatures.add(nomenclature);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Duplicate hscode found: " + hsCode + " " + suffix);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return nomenclatures;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureFootnoteWrapper;
|
||||
import de.avatic.taricdb.model.Footnote;
|
||||
import de.avatic.taricdb.model.NomenclatureFootnote;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class NomenclatureFootnoteConverter implements ExcelTableConverter<NomenclatureFootnoteWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorage;
|
||||
|
||||
public NomenclatureFootnoteConverter(ReferenceStorageService referenceStorage) {
|
||||
this.referenceStorage = referenceStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NomenclatureFootnoteWrapper> convert(ExcelTable table) {
|
||||
Collection<NomenclatureFootnoteWrapper> nomenclatureFootnoteWrappers = new ArrayList<>();
|
||||
Collection<Footnote> footnotes = referenceStorage.getEntites(Footnote.class);
|
||||
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String goodsCode = row.getAs("Goods code", String.class);
|
||||
String hsCode = goodsCode.substring(0, 10);
|
||||
String suffix = goodsCode.substring(11, 13);
|
||||
|
||||
Footnote footnote = footnotes.stream().filter(f -> f.getFootnote().equals(row.getAs("Footnote code", String.class))).findFirst().orElse(null);
|
||||
|
||||
NomenclatureFootnoteWrapper foundWrapper = nomenclatureFootnoteWrappers.stream().filter(w -> w.getHsCode().equals(hsCode)).findAny().orElse(null);
|
||||
|
||||
if (foundWrapper == null) {
|
||||
foundWrapper = new NomenclatureFootnoteWrapper(hsCode, suffix);
|
||||
nomenclatureFootnoteWrappers.add(foundWrapper);
|
||||
}
|
||||
|
||||
foundWrapper.addNomenclatureFootnote(new NomenclatureFootnote(AggregateReference.to(footnote.getId())));
|
||||
|
||||
});
|
||||
|
||||
return nomenclatureFootnoteWrappers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.helper.workbook.wrapper.NomenclatureDescFrWrapper;
|
||||
import de.avatic.taricdb.model.NomenclatureDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class NomenclatureFrConverter implements ExcelTableConverter<NomenclatureDescFrWrapper> {
|
||||
|
||||
private ReferenceStorageService referenceStorageService;
|
||||
|
||||
|
||||
public NomenclatureFrConverter(ReferenceStorageService referenceStorageService) {
|
||||
this.referenceStorageService = referenceStorageService;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NomenclatureDescFrWrapper> convert(ExcelTable table) {
|
||||
|
||||
Collection<NomenclatureDescFrWrapper> nomenclatures = new ArrayList<>();
|
||||
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String goodsCode = row.getAs("Goods code", String.class);
|
||||
String hsCode = goodsCode.substring(0, 10);
|
||||
String suffix = goodsCode.substring(11, 13);
|
||||
|
||||
NomenclatureDescFrWrapper nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).findAny().orElse(null);
|
||||
|
||||
|
||||
if (nomenclature == null) {
|
||||
nomenclature = new NomenclatureDescFrWrapper(new NomenclatureDesc(row.getAs("Language", String.class), row.getAs("Description", String.class), row.getAs("Descr. start date", LocalDate.class)), hsCode, suffix);
|
||||
nomenclatures.add(nomenclature);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Duplicate hscode found: " + hsCode + " " + suffix);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return nomenclatures;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.helper.workbook.converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import de.avatic.taricdb.helper.workbook.ExcelTable;
|
||||
import de.avatic.taricdb.model.Unit;
|
||||
import de.avatic.taricdb.model.UnitDesc;
|
||||
import de.avatic.taricdb.service.ReferenceStorageService;
|
||||
|
||||
public class UnitConverter implements ExcelTableConverter<Unit> {
|
||||
|
||||
public UnitConverter(ReferenceStorageService referenceStorage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Unit> convert(ExcelTable table) {
|
||||
Collection<Unit> units = new ArrayList<>();
|
||||
|
||||
table.getRows().forEach((row) -> {
|
||||
String code = row.getAs("Measuremt Unit", String.class);
|
||||
String qualifier = row.getAs("Measuremt. unit qualifier", String.class);
|
||||
|
||||
if (row.index() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Unit unit = units.stream().filter(
|
||||
s -> s.getUnitCode().equals(code) && (((qualifier == null) && (s.getUnitQualifier() == null))
|
||||
|| ((s.getUnitQualifier() != null && qualifier != null)
|
||||
&& (s.getUnitQualifier().equals(qualifier)))))
|
||||
.findAny().orElse(null);
|
||||
|
||||
if (unit == null) {
|
||||
|
||||
|
||||
unit = new Unit(code, qualifier, row.getAs("Label", String.class));
|
||||
units.add(unit);
|
||||
}
|
||||
|
||||
unit.addUnitDesc(
|
||||
new UnitDesc(row.getAs("Lg", String.class), row.getAs("Concatenated descriptions", String.class), null));
|
||||
});
|
||||
|
||||
return units;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.AppliedMeasureCondition;
|
||||
|
||||
public class AppliedMeasureConditionWrapper {
|
||||
|
||||
private AppliedMeasureCondition appliedMeasureCondition;
|
||||
private String hsCode;
|
||||
private String originCode;
|
||||
private String additionalCode;
|
||||
private String orderNumber;
|
||||
private Integer measureCode;
|
||||
|
||||
|
||||
|
||||
public AppliedMeasureConditionWrapper(AppliedMeasureCondition appliedMeasureCondition, String hsCode, String originCode, String additionalCode, String orderNumber, Integer measureCode) {
|
||||
this.appliedMeasureCondition = appliedMeasureCondition;
|
||||
this.hsCode = hsCode;
|
||||
this.originCode = originCode;
|
||||
this.additionalCode = additionalCode;
|
||||
this.orderNumber = orderNumber;
|
||||
this.measureCode = measureCode;
|
||||
}
|
||||
|
||||
public AppliedMeasureCondition getAppliedMeasureCondition() {
|
||||
return appliedMeasureCondition;
|
||||
}
|
||||
|
||||
public String getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public String getOriginCode() {
|
||||
return originCode;
|
||||
}
|
||||
|
||||
public String getAdditionalCode() {
|
||||
return additionalCode;
|
||||
}
|
||||
|
||||
public Integer getMeasureCode() {
|
||||
return measureCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.AppliedMeasure;
|
||||
|
||||
public class AppliedMeasureWrapper {
|
||||
|
||||
private AppliedMeasure appliedMeasure;
|
||||
|
||||
private String hsCode;
|
||||
private String additionalCode;
|
||||
|
||||
|
||||
|
||||
private String origin;
|
||||
|
||||
public AppliedMeasureWrapper(AppliedMeasure appliedMeasure, String hsCode, String additionalCode, String origin) {
|
||||
this.appliedMeasure = appliedMeasure;
|
||||
this.hsCode = hsCode;
|
||||
this.additionalCode = additionalCode;
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public AppliedMeasure getAppliedMeasure() {
|
||||
return appliedMeasure;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public String getAdditionalCode() {
|
||||
return additionalCode;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class DeclarableCodesWrapper {
|
||||
|
||||
private String hsCode;
|
||||
private String suffix;
|
||||
private Boolean isLeaf;
|
||||
private LocalDate declStartDate;
|
||||
|
||||
public DeclarableCodesWrapper(String hsCode, String suffix, LocalDate declStartDate, Boolean isLeaf) {
|
||||
this.hsCode = hsCode;
|
||||
this.suffix = suffix;
|
||||
this.declStartDate = declStartDate;
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public void setHsCode(String hsCode) {
|
||||
this.hsCode = hsCode;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public Boolean getIsLeaf() {
|
||||
return isLeaf;
|
||||
}
|
||||
|
||||
public void setIsLeaf(Boolean isLeaf) {
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
|
||||
public LocalDate getDeclStartDate() {
|
||||
return declStartDate;
|
||||
}
|
||||
|
||||
public void setDeclStartDate(LocalDate declStartDate) {
|
||||
this.declStartDate = declStartDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.GeoGroupMembership;
|
||||
|
||||
public class GeoGroupMembershipWrapper {
|
||||
|
||||
private Integer geoGroupId;
|
||||
private GeoGroupMembership geoGroupMembership;
|
||||
|
||||
public GeoGroupMembershipWrapper(Integer geoGroupId, GeoGroupMembership geoGroupMembership) {
|
||||
this.setGeoGroupId(geoGroupId);
|
||||
this.setGeoGroupMembership(geoGroupMembership);
|
||||
}
|
||||
|
||||
public GeoGroupMembership getGeoGroupMembership() {
|
||||
return geoGroupMembership;
|
||||
}
|
||||
|
||||
public void setGeoGroupMembership(GeoGroupMembership geoGroupMembership) {
|
||||
this.geoGroupMembership = geoGroupMembership;
|
||||
}
|
||||
|
||||
public Integer getGeoGroupId() {
|
||||
return geoGroupId;
|
||||
}
|
||||
|
||||
public void setGeoGroupId(Integer geoGroupId) {
|
||||
this.geoGroupId = geoGroupId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import de.avatic.taricdb.model.Import;
|
||||
|
||||
public class ImportWrapper {
|
||||
|
||||
private CompletableFuture<Import> im;
|
||||
|
||||
private String hsCode;
|
||||
private String origin;
|
||||
private String addCode;
|
||||
|
||||
|
||||
|
||||
public ImportWrapper(String hsCode, String origin, String addCode) {
|
||||
this.hsCode = hsCode;
|
||||
this.origin = origin;
|
||||
this.addCode = addCode;
|
||||
this.im = new CompletableFuture<Import>();
|
||||
}
|
||||
|
||||
public Import getImport() {
|
||||
|
||||
try {
|
||||
return im.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public String getAddCode() {
|
||||
return addCode;
|
||||
}
|
||||
|
||||
public void completeImport(Import im) {
|
||||
this.im.complete(im);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureExclusion;
|
||||
|
||||
public class MeasureExclusionWrapper {
|
||||
|
||||
private MeasureExclusion exclusion;
|
||||
|
||||
private String hsCode;
|
||||
|
||||
private Integer originCode;
|
||||
|
||||
private Integer measureCode;
|
||||
|
||||
private String iso3166Code;
|
||||
|
||||
private String addCode;
|
||||
|
||||
private String orderNumber;
|
||||
|
||||
public MeasureExclusionWrapper(MeasureExclusion exclusion, String hsCode, Integer originCode, Integer measureCode, String iso3166Code, String addCode, String orderNumber) {
|
||||
this.exclusion = exclusion;
|
||||
this.hsCode = hsCode;
|
||||
this.originCode = originCode;
|
||||
this.measureCode = measureCode;
|
||||
this.iso3166Code = iso3166Code;
|
||||
this.addCode = addCode;
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public MeasureExclusion getExclusion() {
|
||||
return exclusion;
|
||||
}
|
||||
|
||||
public String getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public Integer getMeasureCode() {
|
||||
return measureCode;
|
||||
}
|
||||
|
||||
public Integer getOriginCode() {
|
||||
return originCode;
|
||||
}
|
||||
|
||||
public MeasureExclusion getMeasureExclusion() {
|
||||
return exclusion;
|
||||
}
|
||||
|
||||
public String getIso3166Code() {
|
||||
return iso3166Code;
|
||||
}
|
||||
|
||||
public Object getAddCode() {
|
||||
return addCode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureFootnote;
|
||||
|
||||
public class MeasureFootnoteWrapper {
|
||||
|
||||
private MeasureFootnote measureFootnote;
|
||||
|
||||
private String hsCode;
|
||||
|
||||
private String origin;
|
||||
|
||||
private Integer measureCode;
|
||||
|
||||
private String addCode;
|
||||
|
||||
private Integer orderNumber;
|
||||
|
||||
public MeasureFootnoteWrapper(MeasureFootnote measureFootnote, Integer measureCode, String hsCode, String addCode, String origin, Integer orderNumber) {
|
||||
this.measureFootnote = measureFootnote;
|
||||
this.measureCode = measureCode;
|
||||
this.hsCode = hsCode;
|
||||
this.origin = origin;
|
||||
this.addCode = addCode;
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public Integer getMeasureCode() {
|
||||
return measureCode;
|
||||
}
|
||||
|
||||
public void setMeasureCode(Integer measureCode) {
|
||||
this.measureCode = measureCode;
|
||||
}
|
||||
|
||||
public MeasureFootnote getMeasureFootnote() {
|
||||
return measureFootnote;
|
||||
}
|
||||
|
||||
public void setMeasureFootnote(MeasureFootnote measureFootnote) {
|
||||
this.measureFootnote = measureFootnote;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public String getAddCode() {
|
||||
return addCode;
|
||||
}
|
||||
|
||||
public Object getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.NomenclatureDesc;
|
||||
|
||||
public class NomenclatureDescEnWrapper {
|
||||
|
||||
private NomenclatureDesc desc;
|
||||
private String hsCode;
|
||||
private String suffix;
|
||||
|
||||
public NomenclatureDescEnWrapper(NomenclatureDesc desc, String hsCode, String suffix) {
|
||||
this.desc = desc;
|
||||
this.hsCode = hsCode;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public NomenclatureDesc getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public String getHscode() {
|
||||
return this.hsCode;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import de.avatic.taricdb.model.NomenclatureDesc;
|
||||
|
||||
public class NomenclatureDescFrWrapper {
|
||||
|
||||
private NomenclatureDesc desc;
|
||||
private String hsCode;
|
||||
private String suffix;
|
||||
|
||||
public NomenclatureDescFrWrapper(NomenclatureDesc desc, String hsCode, String suffix) {
|
||||
this.desc = desc;
|
||||
this.hsCode = hsCode;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public NomenclatureDesc getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public String getHscode() {
|
||||
return this.hsCode;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package de.avatic.taricdb.helper.workbook.wrapper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import de.avatic.taricdb.model.NomenclatureFootnote;
|
||||
|
||||
public class NomenclatureFootnoteWrapper {
|
||||
|
||||
private Set<NomenclatureFootnote> nomenclatureFootnotes;
|
||||
|
||||
private String hsCode;
|
||||
|
||||
private String suffix;
|
||||
|
||||
public NomenclatureFootnoteWrapper(String hsCode, String suffix) {
|
||||
this.nomenclatureFootnotes = new HashSet<>();
|
||||
this.hsCode = hsCode;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public Set<NomenclatureFootnote> getNomenclatureFootnote() {
|
||||
return nomenclatureFootnotes;
|
||||
}
|
||||
|
||||
public String getHsCode() {
|
||||
return hsCode;
|
||||
}
|
||||
|
||||
public void addNomenclatureFootnote(NomenclatureFootnote nomenclatureFootnote) {
|
||||
this.nomenclatureFootnotes.add(nomenclatureFootnote);
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package de.avatic.taricdb.helper.zip;
|
||||
|
||||
public class ByteArrayWrapper {
|
||||
|
||||
private byte[] bytes;
|
||||
|
||||
public ByteArrayWrapper(byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public ByteArrayWrapper combine(ByteArrayWrapper other) {
|
||||
byte[] combined = new byte[bytes.length + other.getBytes().length];
|
||||
System.arraycopy(bytes, 0, combined, 0, bytes.length);
|
||||
System.arraycopy(other.getBytes(), 0, combined, bytes.length, other.getBytes().length);
|
||||
return new ByteArrayWrapper(combined);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package de.avatic.taricdb.helper.zip;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public interface UnzipStatusListener {
|
||||
|
||||
void notifyUnzipProgress(String message);
|
||||
|
||||
}
|
||||
67
src/main/java/de/avatic/taricdb/helper/zip/Unzipper.java
Normal file
67
src/main/java/de/avatic/taricdb/helper/zip/Unzipper.java
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package de.avatic.taricdb.helper.zip;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import de.avatic.taricdb.helper.file.InMemFile;
|
||||
import de.avatic.taricdb.service.SetupStatusService;
|
||||
|
||||
|
||||
@Component
|
||||
public class Unzipper {
|
||||
|
||||
@Autowired
|
||||
private SetupStatusService statusService;
|
||||
|
||||
Logger log = LoggerFactory.getLogger(Unzipper.class);
|
||||
|
||||
public List<InMemFile> unzip(byte[] zipFile) throws IOException {
|
||||
List<InMemFile> files = new ArrayList<>();
|
||||
ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(zipFile));
|
||||
ZipEntry entry;
|
||||
|
||||
while ((entry = zipStream.getNextEntry()) != null) {
|
||||
if (!entry.isDirectory()) {
|
||||
files.add(new InMemFile(entry.getName(), readFileContent(zipStream, entry)));
|
||||
}
|
||||
zipStream.closeEntry();
|
||||
log.info("Unzip done: " + entry.getName());
|
||||
statusService.setStatus(0, "unzipping ... " + entry.getName(), true, null);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
private byte[] readFileContent(InputStream zipStream, ZipEntry entry) throws IOException {
|
||||
int totalRead = 0;
|
||||
List<ByteArrayWrapper> content = new ArrayList<>();
|
||||
|
||||
while (zipStream.available() > 0) {
|
||||
byte[] bytes = new byte[10240];
|
||||
int read = zipStream.read(bytes, 0, bytes.length);
|
||||
|
||||
if (read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
content.add(new ByteArrayWrapper(Arrays.copyOf(bytes, read)));
|
||||
totalRead += read;
|
||||
}
|
||||
|
||||
return content.stream().reduce(new ByteArrayWrapper(new byte[0]), ByteArrayWrapper::combine).getBytes();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
77
src/main/java/de/avatic/taricdb/model/AdditionalCode.java
Normal file
77
src/main/java/de/avatic/taricdb/model/AdditionalCode.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
@Table("additional_code")
|
||||
public class AdditionalCode {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 4)
|
||||
private String additionalCode;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<AdditionalCodeDesc> desc;
|
||||
|
||||
public AdditionalCode(String additionalCode, LocalDate startDate, LocalDate endDate) {
|
||||
this.desc = new HashSet<>();
|
||||
this.additionalCode = additionalCode;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAdditionalCode() {
|
||||
return additionalCode;
|
||||
}
|
||||
|
||||
public void setAdditionalCode(final String additionalCode) {
|
||||
this.additionalCode = additionalCode;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Set<AdditionalCodeDesc> getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void addDesc(AdditionalCodeDesc desc) {
|
||||
this.desc.add(desc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Table("additional_code_desc")
|
||||
public class AdditionalCodeDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public AdditionalCodeDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
126
src/main/java/de/avatic/taricdb/model/AppliedMeasure.java
Normal file
126
src/main/java/de/avatic/taricdb/model/AppliedMeasure.java
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class AppliedMeasure {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
private String amount;
|
||||
|
||||
@Column("order_number")
|
||||
private Integer orderNumber;
|
||||
|
||||
@MappedCollection(idColumn = "applied_measure_id")
|
||||
private Set<MeasureFootnote> measureFootnotes;
|
||||
|
||||
@NotNull
|
||||
@Column("measure_id")
|
||||
private AggregateReference<Measure, Integer> measure;
|
||||
|
||||
|
||||
@Column("legal_base_id")
|
||||
private AggregateReference<LegalBase, Integer> legalBase;
|
||||
|
||||
@Column("legal_base")
|
||||
private String additionalLegalBase;
|
||||
|
||||
@MappedCollection(idColumn = "applied_measure_id")
|
||||
private Set<MeasureExclusion> exclusions;
|
||||
|
||||
@MappedCollection(idColumn = "applied_measure_id")
|
||||
private Set<AppliedMeasureCondition> conditions;
|
||||
|
||||
public AppliedMeasure(AggregateReference<Measure, Integer> measure, Set<MeasureFootnote> measureFootnotes,
|
||||
AggregateReference<LegalBase, Integer> legalBase, String additionalLegalBase, Set<MeasureExclusion> exclusions,
|
||||
Set<AppliedMeasureCondition> conditions, LocalDate startDate, LocalDate endDate, String amount, Integer orderNumber) {
|
||||
this.measure = measure;
|
||||
this.measureFootnotes = measureFootnotes;
|
||||
this.legalBase = legalBase;
|
||||
this.exclusions = exclusions;
|
||||
this.conditions = conditions;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.amount = amount;
|
||||
this.orderNumber = orderNumber;
|
||||
this.additionalLegalBase = additionalLegalBase;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(final String amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public AggregateReference<Measure, Integer> getMeasure() {
|
||||
return measure;
|
||||
}
|
||||
|
||||
public void setMeasure(final AggregateReference<Measure, Integer> measure) {
|
||||
this.measure = measure;
|
||||
}
|
||||
|
||||
public AggregateReference<LegalBase, Integer> getLegalBase() {
|
||||
return legalBase;
|
||||
}
|
||||
|
||||
public void setLegalBase(final AggregateReference<LegalBase, Integer> legalBase) {
|
||||
this.legalBase = legalBase;
|
||||
}
|
||||
|
||||
public Integer getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public Set<MeasureFootnote> getMeasureFootnotes() {
|
||||
return measureFootnotes;
|
||||
}
|
||||
|
||||
public Set<MeasureExclusion> getExclusions() {
|
||||
return exclusions;
|
||||
}
|
||||
|
||||
public Set<AppliedMeasureCondition> getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class AppliedMeasureCondition {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
private Integer sequenceNo;
|
||||
|
||||
private String amount;
|
||||
|
||||
@NotNull
|
||||
@Column("measure_action_id")
|
||||
private AggregateReference<MeasureAction, Integer> measureAction;
|
||||
|
||||
@Column("monetary_unit_id")
|
||||
@Nullable
|
||||
private AggregateReference<MonetaryUnit, Integer> monetaryUnit;
|
||||
|
||||
|
||||
@Column("unit_id")
|
||||
@Nullable
|
||||
private AggregateReference<Unit, Integer> unit;
|
||||
|
||||
@Column("certificate_id")
|
||||
@Nullable
|
||||
private AggregateReference<Certificate, Integer> certificate;
|
||||
|
||||
@NotNull
|
||||
@Column("condition_type_id")
|
||||
private AggregateReference<ConditionType, Integer> conditionType;
|
||||
|
||||
public AppliedMeasureCondition(AggregateReference<MeasureAction, Integer> measureAction,
|
||||
AggregateReference<MonetaryUnit, Integer> monetaryUnit,
|
||||
AggregateReference<Unit, Integer> unit,
|
||||
AggregateReference<Certificate, Integer> certificate,
|
||||
AggregateReference<ConditionType, Integer> conditionType, String amount, Integer squenceNo) {
|
||||
this.measureAction = measureAction;
|
||||
this.monetaryUnit = monetaryUnit;
|
||||
this.unit = unit;
|
||||
this.certificate = certificate;
|
||||
this.conditionType = conditionType;
|
||||
this.amount = amount;
|
||||
this.sequenceNo = squenceNo;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSequenceNo() {
|
||||
return sequenceNo;
|
||||
}
|
||||
|
||||
public void setSequenceNo(final Integer sequenceNo) {
|
||||
this.sequenceNo = sequenceNo;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(final String amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public AggregateReference<MeasureAction, Integer> getMeasureAction() {
|
||||
return measureAction;
|
||||
}
|
||||
|
||||
public void setMeasureAction(final AggregateReference<MeasureAction, Integer> measureAction) {
|
||||
this.measureAction = measureAction;
|
||||
}
|
||||
|
||||
public AggregateReference<MonetaryUnit, Integer> getMonetaryUnit() {
|
||||
return monetaryUnit;
|
||||
}
|
||||
|
||||
public void setMonetaryUnit(final AggregateReference<MonetaryUnit, Integer> monetaryUnit) {
|
||||
this.monetaryUnit = monetaryUnit;
|
||||
}
|
||||
|
||||
public AggregateReference<Unit, Integer> getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(final AggregateReference<Unit, Integer> unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public AggregateReference<Certificate, Integer> getCertificate() {
|
||||
return certificate;
|
||||
}
|
||||
|
||||
public void setCertificate(final AggregateReference<Certificate, Integer> certificate) {
|
||||
this.certificate = certificate;
|
||||
}
|
||||
|
||||
public AggregateReference<ConditionType, Integer> getConditionType() {
|
||||
return conditionType;
|
||||
}
|
||||
|
||||
public void setConditionType(final AggregateReference<ConditionType, Integer> conditionType) {
|
||||
this.conditionType = conditionType;
|
||||
}
|
||||
|
||||
}
|
||||
88
src/main/java/de/avatic/taricdb/model/Certificate.java
Normal file
88
src/main/java/de/avatic/taricdb/model/Certificate.java
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class Certificate {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 4)
|
||||
private String certificateCode;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
@NotNull
|
||||
@Column("certificate_type_id")
|
||||
private AggregateReference<CertificateType, Integer> certificateType;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<CertificateDesc> certificateDesc;
|
||||
|
||||
public Certificate(String certificateCode, LocalDate startDate, LocalDate endDate, AggregateReference<CertificateType, Integer> certificateType) {
|
||||
this.certificateCode = certificateCode;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.certificateType = certificateType;
|
||||
this.certificateDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCertificateCode() {
|
||||
return certificateCode;
|
||||
}
|
||||
|
||||
public void setCertificateCode(final String certificateCode) {
|
||||
this.certificateCode = certificateCode;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public AggregateReference<CertificateType, Integer> getCertificateType() {
|
||||
return certificateType;
|
||||
}
|
||||
|
||||
public void setCertificateType(final AggregateReference<CertificateType, Integer> certificateType) {
|
||||
this.certificateType = certificateType;
|
||||
}
|
||||
|
||||
public void addCertificateDesc(CertificateDesc certificateDesc) {
|
||||
this.certificateDesc.add(certificateDesc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
63
src/main/java/de/avatic/taricdb/model/CertificateDesc.java
Normal file
63
src/main/java/de/avatic/taricdb/model/CertificateDesc.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class CertificateDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public CertificateDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDescc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String descc) {
|
||||
this.desc = descc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
49
src/main/java/de/avatic/taricdb/model/CertificateType.java
Normal file
49
src/main/java/de/avatic/taricdb/model/CertificateType.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class CertificateType {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 1)
|
||||
private String certificateTypeCode;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<CertificateTypeDesc> certificateTypeDesc;
|
||||
|
||||
public CertificateType(String certificateTypeCode) {
|
||||
this.certificateTypeCode = certificateTypeCode;
|
||||
this.certificateTypeDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCertificateTypeCode() {
|
||||
return certificateTypeCode;
|
||||
}
|
||||
|
||||
public void setCertificateTypeCode(final String certificateTypeCode) {
|
||||
this.certificateTypeCode = certificateTypeCode;
|
||||
}
|
||||
|
||||
public void addCertificateTypeDesc(CertificateTypeDesc certificateTypeDesc) {
|
||||
this.certificateTypeDesc.add(certificateTypeDesc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class CertificateTypeDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public CertificateTypeDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDescc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
47
src/main/java/de/avatic/taricdb/model/ConditionType.java
Normal file
47
src/main/java/de/avatic/taricdb/model/ConditionType.java
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class ConditionType {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String conditionTypeCode;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<ConditionTypeDesc> conditionTypeDesc;
|
||||
|
||||
public ConditionType(String conditionTypeCode) {
|
||||
this.conditionTypeCode = conditionTypeCode;
|
||||
this.conditionTypeDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConditionTypeCode() {
|
||||
return conditionTypeCode;
|
||||
}
|
||||
|
||||
public void setConditionTypeCode(final String conditionTypeCode) {
|
||||
this.conditionTypeCode = conditionTypeCode;
|
||||
}
|
||||
|
||||
public void addConditionTypeDesc(ConditionTypeDesc conditionTypeDesc) {
|
||||
this.conditionTypeDesc.add(conditionTypeDesc);
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/de/avatic/taricdb/model/ConditionTypeDesc.java
Normal file
61
src/main/java/de/avatic/taricdb/model/ConditionTypeDesc.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class ConditionTypeDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public ConditionTypeDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDescc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
82
src/main/java/de/avatic/taricdb/model/Footnote.java
Normal file
82
src/main/java/de/avatic/taricdb/model/Footnote.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
@Table("footnote")
|
||||
public class Footnote {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 8)
|
||||
@Column("footnote")
|
||||
private String footnote;
|
||||
|
||||
@Column("start_date")
|
||||
private LocalDate startDate;
|
||||
|
||||
|
||||
@Column("end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<FootnotesDesc> footnotesDesc;
|
||||
|
||||
public Footnote(String footnote, String descrption, LocalDate startDate, LocalDate endDate) {
|
||||
this.footnote = footnote;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.footnotesDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFootnote() {
|
||||
return footnote;
|
||||
}
|
||||
|
||||
public void setFootnote(final String footnote) {
|
||||
this.footnote = footnote;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Set<FootnotesDesc> getFootnotesDesc() {
|
||||
return footnotesDesc;
|
||||
}
|
||||
|
||||
public void addFootnotesDesc(FootnotesDesc footnotesDesc) {
|
||||
this.footnotesDesc.add(footnotesDesc);
|
||||
}
|
||||
|
||||
}
|
||||
60
src/main/java/de/avatic/taricdb/model/FootnotesDesc.java
Normal file
60
src/main/java/de/avatic/taricdb/model/FootnotesDesc.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
@Table("footnotes_desc")
|
||||
public class FootnotesDesc {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
public FootnotesDesc(String desc, String lang, LocalDate descStartDate) {
|
||||
this.desc = desc;
|
||||
this.lang = lang;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDescc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
51
src/main/java/de/avatic/taricdb/model/Geo.java
Normal file
51
src/main/java/de/avatic/taricdb/model/Geo.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class Geo {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
@Column("iso_3166_code")
|
||||
private String iso3166Code;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<GeoDesc> geoDesc;
|
||||
|
||||
public Geo(String iso3166Code) {
|
||||
this.iso3166Code = iso3166Code;
|
||||
this.geoDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIso3166Code() {
|
||||
return iso3166Code;
|
||||
}
|
||||
|
||||
public void setIso3166Code(final String iso3166Code) {
|
||||
this.iso3166Code = iso3166Code;
|
||||
}
|
||||
|
||||
public void addGeoDescription(GeoDesc geoDesc) {
|
||||
this.geoDesc.add(geoDesc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
60
src/main/java/de/avatic/taricdb/model/GeoDesc.java
Normal file
60
src/main/java/de/avatic/taricdb/model/GeoDesc.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class GeoDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public GeoDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
89
src/main/java/de/avatic/taricdb/model/GeoGroup.java
Normal file
89
src/main/java/de/avatic/taricdb/model/GeoGroup.java
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class GeoGroup {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 4)
|
||||
private String geoGroupCode;
|
||||
|
||||
private String abbr;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
@MappedCollection(idColumn = "geo_group_id")
|
||||
private Set<GeoGroupMembership> geoGroupMembers;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<GeoGroupDesc> geoGroupDescs;
|
||||
|
||||
|
||||
public GeoGroup(String geoGroupCode, String abbr, LocalDate startDate, LocalDate endDate,
|
||||
Set<GeoGroupMembership> geoGroupMembers) {
|
||||
this.geoGroupCode = geoGroupCode;
|
||||
this.abbr = abbr;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.geoGroupMembers = geoGroupMembers;
|
||||
this.geoGroupDescs = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getGeoGroupCode() {
|
||||
return geoGroupCode;
|
||||
}
|
||||
|
||||
public void setGeoGroupCode(final String geoGroupCode) {
|
||||
this.geoGroupCode = geoGroupCode;
|
||||
}
|
||||
|
||||
public String getAbbr() {
|
||||
return abbr;
|
||||
}
|
||||
|
||||
public void setAbbr(final String abbr) {
|
||||
this.abbr = abbr;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public void addGeoGroupDesc(GeoGroupDesc geoGroupDesc) {
|
||||
this.geoGroupDescs.add(geoGroupDesc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/de/avatic/taricdb/model/GeoGroupDesc.java
Normal file
61
src/main/java/de/avatic/taricdb/model/GeoGroupDesc.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class GeoGroupDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public GeoGroupDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
|
||||
|
||||
public class GeoGroupMembership {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column("geo_id")
|
||||
private AggregateReference<Geo, Integer> geo;
|
||||
|
||||
public GeoGroupMembership(LocalDate startDate, LocalDate endDate,
|
||||
AggregateReference<Geo, Integer> geo) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public AggregateReference<Geo, Integer> getGeo() {
|
||||
return geo;
|
||||
}
|
||||
|
||||
public void setGeo(final AggregateReference<Geo, Integer> geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
87
src/main/java/de/avatic/taricdb/model/Import.java
Normal file
87
src/main/java/de/avatic/taricdb/model/Import.java
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Table("import")
|
||||
public class Import {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@NotNull
|
||||
@Column("nomenclature_id")
|
||||
private AggregateReference<Nomenclature, Integer> nomenclature;
|
||||
|
||||
@Column("additional_code_id")
|
||||
private AggregateReference<AdditionalCode, Integer> additionalCode;
|
||||
|
||||
@Column("geo_id")
|
||||
private AggregateReference<Geo, Integer> geo;
|
||||
|
||||
@Column("geo_group_id")
|
||||
private AggregateReference<GeoGroup, Integer> geoGroup;
|
||||
|
||||
@MappedCollection(idColumn = "import_id")
|
||||
Set<AppliedMeasure> appliedMeasures;
|
||||
|
||||
public Import(AggregateReference<Nomenclature, Integer> nomenclature,
|
||||
AggregateReference<AdditionalCode, Integer> additionalCode, Set<AppliedMeasure> appliedMeasures, AggregateReference<Geo,Integer> geo,
|
||||
AggregateReference<GeoGroup, Integer> geoGroup) {
|
||||
this.nomenclature = nomenclature;
|
||||
this.additionalCode = additionalCode;
|
||||
this.appliedMeasures = appliedMeasures;
|
||||
this.geo = geo;
|
||||
this.geoGroup = geoGroup;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AggregateReference<Nomenclature, Integer> getNomenclature() {
|
||||
return nomenclature;
|
||||
}
|
||||
|
||||
public void setNomenclature(final AggregateReference<Nomenclature, Integer> nomenclature) {
|
||||
this.nomenclature = nomenclature;
|
||||
}
|
||||
|
||||
public AggregateReference<AdditionalCode, Integer> getAdditionalCode() {
|
||||
return additionalCode;
|
||||
}
|
||||
|
||||
public void setAdditionalCode(final AggregateReference<AdditionalCode, Integer> additionalCode) {
|
||||
this.additionalCode = additionalCode;
|
||||
}
|
||||
|
||||
public AggregateReference<Geo, Integer> getGeo() {
|
||||
return geo;
|
||||
}
|
||||
|
||||
public void setGeo(final AggregateReference<Geo, Integer> geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
public AggregateReference<GeoGroup, Integer> getGeoGroup() {
|
||||
return geoGroup;
|
||||
}
|
||||
|
||||
public void setGeoGroup(final AggregateReference<GeoGroup, Integer> geoGroup) {
|
||||
this.geoGroup = geoGroup;
|
||||
}
|
||||
|
||||
}
|
||||
72
src/main/java/de/avatic/taricdb/model/LegalBase.java
Normal file
72
src/main/java/de/avatic/taricdb/model/LegalBase.java
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class LegalBase {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 255)
|
||||
private String legalBase;
|
||||
|
||||
@Size(max = 255)
|
||||
private String journal;
|
||||
|
||||
private Integer page;
|
||||
|
||||
private LocalDate date;
|
||||
|
||||
public LegalBase(String legalBase, String journal, Integer page, LocalDate date) {
|
||||
this.legalBase = legalBase;
|
||||
this.journal = journal;
|
||||
this.page = page;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLegalBase() {
|
||||
return legalBase;
|
||||
}
|
||||
|
||||
public void setLegalBase(final String legalBase) {
|
||||
this.legalBase = legalBase;
|
||||
}
|
||||
|
||||
public String getJournal() {
|
||||
return journal;
|
||||
}
|
||||
|
||||
public void setJournal(final String journal) {
|
||||
this.journal = journal;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(final Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(final LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
}
|
||||
96
src/main/java/de/avatic/taricdb/model/Measure.java
Normal file
96
src/main/java/de/avatic/taricdb/model/Measure.java
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Table("measure")
|
||||
public class Measure {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 3)
|
||||
private String measureCode;
|
||||
|
||||
private String shortDesc;
|
||||
|
||||
private Integer tmCode;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<MeasureDesc> measureDesc;
|
||||
|
||||
|
||||
@Column("measure_series_id")
|
||||
AggregateReference<MeasureSeries, Integer> measureSeries;
|
||||
|
||||
public Measure(String code, String shortDesc, Integer tmCode, LocalDate startDate, AggregateReference<MeasureSeries, Integer> measureSeries) {
|
||||
this.measureCode = code;
|
||||
this.shortDesc = shortDesc;
|
||||
this.tmCode = tmCode;
|
||||
this.startDate = startDate;
|
||||
this.measureSeries = measureSeries;
|
||||
this.measureDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMeasureCode() {
|
||||
return measureCode;
|
||||
}
|
||||
|
||||
public void setMeasureCode(final String measureCode) {
|
||||
this.measureCode = measureCode;
|
||||
}
|
||||
|
||||
public String getShortDesc() {
|
||||
return shortDesc;
|
||||
}
|
||||
|
||||
public void setShortDesc(final String shortDesc) {
|
||||
this.shortDesc = shortDesc;
|
||||
}
|
||||
|
||||
public Integer getTmCode() {
|
||||
return tmCode;
|
||||
}
|
||||
|
||||
public void setTmCode(final Integer tmCode) {
|
||||
this.tmCode = tmCode;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public void addMeasureDesc(MeasureDesc measureDesc) {
|
||||
this.measureDesc.add(measureDesc);
|
||||
}
|
||||
|
||||
public AggregateReference<MeasureSeries, Integer> getMeasureSeries() {
|
||||
return measureSeries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
49
src/main/java/de/avatic/taricdb/model/MeasureAction.java
Normal file
49
src/main/java/de/avatic/taricdb/model/MeasureAction.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Table("measure_action")
|
||||
public class MeasureAction {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String measureActionCode;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<MeasureActionDesc> measureActionDesc;
|
||||
|
||||
public MeasureAction(String measureActionCode) {
|
||||
this.measureActionCode = measureActionCode;
|
||||
this.measureActionDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMeasureActionCode() {
|
||||
return measureActionCode;
|
||||
}
|
||||
|
||||
public void setMeasureActionCode(final String measureActionCode) {
|
||||
this.measureActionCode = measureActionCode;
|
||||
}
|
||||
|
||||
public void addMeasureActionDesc(MeasureActionDesc measureActionDesc) {
|
||||
this.measureActionDesc.add(measureActionDesc);
|
||||
}
|
||||
|
||||
}
|
||||
58
src/main/java/de/avatic/taricdb/model/MeasureActionDesc.java
Normal file
58
src/main/java/de/avatic/taricdb/model/MeasureActionDesc.java
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class MeasureActionDesc {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
public MeasureActionDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
60
src/main/java/de/avatic/taricdb/model/MeasureDesc.java
Normal file
60
src/main/java/de/avatic/taricdb/model/MeasureDesc.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class MeasureDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public MeasureDesc(String lang, String desc) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
39
src/main/java/de/avatic/taricdb/model/MeasureExclusion.java
Normal file
39
src/main/java/de/avatic/taricdb/model/MeasureExclusion.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
|
||||
public class MeasureExclusion {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@NotNull
|
||||
@Column("geo_id")
|
||||
private AggregateReference<Geo, Integer> geo;
|
||||
|
||||
public MeasureExclusion(AggregateReference<Geo, Integer> geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AggregateReference<Geo, Integer> getGeo() {
|
||||
return geo;
|
||||
}
|
||||
|
||||
public void setGeo(final AggregateReference<Geo, Integer> geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
}
|
||||
39
src/main/java/de/avatic/taricdb/model/MeasureFootnote.java
Normal file
39
src/main/java/de/avatic/taricdb/model/MeasureFootnote.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
|
||||
|
||||
public class MeasureFootnote {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Column("footnote_id")
|
||||
private AggregateReference<Footnote, Integer> footnote;
|
||||
|
||||
public MeasureFootnote(AggregateReference<Footnote, Integer> footnote) {
|
||||
this.footnote = footnote;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AggregateReference<Footnote, Integer> getFootnote() {
|
||||
return footnote;
|
||||
}
|
||||
|
||||
public void setFootnote(final AggregateReference<Footnote, Integer> footnote) {
|
||||
this.footnote = footnote;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
49
src/main/java/de/avatic/taricdb/model/MeasureSeries.java
Normal file
49
src/main/java/de/avatic/taricdb/model/MeasureSeries.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Table("measure_series")
|
||||
public class MeasureSeries {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 1)
|
||||
private String measureSeriesCode;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<MeasureSeriesDesc> measureSeriesDesc;
|
||||
|
||||
public MeasureSeries(String measureSeriesCode) {
|
||||
this.measureSeriesCode = measureSeriesCode;
|
||||
this.measureSeriesDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMeasureSeriesCode() {
|
||||
return measureSeriesCode;
|
||||
}
|
||||
|
||||
public void setMeasureSeriesCode(final String measureSeriesCode) {
|
||||
this.measureSeriesCode = measureSeriesCode;
|
||||
}
|
||||
|
||||
public void addMeasureSeriesDesc(MeasureSeriesDesc measureSeriesDesc) {
|
||||
this.measureSeriesDesc.add(measureSeriesDesc);
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/de/avatic/taricdb/model/MeasureSeriesDesc.java
Normal file
61
src/main/java/de/avatic/taricdb/model/MeasureSeriesDesc.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
@Table("measure_series_desc")
|
||||
public class MeasureSeriesDesc {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
|
||||
public MeasureSeriesDesc(String lang, String desc) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/de/avatic/taricdb/model/MonetaryUnit.java
Normal file
48
src/main/java/de/avatic/taricdb/model/MonetaryUnit.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class MonetaryUnit {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 3)
|
||||
private String monetaryUnitCode;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<MonetaryUnitDesc> monetaryUnitDesc;
|
||||
|
||||
public MonetaryUnit(String monetaryUnitCode) {
|
||||
this.monetaryUnitCode = monetaryUnitCode;
|
||||
this.monetaryUnitDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMonetaryUnitCode() {
|
||||
return monetaryUnitCode;
|
||||
}
|
||||
|
||||
public void setMonetaryUnitCode(final String monetaryUnitCode) {
|
||||
this.monetaryUnitCode = monetaryUnitCode;
|
||||
}
|
||||
|
||||
public void addMonetaryUnitDesc(MonetaryUnitDesc monetaryUnitDesc) {
|
||||
this.monetaryUnitDesc.add(monetaryUnitDesc);
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/de/avatic/taricdb/model/MonetaryUnitDesc.java
Normal file
61
src/main/java/de/avatic/taricdb/model/MonetaryUnitDesc.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class MonetaryUnitDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
public MonetaryUnitDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
146
src/main/java/de/avatic/taricdb/model/Nomenclature.java
Normal file
146
src/main/java/de/avatic/taricdb/model/Nomenclature.java
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class Nomenclature {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 10)
|
||||
private String hscode;
|
||||
|
||||
@Size(max = 2)
|
||||
private String suffix;
|
||||
|
||||
private Integer hierachy;
|
||||
|
||||
private Integer indent;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
@JsonProperty("isLeaf")
|
||||
private Boolean isLeaf;
|
||||
|
||||
private LocalDate isLeafStartDate;
|
||||
|
||||
private Integer parentId;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<NomenclatureDesc> nomenclatureDescs;
|
||||
|
||||
@MappedCollection(idColumn = "nomenclature_id")
|
||||
private Set<NomenclatureFootnote> footnotes;
|
||||
|
||||
public Nomenclature(String hsCode, String suffix, Integer hierachy, Integer indent, LocalDate startDate,
|
||||
LocalDate endDate, Boolean isLeaf, LocalDate isLeafStartDate, Integer parentId, Set<NomenclatureFootnote> footnotes) {
|
||||
this.hscode = hsCode;
|
||||
this.suffix = suffix;
|
||||
this.hierachy = hierachy;
|
||||
this.indent = indent;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.isLeaf = isLeaf;
|
||||
this.isLeafStartDate = isLeafStartDate;
|
||||
this.parentId = parentId;
|
||||
this.footnotes = footnotes;
|
||||
this.nomenclatureDescs = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHscode() {
|
||||
return hscode;
|
||||
}
|
||||
|
||||
public void setHscode(final String hscode) {
|
||||
this.hscode = hscode;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(final String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public Integer getHierachy() {
|
||||
return hierachy;
|
||||
}
|
||||
|
||||
public void setHierachy(final Integer hierachy) {
|
||||
this.hierachy = hierachy;
|
||||
}
|
||||
|
||||
public Integer getIndent() {
|
||||
return indent;
|
||||
}
|
||||
|
||||
public void setIndent(final Integer indent) {
|
||||
this.indent = indent;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Boolean getIsLeaf() {
|
||||
return isLeaf;
|
||||
}
|
||||
|
||||
public void setIsLeaf(final Boolean isLeaf) {
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
|
||||
public LocalDate getIsLeafStartDate() {
|
||||
return isLeafStartDate;
|
||||
}
|
||||
|
||||
public void setIsLeafStartDate(final LocalDate isLeafStartDate) {
|
||||
this.isLeafStartDate = isLeafStartDate;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(final Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public void addNomenclatureDesc(NomenclatureDesc nomenclatureDesc) {
|
||||
this.nomenclatureDescs.add(nomenclatureDesc);
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/de/avatic/taricdb/model/NomenclatureDesc.java
Normal file
61
src/main/java/de/avatic/taricdb/model/NomenclatureDesc.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class NomenclatureDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
public NomenclatureDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDescc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
|
||||
public class NomenclatureFootnote {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@NotNull
|
||||
@Column("footnote_id")
|
||||
private AggregateReference<Footnote, Integer> footnote;
|
||||
|
||||
public NomenclatureFootnote(AggregateReference<Footnote, Integer> footnote) {
|
||||
this.footnote = footnote;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AggregateReference<Footnote, Integer> getFootnote() {
|
||||
return footnote;
|
||||
}
|
||||
|
||||
public void setFootnote(final AggregateReference<Footnote, Integer> footnote) {
|
||||
this.footnote = footnote;
|
||||
}
|
||||
|
||||
}
|
||||
83
src/main/java/de/avatic/taricdb/model/SetupStatus.java
Normal file
83
src/main/java/de/avatic/taricdb/model/SetupStatus.java
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Table("setup_status")
|
||||
public class SetupStatus {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
private Integer currentRecord;
|
||||
|
||||
private Integer maxRecord;
|
||||
|
||||
@Size(max = 255)
|
||||
private String statusText;
|
||||
|
||||
private Boolean running;
|
||||
|
||||
@Size(max = 255)
|
||||
private String exitStatus;
|
||||
|
||||
public SetupStatus(int currentRecord, int maxRecord, String statusText, boolean running, String exitStatus) {
|
||||
this.currentRecord = currentRecord;
|
||||
this.maxRecord = maxRecord;
|
||||
this.statusText = statusText;
|
||||
this.running = running;
|
||||
this.exitStatus = exitStatus;
|
||||
}
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getCurrentRecord() {
|
||||
return currentRecord;
|
||||
}
|
||||
|
||||
public void setCurrentRecord(final Integer currentRecord) {
|
||||
this.currentRecord = currentRecord;
|
||||
}
|
||||
|
||||
public Integer getMaxRecord() {
|
||||
return maxRecord;
|
||||
}
|
||||
|
||||
public void setMaxRecord(final Integer maxRecord) {
|
||||
this.maxRecord = maxRecord;
|
||||
}
|
||||
|
||||
public String getStatusText() {
|
||||
return statusText;
|
||||
}
|
||||
|
||||
public void setStatusText(final String statusText) {
|
||||
this.statusText = statusText;
|
||||
}
|
||||
|
||||
public Boolean getRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public void setRunning(final Boolean running) {
|
||||
this.running = running;
|
||||
}
|
||||
|
||||
public String getExitStatus() {
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
public void setExitStatus(final String exitStatus) {
|
||||
this.exitStatus = exitStatus;
|
||||
}
|
||||
|
||||
}
|
||||
71
src/main/java/de/avatic/taricdb/model/Unit.java
Normal file
71
src/main/java/de/avatic/taricdb/model/Unit.java
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class Unit {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 3)
|
||||
private String unitCode;
|
||||
|
||||
@Size(max = 1)
|
||||
private String unitQualifier;
|
||||
|
||||
private String label;
|
||||
|
||||
@MappedCollection(idColumn = "ref_id")
|
||||
private Set<UnitDesc> unitDesc;
|
||||
|
||||
public Unit(String unitCode, String unitQualifier, String label) {
|
||||
this.unitCode = unitCode;
|
||||
this.unitQualifier = unitQualifier;
|
||||
this.label = label;
|
||||
this.unitDesc = new HashSet<>();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUnitCode() {
|
||||
return unitCode;
|
||||
}
|
||||
|
||||
public void setUnitCode(final String unitCode) {
|
||||
this.unitCode = unitCode;
|
||||
}
|
||||
|
||||
public String getUnitQualifier() {
|
||||
return unitQualifier;
|
||||
}
|
||||
|
||||
public void setUnitQualifier(final String unitQualifier) {
|
||||
this.unitQualifier = unitQualifier;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(final String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void addUnitDesc(UnitDesc desc) {
|
||||
unitDesc.add(desc);
|
||||
}
|
||||
|
||||
}
|
||||
62
src/main/java/de/avatic/taricdb/model/UnitDesc.java
Normal file
62
src/main/java/de/avatic/taricdb/model/UnitDesc.java
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
|
||||
public class UnitDesc {
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
|
||||
@Size(max = 2)
|
||||
private String lang;
|
||||
|
||||
private String desc;
|
||||
|
||||
private LocalDate descStartDate;
|
||||
|
||||
|
||||
public UnitDesc(String lang, String desc, LocalDate descStartDate) {
|
||||
this.lang = lang;
|
||||
this.desc = desc;
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public void setLang(final String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public String getDescc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(final String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public LocalDate getDescStartDate() {
|
||||
return descStartDate;
|
||||
}
|
||||
|
||||
public void setDescStartDate(final LocalDate descStartDate) {
|
||||
this.descStartDate = descStartDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package de.avatic.taricdb.model;
|
||||
|
||||
|
||||
|
||||
public class UploadFile {
|
||||
int id;
|
||||
int parentId;
|
||||
UploadFileType type;
|
||||
byte[] blob;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.AdditionalCode;
|
||||
|
||||
public interface AdditionalCodeRepository extends CrudRepository<AdditionalCode, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.AppliedMeasureCondition;
|
||||
|
||||
public interface AppliedMeasureConditionRepository extends CrudRepository<AppliedMeasureCondition, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.AppliedMeasure;
|
||||
|
||||
public interface AppliedMeasureRepository extends CrudRepository<AppliedMeasure, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.Certificate;
|
||||
|
||||
public interface CertificateRepository extends CrudRepository<Certificate, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.CertificateType;
|
||||
|
||||
public interface CertificateTypeRepository extends CrudRepository<CertificateType, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.ConditionType;
|
||||
|
||||
public interface ConditionTypeRepository extends CrudRepository<ConditionType, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.Footnote;
|
||||
|
||||
public interface FootnoteRepository extends CrudRepository<Footnote, Integer> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.GeoGroupMembership;
|
||||
|
||||
public interface GeoGroupMembershipRepository extends CrudRepository<GeoGroupMembership, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.GeoGroup;
|
||||
|
||||
public interface GeoGroupRepository extends CrudRepository<GeoGroup, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.Geo;
|
||||
|
||||
public interface GeoRepository extends CrudRepository<Geo, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.Import;
|
||||
|
||||
public interface ImportRepository extends CrudRepository<Import, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.LegalBase;
|
||||
|
||||
public interface LegalBaseRepository extends CrudRepository<LegalBase, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureAction;
|
||||
|
||||
public interface MeasureActionRepository extends CrudRepository<MeasureAction, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureExclusion;
|
||||
|
||||
public interface MeasureExclusionRepository extends CrudRepository<MeasureExclusion, Integer>
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureFootnote;
|
||||
|
||||
public interface MeasureFootnoteRepository extends CrudRepository<MeasureFootnote, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import de.avatic.taricdb.model.Measure;
|
||||
|
||||
public interface MeasureRepository extends CrudRepository<Measure, Integer> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package de.avatic.taricdb.repository;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import de.avatic.taricdb.model.MeasureSeries;
|
||||
|
||||
public interface MeasureSeriesRepository extends CrudRepository<MeasureSeries, Integer> {
|
||||
|
||||
public MeasureSeries findByMeasureSeriesCode(String measureSeriesCode);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue