use of com.odysseusinc.arachne.portal.model.DataNode in project ArachneCentralAPI by OHDSI.
the class BaseStudyServiceImpl method addVirtualDataSource.
@Override
@Transactional
@PreAuthorize("hasPermission(#studyId, 'Study', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).INVITE_DATANODE)")
public DS addVirtualDataSource(IUser createdBy, Long studyId, String dataSourceName, List<String> dataOwnerIds) throws NotExistException, AlreadyExistException, NoSuchFieldException, IOException, ValidationException, FieldException, IllegalAccessException, SolrServerException {
Study study = studyRepository.findOne(studyId);
List<IUser> dataNodeOwners = validateVirtualDataSourceOwners(study, dataOwnerIds);
final DataNode dataNode = studyHelper.getVirtualDataNode(study.getTitle(), dataSourceName);
final DataNode registeredDataNode = baseDataNodeService.create(dataNode);
final Set<DataNodeUser> dataNodeUsers = updateDataNodeOwners(dataNodeOwners, registeredDataNode);
registeredDataNode.setDataNodeUsers(dataNodeUsers);
final DS dataSource = studyHelper.getVirtualDataSource(registeredDataNode, dataSourceName);
dataSource.setHealthStatus(CommonHealthStatus.GREEN);
dataSource.setHealthStatusDescription("Virtual DataSources are always GREEN");
dataSource.getTenants().add(study.getTenant());
final DS registeredDataSource = dataSourceService.createOrRestoreDataSource(dataSource);
addDataSource(createdBy, studyId, registeredDataSource.getId());
return registeredDataSource;
}
use of com.odysseusinc.arachne.portal.model.DataNode in project ArachneCentralAPI by OHDSI.
the class BaseStudyServiceImpl method updateVirtualDataSource.
@Override
@Transactional
@PreAuthorize("hasPermission(#dataSourceId, 'DataSource', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).DELETE_DATASOURCE)")
public DS updateVirtualDataSource(IUser user, Long studyId, Long dataSourceId, String name, List<String> dataOwnerIds) throws IllegalAccessException, IOException, NoSuchFieldException, SolrServerException, ValidationException {
Study study = studyRepository.findOne(studyId);
List<IUser> dataOwners = validateVirtualDataSourceOwners(study, dataOwnerIds);
final DS dataSource = getStudyDataSource(user, studyId, dataSourceId);
final DataNode dataNode = dataSource.getDataNode();
updateDataNodeOwners(dataOwners, dataNode);
dataSource.setName(name);
final DS update = dataSourceService.updateInAnyTenant(dataSource);
return dataSource;
}
use of com.odysseusinc.arachne.portal.model.DataNode in project ArachneCentralAPI by OHDSI.
the class BaseArachneSecureServiceImpl method getRolesBySubmission.
@Override
public List<ParticipantRole> getRolesBySubmission(ArachneUser user, Submission submission) {
List<ParticipantRole> result = new LinkedList<>();
if (submission != null) {
Analysis analysis = submission.getSubmissionGroup().getAnalysis();
result = getRolesByAnalysis(user, analysis);
final DataNode dataNode = submission.getDataSource().getDataNode();
if (!DataNodeUtils.isDataNodeOwner(dataNode, user.getId())) {
// There can be many DATA_SET_OWNER-s in a single study, owning different data sources
// But in case of Submission, we are interested, whether current user is owner of the submission's DS
result.removeIf(ParticipantRole.DATA_SET_OWNER::equals);
}
}
return result;
}
use of com.odysseusinc.arachne.portal.model.DataNode in project ArachneCentralAPI by OHDSI.
the class BaseUserController method linkUserToDataNode.
@ApiOperation("Link U to DataNode")
@RequestMapping(value = "/api/v1/user-management/datanodes/{datanodeSid}/users", method = POST)
public JsonResult linkUserToDataNode(@PathVariable("datanodeSid") Long datanodeId, @RequestBody CommonLinkUserToDataNodeDTO linkUserToDataNode) throws NotExistException, AlreadyExistException {
final DN dataNode = Optional.ofNullable(baseDataNodeService.getById(datanodeId)).orElseThrow(() -> new NotExistException(String.format(DATA_NODE_NOT_FOUND_EXCEPTION, datanodeId), DataNode.class));
final U user = userService.getByUnverifiedEmailInAnyTenant(linkUserToDataNode.getUserName());
baseDataNodeService.linkUserToDataNode(dataNode, user);
return new JsonResult(NO_ERROR);
}
use of com.odysseusinc.arachne.portal.model.DataNode in project ArachneCentralAPI by OHDSI.
the class CommonDataNodeRegisterDTOToDataNodeConverter method convert.
@Override
public DataNode convert(CommonDataNodeRegisterDTO source) {
DataNode dataNode = new DataNode();
dataNode.setName(source.getName());
dataNode.setDescription(source.getDescription());
dataNode.setVirtual(false);
dataNode.setPublished(true);
return dataNode;
}
Aggregations