Search in sources :

Example 6 with PropertyIsNullType

use of org.geotoolkit.ogc.xml.v100.PropertyIsNullType in project geotoolkit by Geomatys.

the class OGC100Test method testFilterComparisonPropertyIsNull.

@Test
public void testFilterComparisonPropertyIsNull() throws JAXBException {
    final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
    final Marshaller MARSHALLER = POOL.acquireMarshaller();
    // Read test
    Object obj = UNMARSHALLER.unmarshal(FILE_FIL_COMP_ISNULL);
    assertNotNull(obj);
    JAXBElement<? extends FilterType> jaxfilter = (JAXBElement<? extends FilterType>) obj;
    assertNotNull(jaxfilter);
    Filter filter = TRANSFORMER_GT.visitFilter(jaxfilter.getValue());
    assertNotNull(filter);
    NullOperator prop = (NullOperator) filter;
    ValueReference center = (ValueReference) prop.getExpressions().get(0);
    assertEquals(center.getXPath(), valueStr);
    // write test
    FilterType ft = TRANSFORMER_OGC.apply(filter);
    assertNotNull(ft.getComparisonOps());
    ComparisonOpsType cot = ft.getComparisonOps().getValue();
    PropertyIsNullType pibt = (PropertyIsNullType) cot;
    PropertyNameType pnt = (PropertyNameType) pibt.getPropertyName();
    assertEquals(pnt.getContent(), valueStr);
    MARSHALLER.marshal(ft.getComparisonOps(), TEST_FILE_FIL_COMP_ISNULL);
    POOL.recycle(MARSHALLER);
    POOL.recycle(UNMARSHALLER);
}
Also used : Marshaller(javax.xml.bind.Marshaller) FilterType(org.geotoolkit.ogc.xml.v100.FilterType) PropertyIsNullType(org.geotoolkit.ogc.xml.v100.PropertyIsNullType) Filter(org.opengis.filter.Filter) ComparisonOpsType(org.geotoolkit.ogc.xml.v100.ComparisonOpsType) JAXBElement(javax.xml.bind.JAXBElement) Unmarshaller(javax.xml.bind.Unmarshaller) NullOperator(org.opengis.filter.NullOperator) ValueReference(org.opengis.filter.ValueReference) PropertyNameType(org.geotoolkit.ogc.xml.v100.PropertyNameType) Test(org.junit.Test)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)5 Filter (org.opengis.filter.Filter)5 NullOperator (org.opengis.filter.NullOperator)5 ValueReference (org.opengis.filter.ValueReference)5 List (java.util.List)3 ArrayList (java.util.ArrayList)2 Marshaller (javax.xml.bind.Marshaller)2 Unmarshaller (javax.xml.bind.Unmarshaller)2 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)2 PropertyIsNullType (org.geotoolkit.ogc.xml.v100.PropertyIsNullType)2 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)2 PropertyIsNullType (org.geotoolkit.ogc.xml.v110.PropertyIsNullType)2 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)2 BetweenComparisonOperator (org.opengis.filter.BetweenComparisonOperator)2 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)2 Expression (org.opengis.filter.Expression)2 LikeOperator (org.opengis.filter.LikeOperator)2 Literal (org.opengis.filter.Literal)2 LogicalOperator (org.opengis.filter.LogicalOperator)2 CodeList (org.opengis.util.CodeList)2