Search in sources :

Example 1 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project ddf by codice.

the class CswQueryFactoryTest method createTemporalBinaryComparisonOpType.

private BinaryComparisonOpType createTemporalBinaryComparisonOpType(String attr, String comparison) {
    BinaryComparisonOpType comparisonOp = new BinaryComparisonOpType();
    PropertyNameType propName = new PropertyNameType();
    propName.getContent().add(attr);
    comparisonOp.getExpression().add(filterObjectFactory.createPropertyName(propName));
    LiteralType literal = new LiteralType();
    literal.getContent().add(comparison);
    comparisonOp.getExpression().add(filterObjectFactory.createLiteral(literal));
    return comparisonOp;
}
Also used : LiteralType(net.opengis.filter.v_1_1_0.LiteralType) BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Example 2 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project ddf by codice.

the class WfsFilterDelegate method createLiteralType.

private JAXBElement<LiteralType> createLiteralType(Object literalValue) {
    JAXBElement<LiteralType> literalType = filterObjectFactory.createLiteral(new LiteralType());
    literalType.getValue().getContent().add(literalValue.toString());
    return literalType;
}
Also used : LiteralType(net.opengis.filter.v_2_0_0.LiteralType)

Example 3 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project arctic-sea by 52North.

the class FesDecoderv20 method parsePropertyIsBetweenFilter.

/**
 * Parse XML propertyIsBetween element
 *
 * @param comparisonOpsType
 *            XML propertyIsBetween element
 * @return SOS comparison filter
 * @throws DecodingException
 *             If an error occurs of the filter is not supported
 */
private ComparisonFilter parsePropertyIsBetweenFilter(PropertyIsBetweenType comparisonOpsType) throws DecodingException {
    ComparisonFilter comparisonFilter = new ComparisonFilter();
    comparisonFilter.setOperator(ComparisonOperator.PropertyIsBetween);
    try {
        comparisonFilter.setValueReference(parseValueReference(comparisonOpsType.getExpression()));
    } catch (XmlException xmle) {
        throw valueReferenceParsingException(xmle);
    }
    if (comparisonOpsType.getLowerBoundary().getExpression() instanceof LiteralType) {
        comparisonFilter.setValue(parseLiteralValue((LiteralType) comparisonOpsType.getLowerBoundary().getExpression()));
    }
    if (comparisonOpsType.getUpperBoundary().getExpression() instanceof LiteralType) {
        comparisonFilter.setValueUpper(parseLiteralValue((LiteralType) comparisonOpsType.getUpperBoundary().getExpression()));
    }
    return comparisonFilter;
}
Also used : ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) XmlException(org.apache.xmlbeans.XmlException) LiteralType(net.opengis.fes.x20.LiteralType)

Example 4 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project flytekit-java by flyteorg.

the class SdkTestingExecutor method withFixedInputs.

public <T> SdkTestingExecutor withFixedInputs(SdkType<T> type, T value) {
    Map<String, Variable> variableMap = type.getVariableMap();
    @Var Builder builder = toBuilder();
    for (Map.Entry<String, Literal> entry : type.toLiteralMap(value).entrySet()) {
        LiteralType literalType = variableMap.get(entry.getKey()).literalType();
        builder = builder.putFixedInput(entry.getKey(), entry.getValue(), literalType);
    }
    return builder.build();
}
Also used : Variable(org.flyte.api.v1.Variable) Var(com.google.errorprone.annotations.Var) Literal(org.flyte.api.v1.Literal) LiteralType(org.flyte.api.v1.LiteralType) HashMap(java.util.HashMap) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) Collections.emptyMap(java.util.Collections.emptyMap) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap)

Example 5 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project flytekit-java by flyteorg.

the class SdkTestingExecutor method execute.

public Result execute() {
    TestingSdkWorkflowBuilder builder = new TestingSdkWorkflowBuilder(fixedInputMap(), fixedInputTypeMap());
    workflow().expand(builder);
    WorkflowTemplate workflowTemplate = builder.toIdlTemplate();
    for (Node node : workflowTemplate.nodes()) {
        TaskNode taskNode = node.taskNode();
        if (taskNode != null) {
            String taskName = taskNode.referenceId().name();
            checkArgument(fixedTaskMap().containsKey(taskName), "Can't execute remote task [%s], " + "use SdkTestingExecutor#withTaskOutput or SdkTestingExecutor#withTask", taskName);
        }
    }
    Map<String, Literal> outputLiteralMap = LocalEngine.compileAndExecute(workflowTemplate, unmodifiableMap(fixedTaskMap()), emptyMap(), fixedInputMap());
    Map<String, LiteralType> outputLiteralTypeMap = workflowTemplate.interface_().outputs().entrySet().stream().collect(toMap(Map.Entry::getKey, x -> x.getValue().literalType()));
    return Result.create(outputLiteralMap, outputLiteralTypeMap);
}
Also used : TaskNode(org.flyte.api.v1.TaskNode) SdkRunnableTask(org.flyte.flytekit.SdkRunnableTask) HashMap(java.util.HashMap) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Collectors.toMap(java.util.stream.Collectors.toMap) WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) SdkType(org.flyte.flytekit.SdkType) Duration(java.time.Duration) Map(java.util.Map) Preconditions.checkArgument(org.flyte.flytekit.testing.Preconditions.checkArgument) Collections.emptyMap(java.util.Collections.emptyMap) Node(org.flyte.api.v1.Node) LiteralType(org.flyte.api.v1.LiteralType) Literal(org.flyte.api.v1.Literal) ServiceLoader(java.util.ServiceLoader) Variable(org.flyte.api.v1.Variable) Instant(java.time.Instant) SdkWorkflow(org.flyte.flytekit.SdkWorkflow) Var(com.google.errorprone.annotations.Var) List(java.util.List) SdkRemoteTask(org.flyte.flytekit.SdkRemoteTask) AutoValue(com.google.auto.value.AutoValue) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap) LocalEngine(org.flyte.localengine.LocalEngine) TaskNode(org.flyte.api.v1.TaskNode) WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) TaskNode(org.flyte.api.v1.TaskNode) Node(org.flyte.api.v1.Node) Literal(org.flyte.api.v1.Literal) LiteralType(org.flyte.api.v1.LiteralType) HashMap(java.util.HashMap) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) Collections.emptyMap(java.util.Collections.emptyMap) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)40 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)40 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)40 Literal (org.opengis.filter.Literal)35 Marshaller (javax.xml.bind.Marshaller)34 Unmarshaller (javax.xml.bind.Unmarshaller)34 Test (org.junit.Test)34 ValueReference (org.opengis.filter.ValueReference)34 Filter (org.opengis.filter.Filter)26 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)21 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)17 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)16 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)14 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)11 Expression (org.opengis.filter.Expression)11 LiteralType (org.flyte.api.v1.LiteralType)10 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType)9 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)9 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType)9 LogicalOperator (org.opengis.filter.LogicalOperator)9