Reformatting.

This commit is contained in:
Fabian Märki
2015-10-21 10:01:00 +02:00
parent c894bb5939
commit a61fddf699

View File

@ -81,7 +81,8 @@ public class QueryRestController {
}
}
@RequestMapping(value = CHANNELS, method = { RequestMethod.GET, RequestMethod.POST }, produces = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = CHANNELS, method = {RequestMethod.GET, RequestMethod.POST},
produces = {MediaType.APPLICATION_JSON_VALUE})
public @ResponseBody Collection<String> getChannels(@RequestBody(required = false) ChannelsRequest request)
throws Throwable {
// in case not specified use default (e.g. GET)
@ -102,37 +103,29 @@ public class QueryRestController {
/**
* Query specific channel names, and return only those.
*
* @param channelName
* part of (or full) channel name
* @return Collection of channel names matching the specified input channel
* name
* @param channelName part of (or full) channel name
* @return Collection of channel names matching the specified input channel name
*/
@RequestMapping(value = CHANNELS + "/{channelName}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public @ResponseBody Collection<String> getChannels(@PathVariable(value = "channelName") String channelName) {
ChannelsRequest request = new ChannelsRequest(channelName);
Collection<String> specificChannels = getQueryProcessor(request.getDbMode()).getChannels(request.getRegex());
return specificChannels;
@RequestMapping(value = CHANNELS + "/{channelName}", method = {RequestMethod.GET},
produces = {MediaType.APPLICATION_JSON_VALUE})
public @ResponseBody Collection<String> getChannels(@PathVariable(value = "channelName") String channelName)
throws Throwable {
return getChannels(new ChannelsRequest(channelName));
}
/**
* Catch-all query method for getting data from the backend.
* <p>
* The {@link AbstractQuery} object will be a concrete subclass based on the
* combination of fields defined in the user's query. The
* {@link AttributeBasedDeserializer} decides which class to deserialize the
* information into and has been configured (see
* The {@link AbstractQuery} object will be a concrete subclass based on the combination of
* fields defined in the user's query. The {@link AttributeBasedDeserializer} decides which class
* to deserialize the information into and has been configured (see
* QueryRestConfig#afterPropertiesSet) accordingly.
*
* @param query
* concrete implementation of {@link AbstractQuery}
* @param res
* the {@link HttpServletResponse} instance associated with this
* request
* @throws IOException
* thrown if writing to the output stream fails
* @param query concrete implementation of {@link AbstractQuery}
* @param res the {@link HttpServletResponse} instance associated with this request
* @throws IOException thrown if writing to the output stream fails
*/
@RequestMapping(value = QUERY, method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = QUERY, method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE})
public void executeQuery(@RequestBody @Valid AbstractQuery query, HttpServletResponse res) throws IOException {
try {
LOGGER.debug("Executing query '{}'", query.toString());
@ -179,11 +172,11 @@ public class QueryRestController {
@RequestMapping(value = "/write")
public void writeDummyEntry() {
long nrOfElements = 4;
cassandraDataGen.writeData(3, 0, 4, i -> i, i -> 0, i -> i, i -> i, i -> 0, i -> new long[] { i, i, i, i },
cassandraDataGen.writeData(3, 0, 4, i -> i, i -> 0, i -> i, i -> i, i -> 0, i -> new long[] {i, i, i, i},
"TRFCA-channel1");
cassandraDataGen.writeData(3, 0, 4, i -> i, i -> 0, i -> i, i -> i, i -> 0, i -> new long[] { nrOfElements - i,
nrOfElements - i, nrOfElements - i, nrOfElements - i }, "TRFCA-channel2");
cassandraDataGen.writeData(3, 0, 4, i -> i, i -> 0, i -> i, i -> i, i -> 0, i -> new long[] {nrOfElements - i,
nrOfElements - i, nrOfElements - i, nrOfElements - i}, "TRFCA-channel2");
cassandraDataGen.writeData(3, 0, 4, i -> i, i -> 0, i -> i, i -> i, i -> 0, i -> i, "TRFCB-channel3");