use of org.graylog.plugins.views.search.export.ResultFormat in project graylog2-server by Graylog2.
the class MessagesResource method retrieveForSearch.
@ApiOperation(value = "Export a search result as CSV")
@POST
@Path("{searchId}")
@Produces(MoreMediaTypes.TEXT_CSV)
@NoAuditEvent("Has custom audit events")
public ChunkedOutput<SimpleMessageChunk> retrieveForSearch(@ApiParam(value = "ID of an existing Search", name = "searchId") @PathParam("searchId") String searchId, @ApiParam(value = "Optional overrides") @Valid ResultFormat formatFromClient, @Context SearchUser searchUser) {
ResultFormat format = fillInIfNecessary(emptyIfNull(formatFromClient), searchUser);
Search search = loadSearch(searchId, format.executionState(), searchUser);
ExportMessagesCommand command = commandFactory.buildWithSearchOnly(search, format);
return asyncRunner.apply(chunkConsumer -> exporter(searchId).export(command, chunkConsumer));
}
use of org.graylog.plugins.views.search.export.ResultFormat in project graylog2-server by Graylog2.
the class MessagesResource method retrieveForSearchType.
@ApiOperation(value = "Export a message table as CSV")
@POST
@Path("{searchId}/{searchTypeId}")
@NoAuditEvent("Has custom audit events")
public ChunkedOutput<SimpleMessageChunk> retrieveForSearchType(@ApiParam(value = "ID of an existing Search", name = "searchId") @PathParam("searchId") String searchId, @ApiParam(value = "ID of a Message Table contained in the Search", name = "searchTypeId") @PathParam("searchTypeId") String searchTypeId, @ApiParam(value = "Optional overrides") @Valid ResultFormat formatFromClient, @Context SearchUser searchUser) {
ResultFormat format = fillInIfNecessary(emptyIfNull(formatFromClient), searchUser);
Search search = loadSearch(searchId, format.executionState(), searchUser);
ExportMessagesCommand command = commandFactory.buildWithMessageList(search, searchTypeId, format);
return asyncRunner.apply(chunkConsumer -> exporter(searchId, searchTypeId).export(command, chunkConsumer));
}
Aggregations