ATEST-81:
- correct build setup - add javadoc
This commit is contained in:
@ -31,7 +31,6 @@ applicationDefaultJvmArgs = [
|
||||
//}
|
||||
|
||||
dependencies {
|
||||
compile (project(':ch.psi.daq.cassandra'))
|
||||
compile (project(':ch.psi.daq.hazelcast'))
|
||||
compile 'org.springframework.boot:spring-boot-starter-web:1.2.4.RELEASE'
|
||||
compile 'com.google.code.gson:gson:2+'
|
||||
|
@ -38,12 +38,8 @@ public class DaqRestController {
|
||||
@Autowired
|
||||
private QueryProcessor queryProcessor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param query
|
||||
* @param res
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
|
||||
@RequestMapping(value = "/pulserange")
|
||||
public void pulseRange(@RequestBody PulseRangeQuery query, HttpServletResponse res) throws IOException {
|
||||
|
||||
@ -53,12 +49,6 @@ public class DaqRestController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param query
|
||||
* @param res
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value = "/timerange")
|
||||
public void timeRange(@RequestBody TimeRangeQuery query, HttpServletResponse res) throws IOException {
|
||||
|
||||
@ -67,12 +57,7 @@ public class DaqRestController {
|
||||
executeQuery(query, res);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param query
|
||||
* @param res
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
private void executeQuery(AbstractQuery query, HttpServletResponse res) throws IOException {
|
||||
|
||||
// all the magic happens here
|
||||
|
@ -9,6 +9,12 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
import ch.psi.daq.cassandra.reader.Ordering;
|
||||
import ch.psi.daq.hazelcast.query.Aggregation;
|
||||
import ch.psi.daq.hazelcast.query.AggregationType;
|
||||
@ -17,12 +23,6 @@ import ch.psi.daq.hazelcast.query.bin.BinningStrategy;
|
||||
import ch.psi.daq.hazelcast.query.bin.BinningStrategyFactory;
|
||||
import ch.psi.daq.hazelcast.query.range.QueryRange;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zellweger_c
|
||||
@ -60,12 +60,23 @@ public abstract class AbstractQuery implements Query {
|
||||
private QueryRange queryRange;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ordering whether to add a 'orderBy' clause into the database query
|
||||
* @param channels all the channelIds (channel names) we want to query
|
||||
* @param fields the fields (who map to fields in the DB) we are interested in returning to the
|
||||
* client, needs to be in insertion order (hence the {@link LinkedHashSet} type)
|
||||
* @param queryRange TODO
|
||||
* @param binningStrategyEnum enum that maps the user's String to a concrete
|
||||
* {@link BinningStrategy} implementation
|
||||
* @param binLengthOrCount depending on the chosen binning strategy, this field defines either the
|
||||
* count (how many pulse ids are to be put inside 1 bin) or the time frame for 1 bin
|
||||
* @param aggregateChannels whether aggregation will include all channels, default is on a
|
||||
* per-channel basis
|
||||
* @param aggregationType defines whether aggregation takes place in an index- or value-based
|
||||
* manner
|
||||
* @param aggregations list of aggregations / statistics to calculate, e.g. min, max and average
|
||||
* @param queryRange object containing the ranges for either pulse-based queries or time-based
|
||||
* queries
|
||||
*/
|
||||
@JsonCreator
|
||||
public AbstractQuery(
|
||||
@ -75,7 +86,7 @@ public abstract class AbstractQuery implements Query {
|
||||
@JsonProperty(value = "channels") List<String> channels,
|
||||
@JsonProperty(value = "fields") LinkedHashSet<String> fields,
|
||||
@JsonProperty(value = "binningStrategy") BinningStrategyEnum binningStrategyEnum,
|
||||
@JsonProperty(value = "binDuration") long lengthOrCount,
|
||||
@JsonProperty(value = "binDuration") long binLengthOrCount,
|
||||
@JsonProperty(value = "aggregateChannels") boolean aggregateChannels,
|
||||
@JsonProperty(value = "aggregationType") AggregationType aggregationType,
|
||||
@JsonProperty(value = "aggregations") List<Aggregation> aggregations,
|
||||
@ -93,23 +104,24 @@ public abstract class AbstractQuery implements Query {
|
||||
this.channels = channels;
|
||||
this.fields = fields;
|
||||
|
||||
this.binningStrategyEnum = binningStrategyEnum; // can be null: default then will be BinCountBinningStrategy
|
||||
this.binningStrategyEnum = binningStrategyEnum; // can be null: default then will be
|
||||
// BinCountBinningStrategy
|
||||
|
||||
|
||||
if (binningStrategyEnum != null) {
|
||||
switch (binningStrategyEnum) {
|
||||
case count:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binLengthOrCount);
|
||||
break;
|
||||
case length:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), lengthOrCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), binLengthOrCount);
|
||||
break;
|
||||
default:
|
||||
logger.warn("No binning strategy has been set. Selecting BinningStrategyBinCount.");
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binLengthOrCount);
|
||||
}
|
||||
} else {
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binLengthOrCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,6 +150,7 @@ public abstract class AbstractQuery implements Query {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAggregateChannels() {
|
||||
return aggregateChannels;
|
||||
}
|
||||
|
@ -3,21 +3,42 @@ package ch.psi.daq.rest.queries;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import ch.psi.daq.cassandra.reader.Ordering;
|
||||
import ch.psi.daq.hazelcast.query.Aggregation;
|
||||
import ch.psi.daq.hazelcast.query.AggregationType;
|
||||
import ch.psi.daq.hazelcast.query.bin.BinningStrategy;
|
||||
import ch.psi.daq.hazelcast.query.range.QueryRange;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class PulseRangeQuery extends AbstractQuery {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ordering whether to add a 'orderBy' clause into the database query
|
||||
* @param channels all the channelIds (channel names) we want to query
|
||||
* @param fields the fields (who map to fields in the DB) we are interested in returning to the
|
||||
* client, needs to be in insertion order (hence the {@link LinkedHashSet} type)
|
||||
* @param binningStrategyEnum enum that maps the user's String to a concrete
|
||||
* {@link BinningStrategy} implementation
|
||||
* @param binLengthOrCount depending on the chosen binning strategy, this field defines either the
|
||||
* count (how many pulse ids are to be put inside 1 bin) or the time frame for 1 bin
|
||||
* @param aggregateChannels whether aggregation will include all channels, default is on a
|
||||
* per-channel basis
|
||||
* @param aggregationType defines whether aggregation takes place in an index- or value-based
|
||||
* manner
|
||||
* @param aggregations list of aggregations / statistics to calculate, e.g. min, max and average
|
||||
* @param queryRange object containing the ranges for either pulse-based queries or time-based
|
||||
* queries
|
||||
*/
|
||||
@JsonCreator
|
||||
public PulseRangeQuery(
|
||||
// note that those annotations are needed for the polymorphic
|
||||
@ -26,13 +47,13 @@ public class PulseRangeQuery extends AbstractQuery {
|
||||
@JsonProperty(value = "channels") List<String> channels,
|
||||
@JsonProperty(value = "fields") LinkedHashSet<String> fields,
|
||||
@JsonProperty(value = "binningStrategy") BinningStrategyEnum binningStrategyEnum,
|
||||
@JsonProperty(value = "binDuration") long binDurationOrBinCount,
|
||||
@JsonProperty(value = "binDuration") long binLengthOrCount,
|
||||
@JsonProperty(value = "aggregateChannels") boolean aggregateChannels,
|
||||
@JsonProperty(value = "aggregationType") AggregationType aggregationType,
|
||||
@JsonProperty(value = "aggregations") List<Aggregation> aggregations,
|
||||
@JsonProperty(value = "queryRange") QueryRange queryRange) {
|
||||
|
||||
super(ordering, channels, fields, binningStrategyEnum, binDurationOrBinCount, aggregateChannels, aggregationType,
|
||||
super(ordering, channels, fields, binningStrategyEnum, binLengthOrCount, aggregateChannels, aggregationType,
|
||||
aggregations, queryRange);
|
||||
|
||||
}
|
||||
|
@ -6,18 +6,19 @@ import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import ch.psi.daq.cassandra.reader.Ordering;
|
||||
import ch.psi.daq.hazelcast.query.Aggregation;
|
||||
import ch.psi.daq.hazelcast.query.AggregationType;
|
||||
import ch.psi.daq.hazelcast.query.bin.BinningStrategy;
|
||||
import ch.psi.daq.hazelcast.query.range.QueryRange;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class TimeRangeQuery extends AbstractQuery {
|
||||
|
||||
|
||||
@ -26,19 +27,28 @@ public class TimeRangeQuery extends AbstractQuery {
|
||||
private static Logger logger = LoggerFactory.getLogger(TimeRangeQuery.class);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ordering whether to add a 'orderBy' clause into the database query
|
||||
* @param channelIds all the sourceIds (channel names) we want to query
|
||||
* @param channels all the channelIds (channel names) we want to query
|
||||
* @param fields the fields (who map to fields in the DB) we are interested in returning to the
|
||||
* client, needs to be in insertion order (hence the {@link LinkedHashSet} type)
|
||||
* @param binningStrategyEnum
|
||||
* @param binDurationOrBinCount
|
||||
* @param aggregateChannels
|
||||
* @param aggregationType
|
||||
* @param aggregations
|
||||
* @param queryRange
|
||||
* @param startDateTime
|
||||
* @param endDateTime
|
||||
* @param binningStrategyEnum enum that maps the user's String to a concrete
|
||||
* {@link BinningStrategy} implementation
|
||||
* @param binLengthOrCount depending on the chosen binning strategy, this field defines either the
|
||||
* count (how many pulse ids are to be put inside 1 bin) or the time frame for 1 bin
|
||||
* @param aggregateChannels whether aggregation will include all channels, default is on a
|
||||
* per-channel basis
|
||||
* @param aggregationType defines whether aggregation takes place in an index- or value-based
|
||||
* manner
|
||||
* @param aggregations list of aggregations / statistics to calculate, e.g. min, max and average
|
||||
* @param queryRange object containing the ranges for either pulse-based queries or time-based
|
||||
* queries
|
||||
* @param startDateTime if set, the date string (format is:
|
||||
* {@link TimeRangeQuery#DATE_FORMAT_STRING} will be parsed and converted into
|
||||
* milliseconds
|
||||
* @param endDateTime set, the date string (format is: {@link TimeRangeQuery#DATE_FORMAT_STRING}
|
||||
* will be parsed and converted into milliseconds
|
||||
*/
|
||||
@JsonCreator
|
||||
public TimeRangeQuery(
|
||||
@ -48,7 +58,7 @@ public class TimeRangeQuery extends AbstractQuery {
|
||||
@JsonProperty(value = "channels") List<String> channels,
|
||||
@JsonProperty(value = "fields") LinkedHashSet<String> fields,
|
||||
@JsonProperty(value = "binningStrategy") BinningStrategyEnum binningStrategyEnum,
|
||||
@JsonProperty(value = "binDuration") long binDurationOrBinCount,
|
||||
@JsonProperty(value = "binDuration") long binLengthOrCount,
|
||||
@JsonProperty(value = "aggregateChannels") boolean aggregateChannels,
|
||||
@JsonProperty(value = "aggregationType") AggregationType aggregationType,
|
||||
@JsonProperty(value = "aggregations") List<Aggregation> aggregations,
|
||||
@ -56,7 +66,8 @@ public class TimeRangeQuery extends AbstractQuery {
|
||||
@JsonProperty(value = "startDateTime") String startDateTime,
|
||||
@JsonProperty(value = "endDateTime") String endDateTime) {
|
||||
|
||||
super(ordering, channels, fields, binningStrategyEnum, binDurationOrBinCount, aggregateChannels, aggregationType, aggregations, queryRange);
|
||||
super(ordering, channels, fields, binningStrategyEnum, binLengthOrCount, aggregateChannels, aggregationType,
|
||||
aggregations, queryRange);
|
||||
|
||||
if (startDateTime != null && endDateTime != null) {
|
||||
logger.info("startDateTime and endDateTime specified. This takes precedence over the start / end fields.");
|
||||
@ -64,7 +75,8 @@ public class TimeRangeQuery extends AbstractQuery {
|
||||
Date startDate = DATE_FORMAT.parse(startDateTime);
|
||||
Date endDate = DATE_FORMAT.parse(endDateTime);
|
||||
|
||||
getQueryRange().setTimeRange(startDate.getTime(), queryRange.getStartNanos(), endDate.getTime(), queryRange.getEndNanos());
|
||||
getQueryRange().setTimeRange(startDate.getTime(), queryRange.getStartNanos(), endDate.getTime(),
|
||||
queryRange.getEndNanos());
|
||||
} catch (ParseException e) {
|
||||
logger.error("Parsing the start- and/or endDate was unsuccessful. "
|
||||
+ "The format must be '" + DATE_FORMAT_STRING + "'", e);
|
||||
|
Reference in New Issue
Block a user