Minor Refactoring

This commit is contained in:
George Kalampokis 2022-04-29 13:32:22 +03:00
parent 6b6d63c128
commit 1f2084578d
2 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,7 @@ import java.io.IOException;
*/ */
public abstract class ElasticRepository<T extends ElasticEntity,C extends Criteria> implements Repository<T,C> { public abstract class ElasticRepository<T extends ElasticEntity,C extends Criteria> implements Repository<T,C> {
private static final Logger logger = LoggerFactory.getLogger(ElasticRepository.class); private static final Logger logger = LoggerFactory.getLogger(ElasticRepository.class);
private final ObjectMapper mapper = new ObjectMapper(); private final ObjectMapper mapper;
private RestHighLevelClient client; private RestHighLevelClient client;
public RestHighLevelClient getClient() { public RestHighLevelClient getClient() {
@ -33,6 +33,7 @@ public abstract class ElasticRepository<T extends ElasticEntity,C extends Criter
logger.warn("Unable to connect to Elastic Services"); logger.warn("Unable to connect to Elastic Services");
this.client = null; this.client = null;
} }
this.mapper = new ObjectMapper();
} }
public <T> T transformFromString(String value, Class<T> tClass) { public <T> T transformFromString(String value, Class<T> tClass) {

View File

@ -168,7 +168,7 @@ public class DatasetManager {
datasets = null; datasets = null;
} }
UserInfo userInfo = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());//builderFactory.getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
// QueryableList<eu.eudat.data.entities.Dataset> items = databaseRepository.getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria()).withHint(HintedModelFactory.getHint(DatasetListingModel.class)); // QueryableList<eu.eudat.data.entities.Dataset> items = databaseRepository.getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria()).withHint(HintedModelFactory.getHint(DatasetListingModel.class));
QueryableList<eu.eudat.data.entities.Dataset> items; QueryableList<eu.eudat.data.entities.Dataset> items;
if (datasets != null && !datasets.isEmpty()) { if (datasets != null && !datasets.isEmpty()) {
@ -186,6 +186,7 @@ public class DatasetManager {
if (principal.getId() == null) { if (principal.getId() == null) {
throw new UnauthorisedException("You are not allowed to access those datasets"); throw new UnauthorisedException("You are not allowed to access those datasets");
} }
UserInfo userInfo = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());//builderFactory.getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
if (datasetTableRequest.getCriteria().getRole() != null) { if (datasetTableRequest.getCriteria().getRole() != null) {
roles.add(datasetTableRequest.getCriteria().getRole()); roles.add(datasetTableRequest.getCriteria().getRole());
} }