[New] Added a DataRange parameter selection
This commit is contained in:
parent
c246c76236
commit
16db0e357e
|
@ -18,6 +18,8 @@ package li.strolch.model.query;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import ch.eitchnet.utils.dbc.DBC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*/
|
*/
|
||||||
|
@ -92,6 +94,10 @@ public abstract class ParameterSelection implements Selection {
|
||||||
return new DateParameterSelection(bagKey, paramKey, value);
|
return new DateParameterSelection(bagKey, paramKey, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DateRangeParameterSelection dateRangeSelection(String bagKey, String paramKey, Date from, Date to) {
|
||||||
|
return new DateRangeParameterSelection(bagKey, paramKey, from, to);
|
||||||
|
}
|
||||||
|
|
||||||
public static StringListParameterSelection stringListSelection(String bagKey, String paramKey, List<String> value) {
|
public static StringListParameterSelection stringListSelection(String bagKey, String paramKey, List<String> value) {
|
||||||
return new StringListParameterSelection(bagKey, paramKey, value);
|
return new StringListParameterSelection(bagKey, paramKey, value);
|
||||||
}
|
}
|
||||||
|
@ -230,6 +236,32 @@ public abstract class ParameterSelection implements Selection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class DateRangeParameterSelection extends ParameterSelection {
|
||||||
|
|
||||||
|
private Date from;
|
||||||
|
private Date to;
|
||||||
|
|
||||||
|
public DateRangeParameterSelection(String bagKey, String paramKey, Date from, Date to) {
|
||||||
|
super(bagKey, paramKey);
|
||||||
|
DBC.PRE.assertFalse("Either 'to' or 'from' must be set! Both can not be null!", from == null && to == null);
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFrom() {
|
||||||
|
return this.from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTo() {
|
||||||
|
return this.to;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(ParameterSelectionVisitor visitor) {
|
||||||
|
visitor.visit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class StringListParameterSelection extends ParameterSelection {
|
public static class StringListParameterSelection extends ParameterSelection {
|
||||||
|
|
||||||
private List<String> value;
|
private List<String> value;
|
||||||
|
|
|
@ -17,6 +17,7 @@ package li.strolch.model.query;
|
||||||
|
|
||||||
import li.strolch.model.query.ParameterSelection.BooleanParameterSelection;
|
import li.strolch.model.query.ParameterSelection.BooleanParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.DateParameterSelection;
|
import li.strolch.model.query.ParameterSelection.DateParameterSelection;
|
||||||
|
import li.strolch.model.query.ParameterSelection.DateRangeParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.FloatParameterSelection;
|
import li.strolch.model.query.ParameterSelection.FloatParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.IntegerParameterSelection;
|
import li.strolch.model.query.ParameterSelection.IntegerParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.LongParameterSelection;
|
import li.strolch.model.query.ParameterSelection.LongParameterSelection;
|
||||||
|
@ -25,7 +26,6 @@ import li.strolch.model.query.ParameterSelection.StringParameterSelection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ParameterSelectionVisitor extends QueryVisitor {
|
public interface ParameterSelectionVisitor extends QueryVisitor {
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ public interface ParameterSelectionVisitor extends QueryVisitor {
|
||||||
public void visit(FloatParameterSelection selection);
|
public void visit(FloatParameterSelection selection);
|
||||||
|
|
||||||
public void visit(DateParameterSelection selection);
|
public void visit(DateParameterSelection selection);
|
||||||
|
|
||||||
|
public void visit(DateRangeParameterSelection selection);
|
||||||
|
|
||||||
public void visit(StringListParameterSelection selection);
|
public void visit(StringListParameterSelection selection);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue