@GET @Path("/{name}/{version}") @ApiOperation( value = "Documents by name and version", notes = "Documents always have a name and a version", response = DocumentDTO.class, responseContainer = "List") public List<DocumentDTO> documentByNameAndVersion( @ApiParam(value = "Name of documents to fetch", required = true) @PathParam("name") String name, @ApiParam(value = "Version of named documents", required = true) @PathParam("version") String version, @ApiParam(value = "Whether to re-index document", required = false, defaultValue = "false") @DefaultValue("false") @QueryParam("reindex") boolean reindex) { List<Document> documents = documentRepository.findDocumentsByNameAndVersion(name, version); if (reindex) { documents.stream().forEach(document -> documentationService.reindexDocument(document)); } return documents .stream() .map(Transformations::convertDocumentToDTO) .collect(Collectors.toList()); }
@GET @Path("/{name}/{version}/documentation") @ApiOperation( value = "Documentation for specific documents", notes = "Gets all documentation in all documents with matching name and version", response = DocumentationItemDTO.class, responseContainer = "List") public List<DocumentationItemDTO> documentationByNameAndVersion( @ApiParam(value = "Name of documents to fetch", required = true) @PathParam("name") String name, @ApiParam(value = "Version of named documents", required = true) @PathParam("version") String version, @ApiParam(value = "Max number of results", required = false, defaultValue = "50") @DefaultValue("50") @QueryParam("maxResults") int maxResults, @ApiParam(value = "Search Term for documentation", required = false) @DefaultValue("") @QueryParam("searchTerm") String searchTerm) { List<Document> docs = documentRepository.findDocumentsByNameAndVersion(name, version); return getDocumentation(docs, searchTerm, maxResults); }