Search in sources :

Example 16 with JsonResult

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);
}
Also used : IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with JsonResult

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));
}
Also used : DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) CreateVirtualDataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) IDataSource(com.odysseusinc.arachne.portal.model.IDataSource) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with JsonResult

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;
}
Also used : CommentTopicDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO) CommentTopic(com.odysseusinc.arachne.portal.model.CommentTopic) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with JsonResult

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;
}
Also used : ExpertListSearchResultDTO(com.odysseusinc.arachne.portal.api.v1.dto.ExpertListSearchResultDTO) SearchResult(com.odysseusinc.arachne.portal.service.impl.solr.SearchResult) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) SolrQuery(org.apache.solr.client.solrj.SolrQuery) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with JsonResult

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;
}
Also used : CommonUserDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonUserDTO) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)71 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)58 ApiOperation (io.swagger.annotations.ApiOperation)55 IUser (com.odysseusinc.arachne.portal.model.IUser)22 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)17 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)17 ResponseEntity (org.springframework.http.ResponseEntity)16 GET (org.springframework.web.bind.annotation.RequestMethod.GET)10 POST (org.springframework.web.bind.annotation.RequestMethod.POST)10 PUT (org.springframework.web.bind.annotation.RequestMethod.PUT)10 NotUniqueException (com.odysseusinc.arachne.portal.exception.NotUniqueException)6 FieldError (org.springframework.validation.FieldError)6 PermissionDeniedException (com.odysseusinc.arachne.portal.exception.PermissionDeniedException)5 ValidationException (com.odysseusinc.arachne.portal.exception.ValidationException)5 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)5 DataNode (com.odysseusinc.arachne.portal.model.DataNode)5 IOException (java.io.IOException)5 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)4 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)4 SubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO)4