Merge remote-tracking branch 'origin/Development' into Development
This commit is contained in:
commit
c003c6468e
|
@ -4,6 +4,8 @@ import eu.eudat.data.dao.criteria.FunderCriteria;
|
||||||
import eu.eudat.data.dao.criteria.GrantCriteria;
|
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||||
import eu.eudat.data.dao.criteria.ProjectCriteria;
|
import eu.eudat.data.dao.criteria.ProjectCriteria;
|
||||||
import eu.eudat.data.entities.*;
|
import eu.eudat.data.entities.*;
|
||||||
|
import eu.eudat.elastic.entities.Dmp;
|
||||||
|
import eu.eudat.logic.mapper.elastic.DmpMapper;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||||
|
@ -20,11 +22,13 @@ public class QuickWizardManager {
|
||||||
|
|
||||||
private ApiContext apiContext;
|
private ApiContext apiContext;
|
||||||
private DatabaseRepository databaseRepository;
|
private DatabaseRepository databaseRepository;
|
||||||
|
private DatasetManager datasetManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public QuickWizardManager(ApiContext apiContext) {
|
public QuickWizardManager(ApiContext apiContext, DatasetManager datasetManager) {
|
||||||
this.apiContext = apiContext;
|
this.apiContext = apiContext;
|
||||||
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
||||||
|
this.datasetManager = datasetManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Funder createOrUpdate(eu.eudat.models.data.funder.Funder funder, Principal principal) {
|
public Funder createOrUpdate(eu.eudat.models.data.funder.Funder funder, Principal principal) {
|
||||||
|
@ -63,9 +67,18 @@ public class QuickWizardManager {
|
||||||
DMP dmpret = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(newDmp);
|
DMP dmpret = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(newDmp);
|
||||||
if (dataManagementPlan.getAssociatedUsers().size() == 0)
|
if (dataManagementPlan.getAssociatedUsers().size() == 0)
|
||||||
assignUser(newDmp, user, apiContext);
|
assignUser(newDmp, user, apiContext);
|
||||||
|
|
||||||
|
this.updateIndex(dmpret);
|
||||||
|
|
||||||
return dmpret;
|
return dmpret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateIndex(DMP dmp) throws IOException {
|
||||||
|
DmpMapper mapper = new DmpMapper(apiContext, datasetManager);
|
||||||
|
Dmp elastic = mapper.toElastic(dmp);
|
||||||
|
apiContext.getOperationsContext().getElasticRepository().getDmpRepository().createOrUpdate(elastic);
|
||||||
|
}
|
||||||
|
|
||||||
private void assignUser(DMP dmp, UserInfo userInfo, ApiContext apiContext) {
|
private void assignUser(DMP dmp, UserInfo userInfo, ApiContext apiContext) {
|
||||||
UserDMP userDMP = new UserDMP();
|
UserDMP userDMP = new UserDMP();
|
||||||
userDMP.setDmp(dmp);
|
userDMP.setDmp(dmp);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue