Makes Funder a mandatory entity. (Issue #182)
This commit is contained in:
parent
f2833576d3
commit
f59881d7aa
|
@ -44,9 +44,11 @@ public class QuickWizardController extends BaseController {
|
|||
|
||||
Funder funderEntity;
|
||||
//Create Funder
|
||||
if (quickWizard.getFunder().getExistFunder() == null
|
||||
&& quickWizard.getFunder().getLabel() == null) {
|
||||
funderEntity = null;
|
||||
if (quickWizard.getFunder() == null) {
|
||||
throw new Exception("Funder is a mandatory entity");
|
||||
} else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() == null) {
|
||||
// funderEntity = null;
|
||||
throw new Exception("Funder is a mandatory entity");
|
||||
} else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() != null) {
|
||||
funderEntity = this.quickWizardManager.createOrUpdate(quickWizard.getFunder().toDataFunder(), principal);
|
||||
} else {
|
||||
|
@ -90,8 +92,6 @@ public class QuickWizardController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<QuickWizardModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetcreate"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetCreateWizardModel>> addDatasetWizard(@RequestBody DatasetCreateWizardModel datasetCreateWizardModel, Principal principal) throws Exception{
|
||||
|
@ -101,5 +101,4 @@ public class QuickWizardController extends BaseController {
|
|||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetCreateWizardModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Dataset added!"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -293,13 +293,13 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
|||
}
|
||||
}
|
||||
|
||||
if(this.funder == null && this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
|
||||
dataManagementPlanEntity.getGrant().setFunder(null);
|
||||
}
|
||||
else if (this.funder != null && this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
|
||||
dataManagementPlanEntity.getGrant().setFunder(null);
|
||||
}
|
||||
else {
|
||||
if (this.funder == null) {
|
||||
// dataManagementPlanEntity.getGrant().setFunder(null);
|
||||
throw new Exception("Funder is a mandatory entity");
|
||||
} else if (this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
|
||||
// dataManagementPlanEntity.getGrant().setFunder(null);
|
||||
throw new Exception("Funder is a mandatory entity");
|
||||
} else {
|
||||
if (this.funder.getLabel() != null) {
|
||||
Funder funder = new Funder();
|
||||
funder.setLabel(this.funder.getLabel());
|
||||
|
@ -311,8 +311,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
|||
funder.setModified(new Date());
|
||||
|
||||
dataManagementPlanEntity.getGrant().setFunder(funder);
|
||||
}
|
||||
else if (this.funder.getExistFunder() != null && this.funder.getLabel() == null){
|
||||
} else if (this.funder.getExistFunder() != null && this.funder.getLabel() == null){
|
||||
dataManagementPlanEntity.getGrant().setFunder(this.funder.getExistFunder().toDataModel());
|
||||
dataManagementPlanEntity.getGrant().getFunder().setType(Funder.FunderType.EXTERNAL.getValue());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue