use of org.hisp.dhis.metadata.MetadataProposal in project dhis2-core by dhis2.
the class MetadataWorkflowController method acceptProposal.
@PostMapping(value = { "/{uid}/", "/{uid}" }, produces = APPLICATION_JSON_VALUE)
@ResponseBody
public WebMessage acceptProposal(@PathVariable("uid") String uid) throws NotFoundException {
MetadataProposal proposal = checkProposalExists(uid);
ImportReport report = service.accept(proposal);
if (report.getStatus() != Status.OK) {
return importReport(report);
}
if (proposal.getType() == MetadataProposalType.ADD) {
String objUid = report.getFirstObjectReport().getUid();
Schema schema = schemaService.getSchema(proposal.getTarget().getType());
return created(schema.getSingular() + " created").setLocation(schema.getRelativeApiEndpoint() + "/" + objUid);
}
return ok();
}
Aggregations