Search in sources :

Example 71 with JsonResult

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.

the class ProfessionalTypeController method list.

@ApiOperation("List professional types.")
@RequestMapping(value = "/api/v1/user-management/professional-types", method = RequestMethod.GET)
public JsonResult<List<CommonProfessionalTypeDTO>> list() {
    JsonResult result = null;
    Iterable<ProfessionalType> professionalTypes = professionalTypeService.list();
    result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
    result.setResult(professionalTypes);
    return result;
}
Also used : ProfessionalType(com.odysseusinc.arachne.portal.model.ProfessionalType) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 72 with JsonResult

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.

the class StudyStatusController method get.

@ApiOperation("Get study status.")
@RequestMapping(value = "/api/v1/study-management/study-statuses/{studyStatusId}", method = RequestMethod.GET)
public JsonResult<StudyStatusDTO> get(@PathVariable("studyStatusId") Long id) throws NotExistException {
    StudyStatus studyStatus = studyStatusService.getById(id);
    JsonResult<StudyStatusDTO> result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
    result.setResult(conversionService.convert(studyStatus, StudyStatusDTO.class));
    return result;
}
Also used : StudyStatus(com.odysseusinc.arachne.portal.model.StudyStatus) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) CreateStudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyStatusDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 73 with JsonResult

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method getResultFileInfo.

@ApiOperation("Get result file of the submission.")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/results/{fileUuid}", method = GET)
public JsonResult<ResultFileDTO> getResultFileInfo(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestParam(defaultValue = "true") Boolean withContent, @PathVariable("fileUuid") String fileUuid) throws PermissionDeniedException, NotExistException, IOException {
    ArachneFileMeta file = getResultFile(principal, submissionId, fileUuid);
    String resultFilesPath = contentStorageHelper.getResultFilesDir(Submission.class, submissionId, null);
    ResultFileDTO resultFileDTO = new ResultFileDTO(conversionService.convert(file, FileDTO.class));
    resultFileDTO.setRelativePath(contentStorageHelper.getRelativePath(resultFilesPath, resultFileDTO.getPath()));
    if (withContent) {
        byte[] content = IOUtils.toByteArray(contentStorageService.getContentByFilepath(file.getPath()));
        resultFileDTO = (ResultFileDTO) FileDtoContentHandler.getInstance(resultFileDTO, content).withPdfConverter(toPdfConverter::convert).handle();
    }
    return new JsonResult<>(NO_ERROR, resultFileDTO);
}
Also used : ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) FileDTO(com.odysseusinc.arachne.portal.api.v1.dto.FileDTO) UploadFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO) SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) ArachneFileMeta(com.odysseusinc.arachne.storage.model.ArachneFileMeta) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 74 with JsonResult

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method getSubmissionGroupFileInfo.

@ApiOperation("Get query file of the submission group.")
@RequestMapping(value = "/api/v1/analysis-management/submission-groups/{submissionGroupId}/files/{fileId}", method = GET)
public JsonResult<SubmissionFileDTO> getSubmissionGroupFileInfo(@PathVariable("submissionGroupId") Long submissionGroupId, @PathVariable("fileId") Long fileId, @RequestParam(defaultValue = "true") Boolean withContent) throws NotExistException, IOException {
    final SubmissionFile submissionFile = submissionService.getSubmissionFile(submissionGroupId, fileId);
    SubmissionFileDTO fileDto = conversionService.convert(submissionFile, SubmissionFileDTO.class);
    if (withContent) {
        fileDto = (SubmissionFileDTO) FileDtoContentHandler.getInstance(fileDto, analysisService.getPath(submissionFile).toFile()).withPdfConverter(toPdfConverter::convert).handle();
    }
    return new JsonResult<>(NO_ERROR, fileDto);
}
Also used : SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 75 with JsonResult

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method approveSubmissionResult.

@ApiOperation("Approve submission results for show to owner")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/approveresult", method = POST)
public JsonResult<DTO> approveSubmissionResult(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestBody @Valid ApproveDTO approveDTO) throws PermissionDeniedException, NotExistException {
    // ToDo remove after front will be changed
    approveDTO.setIsSuccess(true);
    Submission updatedSubmission = submissionService.approveSubmissionResult(submissionId, approveDTO, userService.getByEmail(principal.getName()));
    DTO submissionDTO = conversionService.convert(updatedSubmission, getSubmissionDTOClass());
    return new JsonResult<>(NO_ERROR, submissionDTO);
}
Also used : Submission(com.odysseusinc.arachne.portal.model.Submission) ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) FileDTO(com.odysseusinc.arachne.portal.api.v1.dto.FileDTO) BaseSubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionDTO) ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) UploadFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO) CommonAnalysisExecutionStatusDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisExecutionStatusDTO) CreateSubmissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO) SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) BaseSubmissionAndAnalysisTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionAndAnalysisTypeDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)71 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)58 ApiOperation (io.swagger.annotations.ApiOperation)55 IUser (com.odysseusinc.arachne.portal.model.IUser)22 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)17 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)17 ResponseEntity (org.springframework.http.ResponseEntity)16 GET (org.springframework.web.bind.annotation.RequestMethod.GET)10 POST (org.springframework.web.bind.annotation.RequestMethod.POST)10 PUT (org.springframework.web.bind.annotation.RequestMethod.PUT)10 NotUniqueException (com.odysseusinc.arachne.portal.exception.NotUniqueException)6 FieldError (org.springframework.validation.FieldError)6 PermissionDeniedException (com.odysseusinc.arachne.portal.exception.PermissionDeniedException)5 ValidationException (com.odysseusinc.arachne.portal.exception.ValidationException)5 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)5 DataNode (com.odysseusinc.arachne.portal.model.DataNode)5 IOException (java.io.IOException)5 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)4 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)4 SubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO)4