make computation of mean value optional
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package org.lucares.pdbui;
|
||||
|
||||
import org.lucares.pdb.plot.api.AggreateInternal;
|
||||
import org.lucares.pdb.plot.api.AxisScale;
|
||||
import org.lucares.pdb.plot.api.Limit;
|
||||
import org.lucares.pdb.plot.api.PlotSettings;
|
||||
import org.lucares.pdbui.domain.Aggregate;
|
||||
import org.lucares.pdbui.domain.LimitBy;
|
||||
import org.lucares.pdbui.domain.PlotRequest;
|
||||
import org.lucares.pdbui.domain.YAxis;
|
||||
@@ -21,10 +23,19 @@ class PlotSettingsTransformer {
|
||||
result.setDateFrom(request.getDateFrom());
|
||||
result.setDateRange(request.getDateRange());
|
||||
result.setYAxisScale(toAxisScale(request.getAxisScale()));
|
||||
result.setAggregate(toAggregateInternal(request.getAggregate()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static AggreateInternal toAggregateInternal(Aggregate aggregate) {
|
||||
switch (aggregate) {
|
||||
case NONE:return AggreateInternal.NONE;
|
||||
case MEAN:return AggreateInternal.MEAN;
|
||||
}
|
||||
throw new IllegalStateException("unhandled enum: " + aggregate);
|
||||
}
|
||||
|
||||
private static AxisScale toAxisScale(final YAxis yAxis) {
|
||||
switch (yAxis) {
|
||||
case LINEAR:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
public enum Aggregate {
|
||||
NONE, MEAN
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public class PlotRequest {
|
||||
private String dateFrom;
|
||||
|
||||
private String dateRange;
|
||||
|
||||
private Aggregate aggregate = Aggregate.NONE;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
@@ -100,4 +102,12 @@ public class PlotRequest {
|
||||
public void setAxisScale(final YAxis yAxis) {
|
||||
this.yAxis = yAxis;
|
||||
}
|
||||
|
||||
public void setAggregate(Aggregate aggregate) {
|
||||
this.aggregate = aggregate;
|
||||
}
|
||||
|
||||
public Aggregate getAggregate() {
|
||||
return aggregate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user