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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations