Search in sources :

Example 26 with NO_ERROR

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR in project ArachneCentralAPI by OHDSI.

the class BaseDataSourceController method list.

@RequestMapping(value = "/api/v1/data-sources", method = RequestMethod.GET)
public JsonResult<R> list(Principal principal, @ModelAttribute SearchDataCatalogDTO searchDTO) throws IOException, SolrServerException, PermissionDeniedException, NoSuchFieldException {
    final IUser user = getUser(principal);
    SolrQuery solrQuery = conversionService.convert(searchDTO, SolrQuery.class);
    SearchResult<DS> searchResult = dataSourceService.search(solrQuery, user);
    return new JsonResult<>(NO_ERROR, conversionService.convert(searchResult, getSearchResultClass()));
}
Also used : IUser(com.odysseusinc.arachne.portal.model.IUser) SolrQuery(org.apache.solr.client.solrj.SolrQuery) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 27 with NO_ERROR

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR in project ArachneCentralAPI by OHDSI.

the class BaseStudyController method updateFavourite.

@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/favourite", method = PUT)
public JsonResult updateFavourite(@PathVariable("studyId") Long studyId, @RequestBody BooleanDTO isFavourite, Principal principal) throws PermissionDeniedException, NotExistException, NotUniqueException, ValidationException {
    final IUser user = getUser(principal);
    studyService.setFavourite(user.getId(), studyId, isFavourite.isValue());
    return new JsonResult<>(NO_ERROR);
}
Also used : IUser(com.odysseusinc.arachne.portal.model.IUser) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 28 with NO_ERROR

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR in project ArachneCentralAPI by OHDSI.

the class BaseStudyController method updateParticipantRole.

@ApiOperation("Update participant.")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/participants/{userUuid}", method = PUT)
public JsonResult<Boolean> updateParticipantRole(@PathVariable("studyId") Long studyId, @PathVariable("userUuid") String userUuid, @RequestBody @Valid UpdateParticipantDTO participantDTO) throws NotExistException, AlreadyExistException, ValidationException {
    if (participantDTO.getRole() != null) {
        ParticipantRole newRole = ParticipantRole.valueOf(participantDTO.getRole());
        studyService.updateParticipantRole(studyId, UserIdUtils.uuidToId(userUuid), newRole);
    }
    return new JsonResult<>(NO_ERROR, Boolean.TRUE);
}
Also used : JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ParticipantRole(com.odysseusinc.arachne.portal.model.ParticipantRole) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 29 with NO_ERROR

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR in project ArachneCentralAPI by OHDSI.

the class BaseStudyController method createVirtualDataSource.

@ApiOperation("Create virtual data source linked to study")
@RequestMapping(value = "/api/v1/study-management/studies/{studyId}/data-sources", method = POST)
public JsonResult<DataSourceDTO> createVirtualDataSource(Principal principal, @PathVariable("studyId") Long studyId, @RequestBody @Valid CreateVirtualDataSourceDTO dataSourceDTO) throws PermissionDeniedException, NotExistException, IllegalAccessException, SolrServerException, IOException, ValidationException, FieldException, AlreadyExistException, NoSuchFieldException {
    final IUser createdBy = getUser(principal);
    final IDataSource dataSource = studyService.addVirtualDataSource(createdBy, studyId, dataSourceDTO.getName(), dataSourceDTO.getDataOwnersIds());
    final DataSourceDTO registeredDataSourceDTO = conversionService.convert(dataSource, DataSourceDTO.class);
    return new JsonResult<>(NO_ERROR, registeredDataSourceDTO);
}
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 30 with NO_ERROR

use of com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR in project ArachneCentralAPI by OHDSI.

the class CommentController method addComment.

@ApiOperation(value = "Add new comment")
@RequestMapping(value = "/api/v1/comments/{topicId}", method = RequestMethod.POST)
public JsonResult<CommentDTO> addComment(@PathVariable("topicId") Long topicId, @Validated @RequestBody CommentDTO commentDTO, Principal principal) throws PermissionDeniedException {
    final IUser user = getUser(principal);
    final Comment comment = conversionService.convert(commentDTO, Comment.class);
    comment.setAuthor(user);
    final Comment saved = commentService.addComment(topicId, commentDTO.getParentId(), comment);
    JsonResult<CommentDTO> result = new JsonResult<>(NO_ERROR);
    result.setResult(conversionService.convert(saved, CommentDTO.class));
    return result;
}
Also used : Comment(com.odysseusinc.arachne.portal.model.Comment) IUser(com.odysseusinc.arachne.portal.model.IUser) CommentDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)34 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)33 ApiOperation (io.swagger.annotations.ApiOperation)31 IUser (com.odysseusinc.arachne.portal.model.IUser)18 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 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)6 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)5 SubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO)5 UploadFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO)5 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)5 PERMISSION_DENIED (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.PERMISSION_DENIED)4 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)4 ResultFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO)4 SubmissionInsightDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO)4 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)4 ValidationException (com.odysseusinc.arachne.portal.exception.ValidationException)4 DataNode (com.odysseusinc.arachne.portal.model.DataNode)4 Submission (com.odysseusinc.arachne.portal.model.Submission)4