use of org.geotoolkit.ogc.xml.v110.LiteralType in project geo-platform by geosdi.
the class BaseBinaryStrategy method createBinaryComparisonTypeForDate.
/**
* @param queryRestrictionDTO
* @return {@link BinaryComparisonOpType}
*/
protected BinaryComparisonOpType createBinaryComparisonTypeForDate(QueryRestrictionDTO queryRestrictionDTO) {
return new BinaryComparisonOpType() {
{
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(asList(queryRestrictionDTO.getAttribute().getName()));
FunctionType functionType = new FunctionType();
functionType.setName("dateParse");
LiteralType literalType = new LiteralType();
literalType.setContent(asList(queryRestrictionDTO.getRestriction()));
LiteralType literalTypeFormat = new LiteralType();
literalTypeFormat.setContent(dateFormatStrategyFinder.findDateFormat(queryRestrictionDTO.getAttribute()));
List<JAXBElement<?>> functionElements = new ArrayList<>(2);
functionElements.add(filterFactory.createLiteral(literalTypeFormat));
functionElements.add(filterFactory.createLiteral(literalType));
functionType.setExpression(functionElements);
List<JAXBElement<?>> elements = new ArrayList<>(2);
elements.add(filterFactory.createPropertyName(propertyNameType));
elements.add(filterFactory.createFunction(functionType));
super.setExpression(elements);
}
};
}
use of org.geotoolkit.ogc.xml.v110.LiteralType in project geo-platform by geosdi.
the class BaseBinaryStrategy method createBinaryComparisonType.
/**
* @param queryRestrictionDTO
* @return {@link BinaryComparisonOpType}
*/
protected BinaryComparisonOpType createBinaryComparisonType(QueryRestrictionDTO queryRestrictionDTO) {
return new BinaryComparisonOpType() {
{
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(asList(queryRestrictionDTO.getAttribute().getName()));
LiteralType literalType = new LiteralType();
literalType.setContent(asList(queryRestrictionDTO.getRestriction()));
List<JAXBElement<?>> elements = new ArrayList<>(2);
elements.add(filterFactory.createPropertyName(propertyNameType));
elements.add(filterFactory.createLiteral(literalType));
super.setExpression(elements);
}
};
}
use of org.geotoolkit.ogc.xml.v110.LiteralType in project flytekit-java by flyteorg.
the class VariableMapVisitor method property.
@Override
public void property(BeanProperty prop) {
JavaType handledType = getHandledType(prop);
LiteralType literalType = toLiteralType(handledType);
Variable variable = Variable.builder().description("").literalType(literalType).build();
builder.put(prop.getName(), variable);
}
use of org.geotoolkit.ogc.xml.v110.LiteralType in project flytekit-java by flyteorg.
the class Compiler method validateApply.
static List<CompilerError> validateApply(String nodeId, Map<String, SdkBindingData> inputs, Map<String, Variable> variableMap) {
List<CompilerError> errors = new ArrayList<>();
Set<String> allKeys = new HashSet<>();
allKeys.addAll(inputs.keySet());
allKeys.addAll(variableMap.keySet());
for (String key : allKeys) {
SdkBindingData input = inputs.get(key);
Variable variable = variableMap.get(key);
if (variable == null) {
String message = String.format("Variable [%s] not found on node [%s].", key, nodeId);
errors.add(CompilerError.create(CompilerError.Kind.VARIABLE_NAME_NOT_FOUND, nodeId, message));
continue;
}
if (input == null) {
String message = String.format("Parameter not bound [%s].", key);
errors.add(CompilerError.create(CompilerError.Kind.PARAMETER_NOT_BOUND, nodeId, message));
continue;
}
LiteralType actualType = input.type();
LiteralType expectedType = variable.literalType();
if (!actualType.equals(expectedType)) {
String message = String.format("Variable [%s] (type [%s]) doesn't match expected type [%s].", key, actualType, expectedType);
errors.add(CompilerError.create(CompilerError.Kind.MISMATCHING_TYPES, nodeId, message));
}
}
return errors;
}
use of org.geotoolkit.ogc.xml.v110.LiteralType in project flytekit-java by flyteorg.
the class LiteralMapDeserializer method deserialize.
@Override
public JacksonLiteralMap deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Map<String, Literal> literalMap = new HashMap<>();
verifyToken(p, JsonToken.START_OBJECT);
p.nextToken();
while (p.currentToken() != JsonToken.END_OBJECT) {
verifyToken(p, JsonToken.FIELD_NAME);
String fieldName = p.currentName();
LiteralType literalType = literalTypeMap.get(fieldName);
if (literalType == null) {
throw new IllegalStateException("Unexpected field [" + fieldName + "]");
}
p.nextToken();
literalMap.put(fieldName, deserialize(p, ctxt, literalType));
p.nextToken();
}
return new JacksonLiteralMap(unmodifiableMap(literalMap));
}
Aggregations