diff --git a/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseidxRepository.java b/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseidxRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..629d38c73ef5fa89b4ed3e1bc9ca9e5ba621980a --- /dev/null +++ b/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseidxRepository.java @@ -0,0 +1,9 @@ +package at.tuwien.repository.elastic; + +import at.tuwien.entities.database.Database; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; +import org.springframework.stereotype.Repository; + +@Repository(value = "ElasticDatabaseRepository") +public interface DatabaseidxRepository extends ElasticsearchRepository<Database, Long> { +} diff --git a/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseRepository.java b/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/TableidxRepository.java similarity index 62% rename from fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseRepository.java rename to fda-table-service/services/src/main/java/at/tuwien/repository/elastic/TableidxRepository.java index aa60a6dbbcdd124de8a38c4098ee43c7115df16f..fb60eb355aaaf4e050471da84b444d91368aca38 100644 --- a/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/DatabaseRepository.java +++ b/fda-table-service/services/src/main/java/at/tuwien/repository/elastic/TableidxRepository.java @@ -1,9 +1,9 @@ package at.tuwien.repository.elastic; -import at.tuwien.entities.database.Database; +import at.tuwien.entities.database.table.Table; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.stereotype.Repository; @Repository(value = "ElasticDatabaseService") -public interface DatabaseRepository extends ElasticsearchRepository<Database, Long> { +public interface TableidxRepository extends ElasticsearchRepository<Table, Long> { } \ No newline at end of file diff --git a/fda-table-service/services/src/main/java/at/tuwien/service/TableService.java b/fda-table-service/services/src/main/java/at/tuwien/service/TableService.java index 874cf7c0ff382fa5cacda12b80667c68e2d7dead..1b06258e3a04a28e399924b137ae8a0bfa487275 100644 --- a/fda-table-service/services/src/main/java/at/tuwien/service/TableService.java +++ b/fda-table-service/services/src/main/java/at/tuwien/service/TableService.java @@ -10,7 +10,8 @@ import at.tuwien.exception.*; import at.tuwien.mapper.ImageMapper; import at.tuwien.mapper.QueryMapper; import at.tuwien.mapper.TableMapper; -import at.tuwien.repository.elastic.DatabaseRepository; +import at.tuwien.repository.elastic.TableidxRepository; +import at.tuwien.repository.jpa.DatabaseRepository; import at.tuwien.repository.jpa.TableRepository; import com.opencsv.CSVParser; import com.opencsv.CSVParserBuilder; @@ -34,14 +35,17 @@ public class TableService extends JdbcConnector { private final TableRepository tableRepository; private final DatabaseRepository databaseRepository; + private final TableidxRepository tableidxRepository; private final TableMapper tableMapper; @Autowired public TableService(TableRepository tableRepository, DatabaseRepository databaseRepository, - ImageMapper imageMapper, TableMapper tableMapper, QueryMapper queryMapper) { + TableidxRepository tableidxRepository, ImageMapper imageMapper, TableMapper tableMapper, + QueryMapper queryMapper) { super(imageMapper, tableMapper, queryMapper); this.tableRepository = tableRepository; this.databaseRepository = databaseRepository; + this.tableidxRepository = tableidxRepository; this.tableMapper = tableMapper; } @@ -131,6 +135,8 @@ public class TableService extends JdbcConnector { } log.info("Created table {}", table.getId()); log.debug("created table: {}", table); + /* save in table_index - elastic search */ + tableidxRepository.save(table); return table; }