Search in sources :

Example 1 with SubmissionAction

use of com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method getSubmissionActions.

@Override
public List<SubmissionAction> getSubmissionActions(Submission submission) {
    // Approve execution
    SubmissionAction execApproveAction = getExecApproveAction(submission);
    // Manually upload files
    SubmissionAction manualResultUploadAction = getManualResultUploadAction(submission);
    // Publish submission
    SubmissionAction publishAction = getPublishAction(submission);
    SubmissionAction hideAction = getHideAction(submission);
    return Arrays.asList(execApproveAction, manualResultUploadAction, publishAction, hideAction);
}
Also used : SubmissionAction(com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction)

Example 2 with SubmissionAction

use of com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method getExecApproveAction.

protected SubmissionAction getExecApproveAction(Submission submission) {
    SubmissionAction execApproveAction = new SubmissionAction(EXECUTE.name());
    execApproveAction.setAvailable(submission.getStatus().equals(PENDING));
    switch(submission.getStatus()) {
        case PENDING:
            execApproveAction.setResult(null);
            break;
        case NOT_APPROVED:
            execApproveAction.setResult(false);
            break;
        default:
            execApproveAction.setResult(true);
            break;
    }
    return execApproveAction;
}
Also used : SubmissionAction(com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction)

Example 3 with SubmissionAction

use of com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method getManualResultUploadAction.

protected SubmissionAction getManualResultUploadAction(Submission submission) {
    SubmissionAction manualResultUploadAction = new SubmissionAction(SubmissionActionType.MANUAL_UPLOAD.name());
    manualResultUploadAction.setAvailable(submission.getStatus().equals(SubmissionStatus.IN_PROGRESS));
    return manualResultUploadAction;
}
Also used : SubmissionAction(com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction)

Example 4 with SubmissionAction

use of com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction 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 5 with SubmissionAction

use of com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionServiceImpl method updateSubmission.

@Override
@PreAuthorize("hasPermission(#submission, " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).UPDATE_SUBMISSION)")
public T updateSubmission(T submission) {
    final Long id = submission.getId();
    final T existingSubmission = getSubmissionByIdUnsecured(id);
    final Boolean hidden = submission.getHidden();
    if (hidden != null) {
        final SubmissionAction hideAction = getHideAction(existingSubmission);
        if (!hideAction.getAvailable()) {
            final String message = String.format("Status of Submission with id: '%s' does not allow hide this one", id);
            throw new IllegalStateException(message);
        }
        existingSubmission.setHidden(hidden);
    }
    return submissionRepository.save(existingSubmission);
}
Also used : SubmissionAction(com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

SubmissionAction (com.odysseusinc.arachne.portal.service.impl.submission.SubmissionAction)6 SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1