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;
|
Funder funderEntity;
|
||||||
//Create Funder
|
//Create Funder
|
||||||
if (quickWizard.getFunder().getExistFunder() == null
|
if (quickWizard.getFunder() == null) {
|
||||||
&& quickWizard.getFunder().getLabel() == null) {
|
throw new Exception("Funder is a mandatory entity");
|
||||||
funderEntity = null;
|
} 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) {
|
} else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() != null) {
|
||||||
funderEntity = this.quickWizardManager.createOrUpdate(quickWizard.getFunder().toDataFunder(), principal);
|
funderEntity = this.quickWizardManager.createOrUpdate(quickWizard.getFunder().toDataFunder(), principal);
|
||||||
} else {
|
} 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"));
|
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")
|
@RequestMapping(method = RequestMethod.POST, value = {"/datasetcreate"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DatasetCreateWizardModel>> addDatasetWizard(@RequestBody DatasetCreateWizardModel datasetCreateWizardModel, Principal principal) throws Exception{
|
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!"));
|
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) {
|
if (this.funder == null) {
|
||||||
dataManagementPlanEntity.getGrant().setFunder(null);
|
// dataManagementPlanEntity.getGrant().setFunder(null);
|
||||||
}
|
throw new Exception("Funder is a mandatory entity");
|
||||||
else if (this.funder != null && this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
|
} else if (this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
|
||||||
dataManagementPlanEntity.getGrant().setFunder(null);
|
// dataManagementPlanEntity.getGrant().setFunder(null);
|
||||||
}
|
throw new Exception("Funder is a mandatory entity");
|
||||||
else {
|
} else {
|
||||||
if (this.funder.getLabel() != null) {
|
if (this.funder.getLabel() != null) {
|
||||||
Funder funder = new Funder();
|
Funder funder = new Funder();
|
||||||
funder.setLabel(this.funder.getLabel());
|
funder.setLabel(this.funder.getLabel());
|
||||||
|
@ -311,8 +311,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
||||||
funder.setModified(new Date());
|
funder.setModified(new Date());
|
||||||
|
|
||||||
dataManagementPlanEntity.getGrant().setFunder(funder);
|
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().setFunder(this.funder.getExistFunder().toDataModel());
|
||||||
dataManagementPlanEntity.getGrant().getFunder().setType(Funder.FunderType.EXTERNAL.getValue());
|
dataManagementPlanEntity.getGrant().getFunder().setType(Funder.FunderType.EXTERNAL.getValue());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue