Skip to content
Snippets Groups Projects
Commit 440185e2 authored by Cornelia Michlits's avatar Cornelia Michlits
Browse files

#84 bug fix table index creation

parent 2466e7a6
No related branches found
No related tags found
3 merge requests!81New stable release,!43Merge dev to master,!28Add "Search service"
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> {
}
package at.tuwien.repository.elastic; 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.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository(value = "ElasticDatabaseService") @Repository(value = "ElasticDatabaseService")
public interface DatabaseRepository extends ElasticsearchRepository<Database, Long> { public interface TableidxRepository extends ElasticsearchRepository<Table, Long> {
} }
\ No newline at end of file
...@@ -10,7 +10,8 @@ import at.tuwien.exception.*; ...@@ -10,7 +10,8 @@ import at.tuwien.exception.*;
import at.tuwien.mapper.ImageMapper; import at.tuwien.mapper.ImageMapper;
import at.tuwien.mapper.QueryMapper; import at.tuwien.mapper.QueryMapper;
import at.tuwien.mapper.TableMapper; 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 at.tuwien.repository.jpa.TableRepository;
import com.opencsv.CSVParser; import com.opencsv.CSVParser;
import com.opencsv.CSVParserBuilder; import com.opencsv.CSVParserBuilder;
...@@ -34,14 +35,17 @@ public class TableService extends JdbcConnector { ...@@ -34,14 +35,17 @@ public class TableService extends JdbcConnector {
private final TableRepository tableRepository; private final TableRepository tableRepository;
private final DatabaseRepository databaseRepository; private final DatabaseRepository databaseRepository;
private final TableidxRepository tableidxRepository;
private final TableMapper tableMapper; private final TableMapper tableMapper;
@Autowired @Autowired
public TableService(TableRepository tableRepository, DatabaseRepository databaseRepository, public TableService(TableRepository tableRepository, DatabaseRepository databaseRepository,
ImageMapper imageMapper, TableMapper tableMapper, QueryMapper queryMapper) { TableidxRepository tableidxRepository, ImageMapper imageMapper, TableMapper tableMapper,
QueryMapper queryMapper) {
super(imageMapper, tableMapper, queryMapper); super(imageMapper, tableMapper, queryMapper);
this.tableRepository = tableRepository; this.tableRepository = tableRepository;
this.databaseRepository = databaseRepository; this.databaseRepository = databaseRepository;
this.tableidxRepository = tableidxRepository;
this.tableMapper = tableMapper; this.tableMapper = tableMapper;
} }
...@@ -131,6 +135,8 @@ public class TableService extends JdbcConnector { ...@@ -131,6 +135,8 @@ public class TableService extends JdbcConnector {
} }
log.info("Created table {}", table.getId()); log.info("Created table {}", table.getId());
log.debug("created table: {}", table); log.debug("created table: {}", table);
/* save in table_index - elastic search */
tableidxRepository.save(table);
return table; return table;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment