org.neogroup.warp.data.query.conditions.ConditionGroup Maven / Gradle / Ivy
package org.neogroup.warp.data.query.conditions;
import org.neogroup.warp.data.query.fields.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ConditionGroup extends Condition {
private List conditions;
private ConditionGroupConnector connector;
public ConditionGroup() {
this(ConditionGroupConnector.AND);
}
public ConditionGroup(ConditionGroupConnector connector) {
conditions = new ArrayList<>();
this.connector = connector;
}
public ConditionGroupConnector getConnector() {
return connector;
}
public void setConnector(ConditionGroupConnector connector) {
this.connector = connector;
}
public List getConditions() {
return conditions;
}
public ConditionGroup clearConditions() {
conditions.clear();
return this;
}
public boolean isEmpty() {
return conditions.isEmpty();
}
public ConditionGroup addCondition(Condition condition) {
conditions.add(condition);
return this;
}
public ConditionGroup on(String field, Object value) {
return addCondition(new BasicCondition(field, value));
}
public ConditionGroup on(Field field, Object value) {
return addCondition(new BasicCondition(field, value));
}
public ConditionGroup on(String field, ConditionOperator operator, Object value) {
return addCondition(new BasicCondition(field, operator, value));
}
public ConditionGroup on(Field field, ConditionOperator operator, Object value) {
return addCondition(new BasicCondition(field, operator, value));
}
public ConditionGroup onGroup(ConditionGroup condition) {
return addCondition(condition);
}
public ConditionGroup onRaw(RawCondition condition) {
return addCondition(condition);
}
public ConditionGroup onField(String field1, String field2) {
return onField(new Field(field1), ConditionOperator.EQUALS, new Field(field2));
}
public ConditionGroup onField(Field field1, Field field2) {
return onField(field1, ConditionOperator.EQUALS, field2);
}
public ConditionGroup onField(String field1, ConditionOperator operator, String field2) {
return onField(new Field(field1), operator, new Field(field2));
}
public ConditionGroup onField(Field field1, ConditionOperator operator, Field field2) {
return addCondition(new BasicCondition(field1, operator, field2));
}
public ConditionGroup onNull (String field) {
return addCondition(new BasicCondition(field, ConditionOperator.NULL));
}
public ConditionGroup onNull (Field field) {
return addCondition(new BasicCondition(field, ConditionOperator.NULL));
}
public ConditionGroup onNotNull (String field) {
return addCondition(new BasicCondition(field, ConditionOperator.NOT_NULL));
}
public ConditionGroup onNotNull (Field field) {
return addCondition(new BasicCondition(field, ConditionOperator.NOT_NULL));
}
public ConditionGroup onIn (String field, Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy