use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.
the class BaseStudyController method list.
@ApiOperation("List studies.")
@RequestMapping(value = "/api/v1/study-management/studies", method = GET)
public JsonResult<Page<SL>> list(Principal principal, SS studySearch) throws PermissionDeniedException {
handleInputSearchParams(studySearch);
final IUser user = getUser(principal);
studySearch.setUserId(user.getId());
Page<SL> converted = studyService.findStudies(studySearch).map(this::convertListItem);
return new JsonResult<>(NO_ERROR, converted);
}
use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.
the class BaseStudyController method updateDataSource.
@ApiOperation("Update data source linked to study")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/data-sources/{dataSourceId}", method = PUT)
public JsonResult<DataSourceDTO> updateDataSource(Principal principal, @PathVariable("studyId") Long studyId, @PathVariable("dataSourceId") Long dataSourceId, @RequestBody @Valid CreateVirtualDataSourceDTO dataSourceDTO) throws PermissionDeniedException, ValidationException, IOException, NoSuchFieldException, SolrServerException, IllegalAccessException {
final IUser user = getUser(principal);
IDataSource dataSource = studyService.updateVirtualDataSource(user, studyId, dataSourceId, dataSourceDTO.getName(), dataSourceDTO.getDataOwnersIds());
return new JsonResult<>(NO_ERROR, conversionService.convert(dataSource, DataSourceDTO.class));
}
use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.
the class CommentController method get.
@ApiOperation(value = "Get topic with all comments")
@RequestMapping(value = "/api/v1/comments/{topicId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = RequestMethod.GET)
public JsonResult<CommentTopicDTO> get(@PathVariable("topicId") Long topicId) throws NotExistException {
final CommentTopic topic = commentService.getTopic(topicId);
JsonResult<CommentTopicDTO> result = new JsonResult<>(NO_ERROR);
result.setResult(conversionService.convert(topic, CommentTopicDTO.class));
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.
the class BaseExpertFinderController method list.
@ApiOperation("Get expert list")
@RequestMapping(value = "/api/v1/user-management/users", method = GET)
public JsonResult<ExpertListSearchResultDTO> list(@ModelAttribute SearchExpertListDTO searchDTO) throws IOException, SolrServerException, NoSuchFieldException {
JsonResult result = new JsonResult<ExpertListSearchResultDTO>(NO_ERROR);
SolrQuery solrQuery = conversionService.convert(searchDTO, SolrQuery.class);
SearchResult searchResult = userService.search(solrQuery);
result.setResult(this.conversionService.convert(searchResult, ExpertListSearchResultDTO.class));
return result;
}
use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult in project ArachneCentralAPI by OHDSI.
the class BaseExpertFinderController method get.
@ApiOperation("Get user by id")
@RequestMapping(value = "/api/v1/user-management/users/{id}", method = GET)
public JsonResult<CommonUserDTO> get(@PathVariable("id") Long id) {
JsonResult<CommonUserDTO> result;
U user = userService.getByIdInAnyTenant(id);
CommonUserDTO userDTO = conversionService.convert(user, CommonUserDTO.class);
result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR);
result.setResult(userDTO);
return result;
}
Aggregations