use of springfox.documentation.annotations.ApiIgnore in project alien4cloud by alien4cloud.
the class SuggestionController method nodeTypeSuggest.
@ApiIgnore
@RequestMapping(value = "/nodetypes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<String[]> nodeTypeSuggest(@RequestParam("text") String searchText, @RequestParam(value = "isAbstract", required = false) Boolean isAbstract) {
if (searchText == null || searchText.trim().isEmpty()) {
return RestResponseBuilder.<String[]>builder().data(new String[0]).build();
}
searchText = StringUtils.lowerCase(searchText);
QueryBuilder queryOnText = QueryBuilders.regexpQuery("elementId", ".*?" + searchText + ".*");
// FIXME the way of getting the highest version of a component has changed
// QueryBuilder queryOnHighest = QueryBuilders.termQuery("highestVersion", true);
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery().must(queryOnText);
QueryBuilder query = boolQueryBuilder;
if (isAbstract != null) {
query = boolQueryBuilder.must(QueryBuilders.termQuery("abstract", isAbstract));
}
return RestResponseBuilder.<String[]>builder().data(dao.selectPath(dao.getIndexForType(NodeType.class), new String[] { MappingBuilder.indexTypeFromClass(NodeType.class) }, query, SortOrder.ASC, "elementId", 0, 10)).build();
}
use of springfox.documentation.annotations.ApiIgnore in project alien4cloud by alien4cloud.
the class EditorController method downloadTempFile.
/**
* Download a temporary file which is not yet commited (uploaded or modified through an operation).
*
* @param topologyId The if of the topology.
* @param artifactId The id of the temporary artifact.
* @return The response entity with the input stream of the file.
*/
@ApiIgnore
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/{topologyId:.+}/file/{artifactId:.+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<InputStreamResource> downloadTempFile(@PathVariable String topologyId, @PathVariable String artifactId) {
editorService.checkAuthorization(topologyId);
HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
long length = artifactRepository.getFileLength(artifactId);
return ResponseEntity.ok().headers(headers).contentLength(length).contentType(MediaType.parseMediaType("application/octet-stream")).body(new InputStreamResource(artifactRepository.getFile(artifactId)));
}
use of springfox.documentation.annotations.ApiIgnore in project alien4cloud by alien4cloud.
the class EditorController method upload.
/**
* Method exposed to REST to upload a file in an archive under edition.
*
* @param topologyId The id of the topology/archive under edition.
* @param lastOperationId The id of the user last known operation (for optimistic locking edition).
* @param path The path in which to save/override the file in the archive.
* @param file The file to save in the archive.
*/
@ApiIgnore
@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/{topologyId:.+}/upload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public RestResponse<TopologyDTO> upload(@PathVariable String topologyId, @RequestParam("lastOperationId") String lastOperationId, @RequestParam("path") String path, @RequestParam(value = "file") MultipartFile file) throws IOException {
if (lastOperationId != null && "null".equals(lastOperationId)) {
lastOperationId = null;
}
try (InputStream artifactStream = file.getInputStream()) {
UpdateFileOperation updateFileOperation = new UpdateFileOperation(path, artifactStream);
updateFileOperation.setPreviousOperationId(lastOperationId);
TopologyDTO topologyDTO = editorService.execute(topologyId, updateFileOperation);
return RestResponseBuilder.<TopologyDTO>builder().data(topologyDTO).build();
}
}
use of springfox.documentation.annotations.ApiIgnore in project alien4cloud by alien4cloud.
the class SuggestionController method tagSuggest.
/**
* Get suggestion for tags based on current tags defined on the components.
*
* @param tagName The name of the tag for which to get suggestion.
* @param searchPrefix The current prefix for the tag suggestion.
* @return A {@link RestResponse} that contains a list of suggestions for the tag key.
*/
@ApiIgnore
@RequestMapping(value = "/tag/{tagName}/{searchPrefix}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<String[]> tagSuggest(@PathVariable String tagName, @PathVariable String searchPrefix) {
String suggestFieldPath = TAG_FIELD.concat(".").concat(tagName);
GetMultipleDataResult searchResult = dao.suggestSearch(INDEXES, CLASSES, suggestFieldPath, searchPrefix, FetchContext.TAG_SUGGESTION, 0, SUGGESTION_COUNT);
String[] types = searchResult.getTypes();
Set<String> tagsSuggestions = Sets.newHashSet();
for (int i = 0; i < types.length; i++) {
List<Tag> tags;
if (types[i].equals(MappingBuilder.indexTypeFromClass(Application.class))) {
Application app = (Application) searchResult.getData()[i];
tags = app.getTags();
} else {
AbstractToscaType indexedToscaElement = (AbstractToscaType) searchResult.getData()[i];
tags = indexedToscaElement.getTags();
}
addSuggestedTag(tags, tagName, searchPrefix, tagsSuggestions);
}
return RestResponseBuilder.<String[]>builder().data(tagsSuggestions.toArray(new String[tagsSuggestions.size()])).build();
}
Aggregations