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