Search in sources :

Example 1 with SubmissionStatusHistoryElementDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method getStatusHistory.

@ApiOperation("Get status history of the submission")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/status-history", method = GET)
public JsonResult<List<SubmissionStatusHistoryElementDTO>> getStatusHistory(@PathVariable("submissionId") Long submissionId) throws NotExistException {
    Submission submission = submissionService.getSubmissionById(submissionId);
    List<SubmissionStatusHistoryElement> submissionStatusHistory = submissionService.getSubmissionStatusHistory(submission.getSubmissionGroup().getAnalysis().getId(), submissionId);
    List<SubmissionStatusHistoryElementDTO> convert = new LinkedList<>();
    for (SubmissionStatusHistoryElement submissionStatusHistoryElement : submissionStatusHistory) {
        convert.add(conversionService.convert(submissionStatusHistoryElement, SubmissionStatusHistoryElementDTO.class));
    }
    JsonResult<List<SubmissionStatusHistoryElementDTO>> result = new JsonResult<>(NO_ERROR);
    result.setResult(convert);
    return result;
}
Also used : SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) LinkedList(java.util.LinkedList) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with SubmissionStatusHistoryElementDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO in project ArachneCentralAPI by OHDSI.

the class SubmissionStatusHistoryToSubmissionStatusHistoryDTOConverter method convert.

@Override
public SubmissionStatusHistoryElementDTO convert(SubmissionStatusHistoryElement source) {
    Date date = source.getDate();
    SubmissionStatus status = source.getStatus();
    SubmissionStatusDTO submissionStatusDTO = null;
    if (status != null) {
        submissionStatusDTO = new SubmissionStatusDTO(status);
    }
    IUser author = source.getAuthor();
    ShortUserDTO shortUser = null;
    if (author != null) {
        shortUser = conversionService.convert(author, ShortUserDTO.class);
    }
    return new SubmissionStatusHistoryElementDTO(date, submissionStatusDTO, shortUser, source.getComment());
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) Date(java.util.Date)

Aggregations

SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)2 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1 SubmissionStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 Submission (com.odysseusinc.arachne.portal.model.Submission)1 SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)1 SubmissionStatusHistoryElement (com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1