use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.
the class Function method equals.
@Override
public boolean equals(final Object obj) {
if (obj instanceof Function) {
final Function value = (Function) obj;
if (DataType.equal(getName(), value.getName())) {
final List<QueryValue> parameters1 = getParameters();
final List<QueryValue> parameters2 = value.getParameters();
if (parameters1.size() == parameters2.size()) {
for (int i = 0; i < parameters1.size(); i++) {
final QueryValue value1 = parameters1.get(i);
final QueryValue value2 = parameters2.get(i);
if (!DataType.equal(value1, value2)) {
return false;
}
}
return true;
}
}
}
return false;
}
use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.
the class Function method appendDefaultSql.
@Override
public void appendDefaultSql(final Query query, final RecordStore recordStore, final StringBuilder buffer) {
buffer.append(this.name);
buffer.append("(");
boolean first = true;
for (final QueryValue parameter : getParameters()) {
if (first) {
first = false;
} else {
buffer.append(", ");
}
parameter.appendSql(query, recordStore, buffer);
}
buffer.append(")");
}
use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.
the class WithinDistance method updateQueryValues.
@SuppressWarnings("unchecked")
@Override
public <QV extends QueryValue> QV updateQueryValues(final Function<QueryValue, QueryValue> valueHandler) {
final QueryValue distanceValue = valueHandler.apply(this.distanceValue);
final QueryValue geometry1Value = valueHandler.apply(this.geometry1Value);
final QueryValue geometry2Value = valueHandler.apply(this.geometry2Value);
if (distanceValue == this.distanceValue && geometry1Value == this.geometry1Value && geometry2Value == this.geometry2Value) {
return (QV) this;
} else {
final WithinDistance clone = clone();
clone.distanceValue = distanceValue;
clone.geometry1Value = geometry1Value;
clone.geometry2Value = geometry2Value;
return (QV) clone;
}
}
use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.
the class OracleRecordStore method appendEnvelopeIntersects.
private void appendEnvelopeIntersects(final Query query, final StringBuilder sql, final EnvelopeIntersects envelopeIntersects) {
final FieldDefinition geometryField = query.getGeometryField();
if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
sql.append("SDO_RELATE(");
final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
if (boundingBox1Value == null) {
sql.append("NULL");
} else {
boundingBox1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
if (boundingBox2Value == null) {
sql.append("NULL");
} else {
boundingBox2Value.appendSql(query, this, sql);
}
sql.append(",'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'");
} else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
sql.append("SDE.ST_ENVINTERSECTS(");
final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
if (boundingBox1Value == null) {
sql.append("NULL");
} else {
boundingBox1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
if (boundingBox2Value == null) {
sql.append("NULL");
} else {
boundingBox2Value.appendSql(query, this, sql);
}
sql.append(") = 1");
} else {
throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
}
}
use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.
the class OracleRecordStore method appendGeometryEqual2d.
private void appendGeometryEqual2d(final Query query, final StringBuilder sql, final GeometryEqual2d equals) {
final FieldDefinition geometryField = query.getGeometryField();
if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
sql.append("MDSYS.SDO_EQUAL(");
final QueryValue geometry1Value = equals.getGeometry1Value();
if (geometry1Value == null) {
sql.append("NULL");
} else {
geometry1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue geometry2Value = equals.getGeometry2Value();
if (geometry2Value == null) {
sql.append("NULL");
} else {
geometry2Value.appendSql(query, this, sql);
}
sql.append(") = 'TRUE'");
} else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
sql.append("SDE.ST_EQUALS(");
final QueryValue geometry1Value = equals.getGeometry1Value();
if (geometry1Value == null) {
sql.append("NULL");
} else {
geometry1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue geometry2Value = equals.getGeometry2Value();
if (geometry2Value == null) {
sql.append("NULL");
} else {
geometry2Value.appendSql(query, this, sql);
}
sql.append(") = 1");
} else {
throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
}
}
Aggregations