Search in sources :

Example 1 with LiteralType

use of org.flyte.api.v1.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.flyte.api.v1.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.flyte.api.v1.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.flyte.api.v1.LiteralType in project flytekit-java by flyteorg.

the class SdkLaunchPlanRegistrarTest method shouldLoadLaunchPlansFromDiscoveredRegistries.

@Test
void shouldLoadLaunchPlansFromDiscoveredRegistries() {
    Map<LaunchPlanIdentifier, LaunchPlan> launchPlans = registrar.load(ENV);
    Primitive defaultPrimitive = Primitive.ofStringValue("default-bar");
    LaunchPlanIdentifier expectedTestPlan = LaunchPlanIdentifier.builder().project("project").domain("domain").name("TestPlan").version("version").build();
    LaunchPlan expectedPlan = LaunchPlan.builder().name("TestPlan").workflowId(PartialWorkflowIdentifier.builder().name("org.flyte.flytekit.SdkLaunchPlanRegistrarTest$TestWorkflow").build()).fixedInputs(singletonMap("foo", Literal.ofScalar(Scalar.ofPrimitive(Primitive.ofStringValue("bar"))))).defaultInputs(singletonMap("default-foo", Parameter.create(Variable.builder().description("").literalType(LiteralType.ofSimpleType(SimpleType.STRING)).build(), Literal.ofScalar(Scalar.ofPrimitive(defaultPrimitive))))).build();
    LaunchPlanIdentifier expectedOtherTestPlan = LaunchPlanIdentifier.builder().project("project").domain("domain").name("OtherTestPlan").version("version").build();
    LaunchPlan expectedOtherPlan = LaunchPlan.builder().name("OtherTestPlan").workflowId(PartialWorkflowIdentifier.builder().name("org.flyte.flytekit.SdkLaunchPlanRegistrarTest$TestWorkflow").build()).fixedInputs(singletonMap("foo", Literal.ofScalar(Scalar.ofPrimitive(Primitive.ofStringValue("baz"))))).defaultInputs(singletonMap("default-foo", Parameter.create(Variable.builder().description("").literalType(LiteralType.ofSimpleType(SimpleType.STRING)).build(), Literal.ofScalar(Scalar.ofPrimitive(defaultPrimitive))))).build();
    assertAll(() -> assertThat(launchPlans, hasEntry(is(expectedTestPlan), is(expectedPlan))), () -> assertThat(launchPlans, hasEntry(is(expectedOtherTestPlan), is(expectedOtherPlan))));
}
Also used : LaunchPlanIdentifier(org.flyte.api.v1.LaunchPlanIdentifier) Primitive(org.flyte.api.v1.Primitive) LaunchPlan(org.flyte.api.v1.LaunchPlan) Test(org.junit.jupiter.api.Test)

Example 5 with LiteralType

use of org.flyte.api.v1.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)

Aggregations

LiteralType (org.flyte.api.v1.LiteralType)10 Map (java.util.Map)6 Literal (org.flyte.api.v1.Literal)6 Variable (org.flyte.api.v1.Variable)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 JavaType (com.fasterxml.jackson.databind.JavaType)3 Collections.unmodifiableMap (java.util.Collections.unmodifiableMap)3 Collectors.toMap (java.util.stream.Collectors.toMap)3 LiteralType (net.opengis.filter.v_1_1_0.LiteralType)3 Test (org.junit.jupiter.api.Test)3 AutoValue (com.google.auto.value.AutoValue)2 Var (com.google.errorprone.annotations.Var)2 Duration (java.time.Duration)2 Collections.emptyMap (java.util.Collections.emptyMap)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 JAXBElement (javax.xml.bind.JAXBElement)2 LiteralType (net.opengis.fes.x20.LiteralType)2 SdkType (org.flyte.flytekit.SdkType)2