use of com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method createSubmission.
@ApiOperation("Create and send submission.")
@RequestMapping(value = "/api/v1/analysis-management/{analysisId}/submissions", method = POST)
public JsonResult<List<DTO>> createSubmission(Principal principal, @RequestBody @Validated CreateSubmissionsDTO createSubmissionsDTO, @PathVariable("analysisId") Long analysisId) throws PermissionDeniedException, NotExistException, IOException, NoExecutableFileException, ValidationException {
final JsonResult<List<DTO>> result;
if (principal == null) {
throw new PermissionDeniedException();
}
IUser user = userService.getByEmail(principal.getName());
if (user == null) {
throw new PermissionDeniedException();
}
Analysis analysis = analysisService.getById(analysisId);
final List<Submission> submissions = AnalysisHelper.createSubmission(submissionService, createSubmissionsDTO.getDataSources(), user, analysis);
final List<DTO> submissionDTOs = submissions.stream().map(s -> conversionService.convert(s, getSubmissionDTOClass())).collect(Collectors.toList());
result = new JsonResult<>(NO_ERROR);
result.setResult(submissionDTOs);
return result;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method sendRequest.
private ResultActions sendRequest(Long studyId, Long analysisId, Long dataSourceId) throws Exception {
prepareAnalysisFile(studyId, analysisId);
CreateSubmissionsDTO createSubmissionsDTO = new CreateSubmissionsDTO();
createSubmissionsDTO.setDataSources(Lists.newArrayList(dataSourceId));
return mvc.perform(post("/api/v1/analysis-management/" + analysisId + "/submissions").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createSubmissionsDTO)));
}
Aggregations