Fixes bug with QuickWizard Profile name on backend model

This commit is contained in:
ikalyvas 2019-03-05 18:08:38 +02:00
parent 5ae18beb5d
commit 90aace8e68
3 changed files with 71 additions and 78 deletions

View File

@ -51,7 +51,6 @@ public class QuickWizardController extends BaseController {
//Create Dmp
eu.eudat.data.entities.DMP dmpEntity = this.quickWizardManager.createOrUpdate(
quickWizard.getDmp().toDataDmp(
this.getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao(),
projectEntity,
principal),
principal);
@ -60,7 +59,6 @@ public class QuickWizardController extends BaseController {
quickWizard.getDmp().setId(dmpEntity.getId());
for (DatasetDescriptionQuickWizardModel dataset : quickWizard.getDatasets().getDatasetsList()) {
this.datasetManager.createOrUpdate(dataset.toDataModel(quickWizard.getDmp().toDataDmp(
this.getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao(),
projectEntity,
principal),
quickWizard.getDmp().getDatasetProfile().getId()),

View File

@ -56,6 +56,7 @@ public class DatasetManager {
private DatasetRepository datasetRepository;
private BuilderFactory builderFactory;
private UserManager userManager;
@Autowired
public DatasetManager(ApiContext apiContext, UserManager userManager) {
this.apiContext = apiContext;

View File

@ -1,6 +1,5 @@
package eu.eudat.models.data.quickwizard;
import eu.eudat.data.dao.entities.UserInfoDao;
import eu.eudat.data.entities.Project;
import eu.eudat.models.data.dmp.AssociatedProfile;
import eu.eudat.models.data.security.Principal;
@ -16,7 +15,7 @@ public class DmpQuickWizardModel {
private UUID id;
private String label;
private int status;
private AssociatedProfile profile;
private AssociatedProfile datasetProfile;
private String description;
private eu.eudat.models.data.project.Project project;
@ -45,12 +44,8 @@ public class DmpQuickWizardModel {
this.status = status;
}
public AssociatedProfile getProfile() {
return profile;
}
public void setProfile(AssociatedProfile profile) {
this.profile = profile;
public void setDatasetProfile(AssociatedProfile datasetProfile) {
this.datasetProfile = datasetProfile;
}
public String getDescription() {
@ -69,7 +64,7 @@ public class DmpQuickWizardModel {
this.project = project;
}
public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(UserInfoDao userInfoRepository ,Project project, Principal principal) {
public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(Project project, Principal principal) {
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlanEntity = new eu.eudat.models.data.dmp.DataManagementPlan();
dataManagementPlanEntity.setId(this.id);
@ -80,9 +75,9 @@ public class DmpQuickWizardModel {
eu.eudat.models.data.project.Project importProject = new eu.eudat.models.data.project.Project();
dataManagementPlanEntity.setProject(importProject.fromDataModel(project));
}
if(this.profile!=null) {
if (this.datasetProfile != null) {
List<AssociatedProfile> assProfile = new LinkedList<>();
assProfile.add(this.profile);
assProfile.add(this.datasetProfile);
dataManagementPlanEntity.setProfiles(assProfile);
}
dataManagementPlanEntity.setStatus((short) this.status);
@ -90,9 +85,8 @@ public class DmpQuickWizardModel {
dataManagementPlanEntity.setProperties(null);
dataManagementPlanEntity.setCreated(new Date());
List<UserInfo> user = new LinkedList<UserInfo>();
eu.eudat.models.data.userinfo.UserInfo usetInfo = new eu.eudat.models.data.userinfo.UserInfo();
usetInfo.fromDataModel(userInfoRepository.find(principal.getId()));
user.add(usetInfo);
eu.eudat.models.data.userinfo.UserInfo userInfo = new eu.eudat.models.data.userinfo.UserInfo();
userInfo.setId(principal.getId());
dataManagementPlanEntity.setAssociatedUsers(user);
return dataManagementPlanEntity;
}
@ -100,9 +94,9 @@ public class DmpQuickWizardModel {
public eu.eudat.data.entities.DatasetProfile getDatasetProfile() {
eu.eudat.data.entities.DatasetProfile datasetProfile = new eu.eudat.data.entities.DatasetProfile();
datasetProfile.setDefinition(this.profile.getLabel());
datasetProfile.setLabel(this.profile.getLabel());
datasetProfile.setId(this.profile.getId());
datasetProfile.setDefinition(this.datasetProfile.getLabel());
datasetProfile.setLabel(this.datasetProfile.getLabel());
datasetProfile.setId(this.datasetProfile.getId());
return datasetProfile;
}