Fix issue with elasticsearch inconsistencies
This commit is contained in:
parent
e8d71a8f66
commit
e546362f58
|
@ -39,11 +39,11 @@ import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -121,7 +121,7 @@ public class Datasets extends BaseController {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity getSingle(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
ResponseEntity getSingle(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
||||||
|
@ -246,7 +246,7 @@ public class Datasets extends BaseController {
|
||||||
* Data Management
|
* Data Management
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DatasetWizardModel>> createOrUpdate(@RequestBody DatasetWizardModel profile, Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<DatasetWizardModel>> createOrUpdate(@RequestBody DatasetWizardModel profile, Principal principal) throws Exception {
|
||||||
|
@ -262,7 +262,7 @@ public class Datasets extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message(this.getApiContext().getHelpersService().getMessageSource().getMessage("dataset.public", new Object[]{}, locale)));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message(this.getApiContext().getHelpersService().getMessageSource().getMessage("dataset.public", new Object[]{}, locale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<Dataset>> delete(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<Dataset>> delete(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
||||||
|
@ -270,7 +270,7 @@ public class Datasets extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Deleted"));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Deleted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/{id}/unlock"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/{id}/unlock"}, produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<Dataset>> unlock(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<Dataset>> unlock(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
||||||
|
@ -318,7 +318,7 @@ public class Datasets extends BaseController {
|
||||||
* Data Index
|
* Data Index
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/index"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/index"})
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<Dataset>> generateIndex(Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<Dataset>> generateIndex(Principal principal) throws Exception {
|
||||||
|
@ -326,7 +326,7 @@ public class Datasets extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Generated").payload(null));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Generated").payload(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/index"})
|
@RequestMapping(method = RequestMethod.DELETE, value = {"/index"})
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<Dataset>> clearIndex(Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<Dataset>> clearIndex(Principal principal) throws Exception {
|
||||||
|
|
|
@ -599,6 +599,9 @@ public class DataManagementPlanManager {
|
||||||
datasets.add(dataset);
|
datasets.add(dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UUID dmpId = result.getId();
|
||||||
|
result.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
|
|
||||||
this.updateIndex(result);
|
this.updateIndex(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -710,6 +713,8 @@ public class DataManagementPlanManager {
|
||||||
DatasetCriteria criteria1 = new DatasetCriteria();
|
DatasetCriteria criteria1 = new DatasetCriteria();
|
||||||
criteria1.setDmpIds(Collections.singletonList(newDmp.getId()));
|
criteria1.setDmpIds(Collections.singletonList(newDmp.getId()));
|
||||||
newDmp.setDataset(new HashSet<>(databaseRepository.getDatasetDao().getWithCriteria(criteria1).toList()));
|
newDmp.setDataset(new HashSet<>(databaseRepository.getDatasetDao().getWithCriteria(criteria1).toList()));
|
||||||
|
UUID dmpId = newDmp.getId();
|
||||||
|
newDmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
|
|
||||||
this.updateIndex(newDmp);
|
this.updateIndex(newDmp);
|
||||||
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
||||||
|
@ -740,12 +745,16 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue());
|
oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp);
|
||||||
|
UUID dmpId = oldDmp.getId();
|
||||||
|
oldDmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(oldDmp);
|
this.updateIndex(oldDmp);
|
||||||
DataManagementPlanCriteria criteria1 = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria criteria1 = new DataManagementPlanCriteria();
|
||||||
criteria1.setAllVersions(true);
|
criteria1.setAllVersions(true);
|
||||||
criteria1.setGroupIds(Collections.singletonList(oldDmp.getGroupId()));
|
criteria1.setGroupIds(Collections.singletonList(oldDmp.getGroupId()));
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria1).toList().forEach(dmp -> {
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria1).toList().forEach(dmp -> {
|
||||||
try {
|
try {
|
||||||
|
UUID tdmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), tdmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
@ -757,6 +766,7 @@ public class DataManagementPlanManager {
|
||||||
if (elastic != null) {
|
if (elastic != null) {
|
||||||
tags = elastic.getTags();
|
tags = elastic.getTags();
|
||||||
}
|
}
|
||||||
|
dataset.setDmp(dmp);
|
||||||
this.datasetManager.updateTags(dataset, tags);
|
this.datasetManager.updateTags(dataset, tags);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
@ -891,7 +901,8 @@ public class DataManagementPlanManager {
|
||||||
if (elastic != null) {
|
if (elastic != null) {
|
||||||
tags = elastic.getTags();
|
tags = elastic.getTags();
|
||||||
}
|
}
|
||||||
|
UUID dmpId = tempDataset.getDmp().getId();
|
||||||
|
tempDataset.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.datasetManager.updateTags(tempDataset, tags);
|
this.datasetManager.updateTags(tempDataset, tags);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
@ -1008,6 +1019,8 @@ public class DataManagementPlanManager {
|
||||||
throw new Exception("DMP is not finalized");
|
throw new Exception("DMP is not finalized");
|
||||||
dmp.setPublic(true);
|
dmp.setPublic(true);
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.PUBLISHED);
|
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.PUBLISHED);
|
||||||
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
|
||||||
|
@ -1021,6 +1034,8 @@ public class DataManagementPlanManager {
|
||||||
if (elastic != null) {
|
if (elastic != null) {
|
||||||
tags = elastic.getTags();
|
tags = elastic.getTags();
|
||||||
}
|
}
|
||||||
|
UUID tmdmpId = dataset.getDmp().getId();
|
||||||
|
dataset.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), tmdmpId)).toList()));
|
||||||
this.datasetManager.updateTags(dataset, tags);
|
this.datasetManager.updateTags(dataset, tags);
|
||||||
metricsManager.increaseValue(MetricNames.DATASET, 1, MetricNames.PUBLISHED);
|
metricsManager.increaseValue(MetricNames.DATASET, 1, MetricNames.PUBLISHED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1106,6 +1121,8 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
dmp.setStatus(DMP.DMPStatus.FINALISED.getValue());
|
dmp.setStatus(DMP.DMPStatus.FINALISED.getValue());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||||
sendNotification(dmp, user, NotificationType.DMP_FINALISED);
|
sendNotification(dmp, user, NotificationType.DMP_FINALISED);
|
||||||
|
@ -1124,6 +1141,8 @@ public class DataManagementPlanManager {
|
||||||
throw new Exception("DMP is already Active");
|
throw new Exception("DMP is already Active");
|
||||||
dmp.setStatus(DMP.DMPStatus.ACTIVE.getValue());
|
dmp.setStatus(DMP.DMPStatus.ACTIVE.getValue());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
metricsManager.decreaseValue(MetricNames.DMP, 1, MetricNames.FINALIZED);
|
metricsManager.decreaseValue(MetricNames.DMP, 1, MetricNames.FINALIZED);
|
||||||
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
||||||
|
@ -1733,6 +1752,8 @@ public class DataManagementPlanManager {
|
||||||
databaseRepository.getDmpDao().createOrUpdate(dmp);
|
databaseRepository.getDmpDao().createOrUpdate(dmp);
|
||||||
assignUser(dmp, me);
|
assignUser(dmp, me);
|
||||||
if (this.apiContext.getOperationsContext().getElasticRepository().getDmpRepository().getClient() != null) {
|
if (this.apiContext.getOperationsContext().getElasticRepository().getDmpRepository().getClient() != null) {
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
}
|
}
|
||||||
dmp.getDataset().forEach(dataset -> {
|
dmp.getDataset().forEach(dataset -> {
|
||||||
|
@ -1755,13 +1776,13 @@ public class DataManagementPlanManager {
|
||||||
try {
|
try {
|
||||||
List<Tag> tags = new ArrayList<>();
|
List<Tag> tags = new ArrayList<>();
|
||||||
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||||
|
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
|
||||||
if (elastic != null) {
|
if (elastic != null) {
|
||||||
tags = elastic.getTags();
|
tags = elastic.getTags();
|
||||||
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
|
|
||||||
datasetWizardModel.setTags(tags);
|
datasetWizardModel.setTags(tags);
|
||||||
|
}
|
||||||
datasetManager.getTagsFromProfile(datasetWizardModel, dataset);
|
datasetManager.getTagsFromProfile(datasetWizardModel, dataset);
|
||||||
datasetManager.updateTags(dataset, datasetWizardModel.getTags());
|
datasetManager.updateTags(dataset, datasetWizardModel.getTags());
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -1824,6 +1845,9 @@ public class DataManagementPlanManager {
|
||||||
try {
|
try {
|
||||||
if (dmp.getUsers() != null) {
|
if (dmp.getUsers() != null) {
|
||||||
logger.info(dmp.getUsers().toString());
|
logger.info(dmp.getUsers().toString());
|
||||||
|
} else {
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
}
|
}
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -1841,6 +1865,8 @@ public class DataManagementPlanManager {
|
||||||
if (elastic != null) {
|
if (elastic != null) {
|
||||||
tags = elastic.getTags();
|
tags = elastic.getTags();
|
||||||
}
|
}
|
||||||
|
UUID dmpId = dataset.getDmp().getId();
|
||||||
|
dataset.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.datasetManager.updateTags(dataset, tags);
|
this.datasetManager.updateTags(dataset, tags);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
@ -1861,6 +1887,8 @@ public class DataManagementPlanManager {
|
||||||
List<DMP> dmps = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().toList();
|
List<DMP> dmps = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().toList();
|
||||||
dmps.forEach(dmp -> {
|
dmps.forEach(dmp -> {
|
||||||
try {
|
try {
|
||||||
|
UUID dmpId = dmp.getId();
|
||||||
|
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
this.updateIndex(dmp);
|
this.updateIndex(dmp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
|
|
@ -598,6 +598,8 @@ public class DatasetManager {
|
||||||
}
|
}
|
||||||
dataset1.setProfile(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(datasetWizardModel.getProfile().getId()));
|
dataset1.setProfile(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(datasetWizardModel.getProfile().getId()));
|
||||||
// datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset1));
|
// datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset1));
|
||||||
|
UUID dmpId = dataset1.getDmp().getId();
|
||||||
|
dataset1.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
updateTags(dataset1, datasetWizardModel.getTags());
|
updateTags(dataset1, datasetWizardModel.getTags());
|
||||||
if (sendNotification) {
|
if (sendNotification) {
|
||||||
if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) {
|
if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) {
|
||||||
|
@ -1014,6 +1016,8 @@ public class DatasetManager {
|
||||||
datasetEntities.forEach(datasetEntity -> {
|
datasetEntities.forEach(datasetEntity -> {
|
||||||
try {
|
try {
|
||||||
eu.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(datasetEntity.getId().toString());
|
eu.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(datasetEntity.getId().toString());
|
||||||
|
UUID dmpId = datasetEntity.getDmp().getId();
|
||||||
|
datasetEntity.getDmp().setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList()));
|
||||||
updateTags(datasetEntity, dataset != null ? dataset.getTags() : null);
|
updateTags(datasetEntity, dataset != null ? dataset.getTags() : null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class DmpMapper {
|
||||||
if (dataset1 != null) {
|
if (dataset1 != null) {
|
||||||
tags = dataset1.getTags();
|
tags = dataset1.getTags();
|
||||||
}
|
}
|
||||||
|
dataset.setDmp(dmp);
|
||||||
return datasetMapper.toElastic(dataset, tags);
|
return datasetMapper.toElastic(dataset, tags);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
|
Loading…
Reference in New Issue