Search in sources :

Example 1 with SubmissionStatusHistoryElement

use of com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement 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 SubmissionStatusHistoryElement

use of com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method approveSubmissionResult.

@Override
public T approveSubmissionResult(Long submissionId, ApproveDTO approveDTO, IUser user) {
    T submission = submissionRepository.findOne(submissionId);
    SubmissionStatus status = runApproveSubmissionProcess(submission, beforeApproveSubmissionResult(submission, approveDTO), approveDTO);
    List<SubmissionStatusHistoryElement> statusHistory = submission.getStatusHistory();
    statusHistory.add(new SubmissionStatusHistoryElement(new Date(), status, user, submission, approveDTO.getComment()));
    submission.setStatusHistory(statusHistory);
    submissionHelper.updateSubmissionExtendedInfo(submission);
    submission = saveSubmission(submission);
    notifyOwnersAboutSubmissionUpdateViaSocket(submission);
    return submission;
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) Date(java.util.Date)

Example 3 with SubmissionStatusHistoryElement

use of com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method changeSubmissionState.

@Override
public T changeSubmissionState(Long id, String status) {
    T submission = submissionRepository.findOne(id);
    SubmissionStatus submissionStatus = valueOf(status);
    List<SubmissionStatusHistoryElement> statusHistory = submission.getStatusHistory();
    statusHistory.add(new SubmissionStatusHistoryElement(new Date(), submissionStatus, null, submission, null));
    submission.setStatusHistory(statusHistory);
    return saveSubmission(submission);
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) Date(java.util.Date)

Example 4 with SubmissionStatusHistoryElement

use of com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method moveSubmissionToNewStatus.

@Override
public T moveSubmissionToNewStatus(T submission, SubmissionStatus status, IUser user, String comment) {
    List<SubmissionStatusHistoryElement> statusHistory = submission.getStatusHistory();
    statusHistory.add(new SubmissionStatusHistoryElement(new Date(), status, user, submission, comment));
    submission.setStatusHistory(statusHistory);
    return saveSubmission(submission);
}
Also used : SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) Date(java.util.Date)

Example 5 with SubmissionStatusHistoryElement

use of com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method createSubmission.

@Override
public T createSubmission(IUser user, A analysis, Long datasourceId, SubmissionGroup submissionGroup) throws NotExistException, IOException {
    DS dataSource = dataSourceService.getByIdUnsecured(datasourceId);
    T submission = newSubmission();
    submission.setAuthor(user);
    Date created = new Date();
    submission.setCreated(created);
    submission.setUpdated(created);
    submission.setAnalysis(analysis);
    submission.setDataSource(dataSource);
    SubmissionStatus status = calculateSubmissionStatusAccordingToDatasourceOwnership(dataSource, user);
    List<SubmissionStatusHistoryElement> statusHistory = new LinkedList<>();
    SubmissionStatusHistoryElement statusHistoryElement = new SubmissionStatusHistoryElement(created, status, user, submission, null);
    statusHistory.add(statusHistoryElement);
    submission.setStatusHistory(statusHistory);
    submission.setSubmissionGroup(submissionGroup);
    submission.setToken(UUIDGenerator.generateUUID());
    submission.setUpdatePassword(UUIDGenerator.generateUUID());
    beforeCreateSubmission(submission);
    submission = saveSubmissionAndFlush(submission);
    afterCreateSubmission(submission);
    return submission;
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) Date(java.util.Date) LinkedList(java.util.LinkedList)

Aggregations

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