Package net.opengis.wfs

Examples of net.opengis.wfs.GetFeatureType


        final URL resource = TestData.getResource(this, "GetFeatureTypeBindingTest.xml");
        buildDocument(resource);

        Object parsed = parse(WFS.GetFeature);
        assertTrue(parsed instanceof GetFeatureType);
        GetFeatureType req = (GetFeatureType) parsed;
        assertEquals("WFS", req.getService());
        assertEquals("1.1.0", req.getVersion());
        assertEquals("fooHandle", req.getHandle());
        assertEquals("fooFormat", req.getOutputFormat());
        assertEquals(ResultTypeType.HITS_LITERAL, req.getResultType());
        assertEquals(1000, req.getMaxFeatures().intValue());
        assertEquals("*", req.getTraverseXlinkDepth());
        assertEquals(2, req.getTraverseXlinkExpiry().intValue());

        List queries = req.getQuery();
        assertEquals(2, queries.size());
        assertTrue(queries.get(0) instanceof QueryType);
        assertTrue(queries.get(1) instanceof QueryType);
    }
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  public void testEncode() throws Exception
  {
    GetFeatureType getFeature = factory.createGetFeatureType();
    getFeature.setHandle("handle");
    getFeature.setMaxFeatures(BigInteger.valueOf(10));
    getFeature.getQuery().add(factory.createQueryType());
    getFeature.getQuery().add(factory.createQueryType());

    Document dom = encode(getFeature, WFS.GetFeature);
    assertEquals("handle", dom.getDocumentElement().getAttribute("handle"));
    assertEquals("10", dom.getDocumentElement().getAttribute("maxFeatures"));
    assertEquals(2, getElementsByQName(dom, WFS.Query).getLength());
View Full Code Here

    /**
     * @return a {@link GetFeatureParser} to stream the contents of the GML 3.1 response
     */
    public Object parse(WFSResponse response, String axisOrder) throws IOException {

        final GetFeatureType request = (GetFeatureType) response.getOriginatingRequest();
        final QueryType queryType = (QueryType) request.getQuery().get(0);
        final QName remoteFeatureName = response.getRemoteTypeName();

        SimpleFeatureType schema = response.getQueryType();
        @SuppressWarnings("unchecked")
        List<String> propertyNames = queryType.getPropertyName();
View Full Code Here

        final QName typeName = query.getTypeName();
        final FeatureTypeInfo featureTypeInfo = getFeatureTypeInfo(typeName);

        final WfsFactory factory = WfsFactory.eINSTANCE;

        GetFeatureType getFeature = factory.createGetFeatureType();
        getFeature.setService("WFS");
        getFeature.setVersion(getVersion());

        String outputFormat = query.getOutputFormat();
        getFeature.setOutputFormat(outputFormat);

        getFeature.setHandle(query.getHandle());

        Integer maxFeatures = query.getMaxFeatures();
        if (maxFeatures != null) {
            getFeature.setMaxFeatures(BigInteger.valueOf(maxFeatures.intValue()));
        }

        ResultType resultType = query.getResultType();
        getFeature.setResultType(RESULTS == resultType ? ResultTypeType.RESULTS_LITERAL
                : ResultTypeType.HITS_LITERAL);

        QueryType wfsQuery = factory.createQueryType();
        wfsQuery.setTypeName(Collections.singletonList(typeName));

        final Filter supportedFilter;
        final Filter unsupportedFilter;
        {
            final Filter filter = query.getFilter();
            Filter[] splitFilters = splitFilters(typeName, filter);
            supportedFilter = splitFilters[0];
            unsupportedFilter = splitFilters[1];
        }

        query.setUnsupportedFilter(unsupportedFilter);

        if (!Filter.INCLUDE.equals(supportedFilter)) {
            wfsQuery.setFilter(supportedFilter);
        }

        String srsName = query.getSrsName();
        if (null == srsName) {
            srsName = featureTypeInfo.getDefaultSRS();
        }
        try {
            wfsQuery.setSrsName(new URI(srsName));
        } catch (URISyntaxException e) {
            throw new RuntimeException("Can't create a URI from the query CRS: " + srsName, e);
        }
        String[] propertyNames = query.getPropertyNames();
        boolean retrieveAllProperties = propertyNames == null;
        if (!retrieveAllProperties) {
            List<String> propertyName = wfsQuery.getPropertyName();
            for (String propName : propertyNames) {
                propertyName.add(propName);
            }
        }
        SortBy[] sortByList = query.getSortBy();
        if (sortByList != null) {
            for (SortBy sortBy : sortByList) {
                wfsQuery.getSortBy().add(sortBy);
            }
        }

        getFeature.getQuery().add(wfsQuery);

        return getFeature;
    }
View Full Code Here

    /**
     * @return a {@link GetFeatureParser} to stream the contents of the GML 3.1 response
     */
    public Object parse(WFS_1_1_0_DataStore wfs, WFSResponse response) throws IOException {

        GetFeatureType request = (GetFeatureType) response.getOriginatingRequest();
        QueryType queryType = (QueryType) request.getQuery().get(0);
        String prefixedTypeName = (String) queryType.getTypeName().get(0);
        SimpleFeatureType schema = wfs.getSchema(prefixedTypeName);
        List<String> propertyNames = queryType.getPropertyName();
        if (propertyNames.size() > 0) {
            // the expected schema may contain less properties than the full schema. Let's say it to
View Full Code Here

     */
    @Override
    public RequestComponents createGetFeatureRequest(WFSProtocol wfs, GetFeature query)
            throws IOException {
        RequestComponents req = super.createGetFeatureRequest(wfs, query);
        GetFeatureType getFeature = req.getServerRequest();
        QueryType queryType = (QueryType) getFeature.getQuery().get(0);
        URI srsNameUri = queryType.getSrsName();
        final String overrideSrs = "urn:opengis:def:crs:ogc::83";
        if (srsNameUri != null && srsNameUri.toString().equalsIgnoreCase(overrideSrs)) {
            try {
                queryType.setSrsName(new URI("EPSG:4269"));
View Full Code Here

    @SuppressWarnings("unchecked")
    public RequestComponents createGetFeatureRequest(WFSProtocol wfs, GetFeature query)
            throws IOException {
        final WfsFactory factory = WfsFactory.eINSTANCE;

        GetFeatureType getFeature = factory.createGetFeatureType();
        getFeature.setService("WFS");
        getFeature.setVersion(wfs.getServiceVersion().toString());
        getFeature.setOutputFormat(query.getOutputFormat());

        getFeature.setHandle("GeoTools " + GeoTools.getVersion() + " WFS DataStore");
        Integer maxFeatures = query.getMaxFeatures();
        if (maxFeatures != null) {
            getFeature.setMaxFeatures(BigInteger.valueOf(maxFeatures.intValue()));
        }

        ResultType resultType = query.getResultType();
        getFeature.setResultType(RESULTS == resultType ? RESULTS_LITERAL : HITS_LITERAL);

        QueryType wfsQuery = factory.createQueryType();
        wfsQuery.setTypeName(Collections.singletonList(query.getTypeName()));

        Filter serverFilter = query.getFilter();
        if (!Filter.INCLUDE.equals(serverFilter)) {
            wfsQuery.setFilter(serverFilter);
        }
        String srsName = query.getSrsName();
        try {
            wfsQuery.setSrsName(new URI(srsName));
        } catch (URISyntaxException e) {
            throw new RuntimeException("Can't create a URI from the query CRS: " + srsName, e);
        }
        String[] propertyNames = query.getPropertyNames();
        boolean retrieveAllProperties = propertyNames == null;
        if (!retrieveAllProperties) {
            List propertyName = wfsQuery.getPropertyName();
            for (String propName : propertyNames) {
                propertyName.add(propName);
            }
        }
        SortBy[] sortByList = query.getSortBy();
        if (sortByList != null) {
            for (SortBy sortBy : sortByList) {
                wfsQuery.getSortBy().add(sortBy);
            }
        }

        getFeature.getQuery().add(wfsQuery);

        RequestComponents reqParts = new RequestComponents();
        reqParts.setServerRequest(getFeature);

        Map<String, String> parametersForGet = buildGetFeatureParametersForGet(getFeature);
View Full Code Here

    @Override
    public RequestComponents createGetFeatureRequest(WFSProtocol wfs, GetFeature query)
            throws IOException {
        RequestComponents parts = super.createGetFeatureRequest(wfs, query);

        GetFeatureType serverRequest = parts.getServerRequest();
        serverRequest.setResultType(null);
        parts.setServerRequest(serverRequest);

        GetFeatureType nonResultTypeRequest = new CubeWerxGetFeatureType();
        EMFUtils.copy(serverRequest, nonResultTypeRequest);
        // CubeWerx fails if the _mandatory_ resultType attribute is sent
        nonResultTypeRequest.setResultType(null);
        parts.setServerRequest(nonResultTypeRequest);

        parts.getKvpParameters().remove("RESULTTYPE");

        return parts;
View Full Code Here

@SuppressWarnings("nls")
public class WFSExtensionsTest {

    @Test
    public void testFindParserFactory() {
        GetFeatureType request = WfsFactory.eINSTANCE.createGetFeatureType();
        request.setOutputFormat("application/fakeFormat");
        WFSResponseParserFactory factory = WFSExtensions.findParserFactory(request);
        assertNotNull(factory);
        assertTrue(factory instanceof TestParserFactory);
    }
View Full Code Here

                    "The server does not support GetFeature for HTTP method GET");
        }
        URL url = getOperationURL(WFSOperationType.GET_FEATURE, false);

        RequestComponents reqParts = strategy.createGetFeatureRequest(this, request);
        GetFeatureType requestType = reqParts.getServerRequest();
       
        // build the kvp taking into account eventual vendor params
        Map<String, String> getFeatureKvp = reqParts.getKvpParameters();
        if(request instanceof GetFeatureQueryAdapter) {
            GetFeatureQueryAdapter adapter = (GetFeatureQueryAdapter) request;
View Full Code Here

TOP

Related Classes of net.opengis.wfs.GetFeatureType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.