Search in sources :

Example 1 with SubmissionStatus

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

the class BaseSubmissionServiceImpl method runApproveSubmissionProcess.

protected SubmissionStatus runApproveSubmissionProcess(T submission, SubmissionStatus initialState, ApproveDTO action) {
    checkApproveSubmissionResultInitialState(initialState);
    SubmissionStatus result;
    switch(initialState) {
        case EXECUTED:
            result = action.getIsApproved() ? EXECUTED_PUBLISHED : EXECUTED_REJECTED;
            break;
        case FAILED:
            result = action.getIsApproved() ? FAILED_PUBLISHED : FAILED_REJECTED;
            break;
        default:
            throw new IllegalArgumentException(ILLEGAL_SUBMISSION_STATE_EXCEPTION);
    }
    return result;
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus)

Example 2 with SubmissionStatus

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

the class BaseSubmissionServiceImpl method approveSubmissionResult.

@Override
public T approveSubmissionResult(Long submissionId, ApproveDTO approveDTO, IUser user) {
    T submission = submissionRepository.getOne(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 SubmissionStatus

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

the class BaseSubmissionServiceImpl method getHideAction.

private SubmissionAction getHideAction(Submission submission) {
    SubmissionAction hideAction = new SubmissionAction(SubmissionActionType.HIDE.name());
    List<SubmissionStatus> availableForStatuses = Arrays.asList(NOT_APPROVED, EXECUTED_REJECTED, FAILED_REJECTED, EXECUTED_PUBLISHED, FAILED_PUBLISHED);
    hideAction.setAvailable(availableForStatuses.contains(submission.getStatus()));
    return hideAction;
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) SubmissionAction(com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction)

Example 4 with SubmissionStatus

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

the class BaseAnalysisServiceImpl method runApproveSubmissionProcess.

protected SubmissionStatus runApproveSubmissionProcess(Submission submission, SubmissionStatus initialState, ApproveDTO action) {
    checkApproveSubmissionResultInitialState(initialState);
    SubmissionStatus result;
    switch(initialState) {
        case EXECUTED:
            result = action.getIsApproved() ? EXECUTED_PUBLISHED : EXECUTED_REJECTED;
            break;
        case FAILED:
            result = action.getIsApproved() ? FAILED_PUBLISHED : FAILED_REJECTED;
            break;
        default:
            throw new IllegalArgumentException(ILLEGAL_SUBMISSION_STATE_EXCEPTION);
    }
    return result;
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus)

Example 5 with SubmissionStatus

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

the class BaseSubmissionController method setStatus.

@ApiOperation("Update analysis execution status.")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/status/{password}", method = POST)
public void setStatus(@PathVariable("submissionId") Long id, @PathVariable("password") String password, @RequestBody CommonAnalysisExecutionStatusDTO status) throws NotExistException {
    final String stdoutDiff = status.getStdout();
    LOGGER.debug("stdout for submission with i='{}' recieved\n{}", id, stdoutDiff);
    List<SubmissionStatus> submissionStatuses = new ArrayList<SubmissionStatus>() {

        {
            add(SubmissionStatus.STARTING);
            add(SubmissionStatus.IN_PROGRESS);
            add(SubmissionStatus.QUEUE_PROCESSING);
        }
    };
    T submission = submissionService.getSubmissionByIdAndUpdatePasswordAndStatus(id, password, submissionStatuses);
    final String stdout = submission.getStdout();
    submission.setStdout(stdout == null ? stdoutDiff : stdout + stdoutDiff);
    submission.setStdoutDate(status.getStdoutDate());
    submission.setUpdated(new Date());
    if (submission.getStatus().equals(SubmissionStatus.STARTING) || submission.getStatus().equals(SubmissionStatus.QUEUE_PROCESSING)) {
        submissionService.moveSubmissionToNewStatus(submission, SubmissionStatus.IN_PROGRESS, null, null);
    } else {
        submissionService.saveSubmission(submission);
    }
}
Also used : SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) PUT(org.springframework.web.bind.annotation.RequestMethod.PUT) GET(org.springframework.web.bind.annotation.RequestMethod.GET) POST(org.springframework.web.bind.annotation.RequestMethod.POST) ArrayList(java.util.ArrayList) Date(java.util.Date) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)10 Date (java.util.Date)6 SubmissionStatusHistoryElement (com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement)3 LinkedList (java.util.LinkedList)2 EntityGraphUtils (com.cosium.spring.data.jpa.entity.graph.domain.EntityGraphUtils)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1 SubmissionStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO)1 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)1 AlreadyExistException (com.odysseusinc.arachne.portal.exception.AlreadyExistException)1 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)1 CommentTopic (com.odysseusinc.arachne.portal.model.CommentTopic)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 ResultFile (com.odysseusinc.arachne.portal.model.ResultFile)1 Submission (com.odysseusinc.arachne.portal.model.Submission)1 SubmissionInsight (com.odysseusinc.arachne.portal.model.SubmissionInsight)1 SubmissionInsightSubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile)1 EXECUTED_PUBLISHED (com.odysseusinc.arachne.portal.model.SubmissionStatus.EXECUTED_PUBLISHED)1 FAILED_PUBLISHED (com.odysseusinc.arachne.portal.model.SubmissionStatus.FAILED_PUBLISHED)1 SubmissionInsightRepository (com.odysseusinc.arachne.portal.repository.SubmissionInsightRepository)1 SubmissionInsightSubmissionFileRepository (com.odysseusinc.arachne.portal.repository.SubmissionInsightSubmissionFileRepository)1