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