Search in sources :

Example 1 with CommentTopicDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO 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 2 with CommentTopicDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO in project ArachneCentralAPI by OHDSI.

the class CommentTopicToCommentTopicDTOConverter method convert.

@Override
public CommentTopicDTO convert(CommentTopic source) {
    final CommentTopicDTO commentTopicDTO = new CommentTopicDTO();
    final List<CommentDTO> commentDTOS = source.getComments().stream().map(c -> conversionService.convert(c, CommentDTO.class)).collect(Collectors.toList());
    commentTopicDTO.setId(source.getId());
    commentTopicDTO.setComments(commentDTOS);
    return commentTopicDTO;
}
Also used : List(java.util.List) Component(org.springframework.stereotype.Component) CommentTopic(com.odysseusinc.arachne.portal.model.CommentTopic) CommentTopicDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) BaseConversionServiceAwareConverter(com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) CommentDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentDTO) Collectors(java.util.stream.Collectors) CommentTopicDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO) CommentDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentDTO)

Aggregations

CommentTopicDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentTopicDTO)2 CommentTopic (com.odysseusinc.arachne.portal.model.CommentTopic)2 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 CommentDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentDTO)1 BaseConversionServiceAwareConverter (com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter)1 ApiOperation (io.swagger.annotations.ApiOperation)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)1 Component (org.springframework.stereotype.Component)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1