use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method getStatusHistory.
@ApiOperation("Get status history of the submission")
@GetMapping("/api/v1/analysis-management/submissions/{submissionId}/status-history")
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.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method getResultFile.
private ArachneFileMeta getResultFile(Principal principal, Long submissionId, String fileUuid) throws NotExistException, PermissionDeniedException {
Submission submission = submissionService.getSubmissionById(submissionId);
IUser user = userService.getByUsername(principal.getName());
return submissionService.getResultFileAndCheckPermission(user, submission, submission.getSubmissionGroup().getAnalysis().getId(), fileUuid);
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method createSubmission.
@ApiOperation("Create and send submission.")
@PostMapping("/api/v1/analysis-management/{analysisId}/submissions")
public JsonResult<List<DTO>> createSubmission(Principal principal, @RequestBody @Validated CreateSubmissionsDTO createSubmissionsDTO, @PathVariable("analysisId") Long analysisId) throws PermissionDeniedException, NotExistException, IOException, NoExecutableFileException, ValidationException {
final JsonResult<List<DTO>> result;
if (principal == null) {
throw new PermissionDeniedException();
}
IUser user = userService.getByUsername(principal.getName());
if (user == null) {
throw new PermissionDeniedException();
}
Analysis analysis = analysisService.getById(analysisId);
final List<Submission> submissions = AnalysisHelper.createSubmission(submissionService, createSubmissionsDTO.getDataSources(), user, analysis);
final List<DTO> submissionDTOs = submissions.stream().map(s -> conversionService.convert(s, getSubmissionDTOClass())).collect(Collectors.toList());
result = new JsonResult<>(NO_ERROR);
result.setResult(submissionDTOs);
return result;
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class ArachnePermissionEvaluator method addPermissions.
public boolean addPermissions(ArachneUser user, HasArachnePermissions hasPermissionsObj) {
Set<ArachnePermission> allPermissions = getAllPermissions(hasPermissionsObj, user);
hasPermissionsObj.setPermissions(allPermissions);
if (hasPermissionsObj instanceof Analysis) {
final Analysis analysis = (Analysis) hasPermissionsObj;
final List<SubmissionGroup> submissionGroups = analysis.getSubmissionGroups();
if (!CollectionUtils.isEmpty(submissionGroups)) {
submissionGroups.forEach(submissionGroup -> submissionGroup.getSubmissions().forEach(submission -> {
final Set<ArachnePermission> submissionPermissions = getAllPermissions(submission, user);
submission.setPermissions(submissionPermissions);
}));
}
final List<AnalysisFile> files = analysis.getFiles();
if (!CollectionUtils.isEmpty(files)) {
files.forEach(file -> {
final Set<ArachnePermission> filePermissions = getAllPermissions(file, user);
file.setPermissions(filePermissions);
});
}
} else if (hasPermissionsObj instanceof Study) {
final Study study = (Study) hasPermissionsObj;
for (final Analysis analysis : study.getAnalyses()) {
analysis.setPermissions(getAllPermissions(analysis, user));
}
}
return true;
}
use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionServiceImpl method getResultFiles.
@Override
public List<ArachneFileMeta> getResultFiles(IUser user, Long submissionId, ResultFileSearch resultFileSearch) throws PermissionDeniedException {
Submission submission = submissionRepository.findById(submissionId, EntityUtils.fromAttributePaths("dataSource", "dataSource.dataNode")).get();
checkSubmissionPermission(user, submission);
String resultFilesPath = contentStorageHelper.getResultFilesDir(submission, resultFileSearch.getPath());
QuerySpec querySpec = new QuerySpec();
querySpec.setName(resultFileSearch.getRealName());
querySpec.setPath(resultFilesPath);
return contentStorageService.searchFiles(querySpec);
}
Aggregations