use of com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.terminal.LeafNode in project hale by halestudio.
the class CqlToMappingConditionTranslator method getLeftContents.
private LeafNode getLeftContents(AttributeExpressionImpl expression) {
LeafNode node = new LeafNode();
node.setPropertyName(expression.getPropertyName());
return node;
}
use of com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.terminal.LeafNode in project hale by halestudio.
the class CqlToMappingConditionTranslator method createNode.
private FilterNode createNode(FilterNode parent, Filter child) {
FilterNode childNode = null;
if (isLogical(child)) {
LogicFilterImpl logicFilter = (LogicFilterImpl) child;
childNode = factory.createLogicNode(logicFilter);
List<?> children = logicFilter.getChildren();
for (Object c : children) {
createNode(childNode, (Filter) c);
}
} else if (isComparison(child)) {
AbstractComparisonNode comparisonNode = null;
if (LikeFilterImpl.class.isAssignableFrom(child.getClass())) {
LikeFilterImpl like = (LikeFilterImpl) child;
comparisonNode = factory.createComparisonNode(like);
comparisonNode.setLeft(getLeftContents((AttributeExpressionImpl) like.getExpression()));
LeafNode node = new LeafNode();
node.setLiteralValue(LiteralValue.getNew(like.getLiteral()));
comparisonNode.setRight(node);
} else {
CompareFilterImpl compare = (CompareFilterImpl) child;
comparisonNode = factory.createComparisonNode(compare);
comparisonNode.setLeft(getLeftContents((AttributeExpressionImpl) compare.getExpression1()));
comparisonNode.setRight(getRightContents(compare.getExpression2()));
}
childNode = comparisonNode;
} else if (isGeometric(child)) {
childNode = factory.createGeometricNode((GeometryFilterImpl) child);
}
if (parent != null) {
parent.addChild(childNode);
}
return childNode;
}
use of com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.terminal.LeafNode in project hale by halestudio.
the class CqlToMappingConditionTranslator method getRightContents.
private LeafNode getRightContents(Expression expression) {
LeafNode node = new LeafNode();
if (LiteralExpressionImpl.class.isAssignableFrom(expression.getClass())) {
LiteralExpressionImpl literal = (LiteralExpressionImpl) expression;
if (literal.getValue() instanceof com.vividsolutions.jts.geom.Geometry) {
throw new IllegalArgumentException(// $NON-NLS-1$
"Geometric literals are " + // $NON-NLS-1$
"not supported! Found " + literal.getValue().getClass().getCanonicalName());
}
node.setLiteralValue(LiteralValue.getNew(literal.getValue()));
} else if (AttributeExpressionImpl.class.isAssignableFrom(expression.getClass())) {
AttributeExpressionImpl attribute = (AttributeExpressionImpl) expression;
node.setPropertyName(attribute.getPropertyName());
} else {
throw new IllegalArgumentException(// $NON-NLS-1$
"Unsupported expression type: " + expression.getClass().getCanonicalName());
}
return node;
}
Aggregations