From 79730c0bf5d5fbe83204e52e73b4bf47964c5a2d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 13 Feb 2022 17:01:56 -0800 Subject: Implement new storage framework --- .../java/org/traccar/storage/query/Condition.java | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/main/java/org/traccar/storage/query/Condition.java (limited to 'src/main/java/org/traccar/storage/query/Condition.java') diff --git a/src/main/java/org/traccar/storage/query/Condition.java b/src/main/java/org/traccar/storage/query/Condition.java new file mode 100644 index 000000000..50d520bc7 --- /dev/null +++ b/src/main/java/org/traccar/storage/query/Condition.java @@ -0,0 +1,83 @@ +package org.traccar.storage.query; + +public interface Condition { + + class Equals implements Condition { + private final String column; + private final String variable; + private final Object value; + + public Equals(String column, String variable, Object value) { + this.column = column; + this.variable = variable; + this.value = value; + } + + public String getColumn() { + return column; + } + + public String getVariable() { + return variable; + } + + public Object getValue() { + return value; + } + } + + class Between implements Condition { + private final String column; + private final String fromVariable; + private final Object fromValue; + private final String toVariable; + private final Object toValue; + + public Between(String column, String fromVariable, Object fromValue, String toVariable, Object toValue) { + this.column = column; + this.fromVariable = fromVariable; + this.fromValue = fromValue; + this.toVariable = toVariable; + this.toValue = toValue; + } + + public String getColumn() { + return column; + } + + public String getFromVariable() { + return fromVariable; + } + + public Object getFromValue() { + return fromValue; + } + + public String getToVariable() { + return toVariable; + } + + public Object getToValue() { + return toValue; + } + } + + class And implements Condition { + private final Condition first; + private final Condition second; + + public And(Condition first, Condition second) { + this.first = first; + this.second = second; + } + + public Condition getFirst() { + return first; + } + + public Condition getSecond() { + return second; + } + } + +} -- cgit v1.2.3