Package net.opengis.wfs

Examples of net.opengis.wfs.QueryType


        if (request.getMaxFeatures() != null) {
            map.put("MAXFEATURES", String.valueOf(request.getMaxFeatures()));
        }

        final QueryType query = (QueryType) request.getQuery().get(0);
        final String typeName = (String) query.getTypeName().get(0);
        map.put("TYPENAME", typeName);

        if (query.getPropertyName().size() > 0) {
            List<String> propertyNames = query.getPropertyName();
            StringBuilder pnames = new StringBuilder();
            for (Iterator<String> it = propertyNames.iterator(); it.hasNext();) {
                pnames.append(it.next());
                if (it.hasNext()) {
                    pnames.append(',');
                }
            }
            map.put("PROPERTYNAME", pnames.toString());
        }

        // SRSNAME parameter. Let the server reproject.
        // TODO: should check if the server supports the required crs
        URI srsName = query.getSrsName();
        if (srsName != null) {
            map.put("SRSNAME", srsName.toString());
        }
        final Filter filter = query.getFilter();

        if (filter != null && Filter.INCLUDE != filter) {
            if (filter instanceof Id) {
                final Set<Identifier> identifiers = ((Id) filter).getIdentifiers();
                StringBuffer idValues = new StringBuffer();
View Full Code Here


     * </p>
     */
    @Override
    public Object getProperty(Object object, QName name) throws Exception {
        if ("typeName".equals(name.getLocalPart())) {
            QueryType query = (QueryType) object;
            List typeName = query.getTypeName();
            StringBuilder typeNameList = new StringBuilder();
            if (typeName != null) {
                for (Iterator it = typeName.iterator(); it.hasNext();) {
                    Object o = it.next();
                    if (o instanceof QName) {
                        QName qName = (QName) o;
                        o = qName.getPrefix() + ":" + qName.getLocalPart();
                    }
                   
                    typeNameList.append(o);
                    if (it.hasNext()) {
                        typeNameList.append(",");
                    }
                }
            }
            return typeNameList.toString();
        } else if ("SortBy".equals(name.getLocalPart())) {
            QueryType query = (QueryType) object;
            List sortBy = query.getSortBy();
            if (sortBy != null && sortBy.size() == 0) {
                return null;
            }
        }

View Full Code Here

    }
   
    @Override
    protected void setProperty(EObject eObject, String property, Object value, boolean lax) {
        if ("typeName".equals(property)) {
            QueryType query = (QueryType) eObject;
            if (query.getTypeName() == null) {
                query.setTypeName(new ArrayList());
            }
        }
       
        super.setProperty(eObject, property, value, lax);
    }
View Full Code Here

    }
   
    @Override
    public Object getProperty(Object object, QName name) throws Exception {
        if ("typeName".equals(name.getLocalPart())) {
            QueryType query = (QueryType) object;
            if (!query.getTypeName().isEmpty()) {
                //bit of a hack but handle both string and qname
                Object obj = query.getTypeName().get(0);
                if (obj instanceof String) {
                    obj = new XSQNameBinding(namespaceContext).parse(null, obj);
                }
                return obj;
            }
View Full Code Here

    @Override
    protected void setProperty(EObject eObject, String property, Object value, boolean lax) {

        if ("typeName".equals(property)) {
            //in wfs 1.0 we are only allowed a singel type name
            QueryType query = (QueryType)eObject;
           
            ArrayList list = new ArrayList();
            list.add(value);
            query.setTypeName(list);
        }
        else if ("PropertyName".equals(property)) {
            //in wfs 1.0 propertynames are ogc:PropertyName
            PropertyName name = (PropertyName) value;
            super.setProperty(eObject, property, name.getPropertyName(), lax);
View Full Code Here

        for (Iterator i = results.getFeature().iterator(); i.hasNext();) {
            SimpleFeatureCollection fc = (SimpleFeatureCollection) i.next();
            features.getFeature().add(fc);

            QueryType qt = WfsFactory.eINSTANCE.createQueryType();
            String crs = GML2EncodingUtils.epsgCode(fc.getSchema().getCoordinateReferenceSystem());
            if (crs != null) {
                final String srsName = "EPSG:" + crs;
                try {
                    qt.setSrsName(new URI(srsName));
                } catch (URISyntaxException e) {
                    throw new ServiceException(
                            "Unable to determite coordinate system for featureType "
                                    + fc.getSchema().getTypeName() + ".  Schema told us '"
                                    + srsName + "'", e);
View Full Code Here

    Operation request(QName... names) {
        Service service = getServiceDescriptor10();
        GetFeatureType type = WfsFactory.eINSTANCE.createGetFeatureType();
        type.setBaseUrl("http://localhost:8080/geoserver");
        for (QName name : names) {
            QueryType queryType = WfsFactory.eINSTANCE.createQueryType();
            queryType.setTypeName(Collections.singletonList(name));
            type.getQuery().add(queryType);
        }
        Operation request = new Operation("wfs", service, null, new Object[] { type });
        return request;
    }
View Full Code Here

        Map<String, Object> parsed = parseKvp(raw);

        GetFeatureType req = WfsFactory.eINSTANCE.createGetFeatureType();
        Object read = reader.read(req, parsed, raw);
        GetFeatureType parsedReq = (GetFeatureType) read;
        QueryType query = (QueryType) parsedReq.getQuery().get(0);
        List<QName> typeNames = query.getTypeName();
        assertEquals(1, typeNames.size());
        assertEquals(MockData.MLINES, typeNames.get(0));
    }
View Full Code Here

        Map<String, Object> parsed = parseKvp(raw);

        GetFeatureType req = WfsFactory.eINSTANCE.createGetFeatureType();
        Object read = reader.read(req, parsed, raw);
        GetFeatureType parsedReq = (GetFeatureType) read;
        QueryType query = (QueryType) parsedReq.getQuery().get(0);
        List<QName> typeNames = query.getTypeName();
        assertEquals(1, typeNames.size());
        assertEquals(qName, typeNames.get(0));
    }
View Full Code Here

            }

            //JD: wfs reprojection: should not set srs form metadata but from
            // the request
            //srs = Integer.parseInt(meta.getSRS());
            QueryType query = (QueryType) request.getQuery().get(i);
            try {
                String srsName = query.getSrsName() != null ? query.getSrsName().toString() : null;
                if ( srsName == null ) {
                    //no SRS in query...asking for the default?
                    srsName = meta.getSRS();
                }
                if ( srsName != null ) {
                    CoordinateReferenceSystem crs = CRS.decode(srsName);
                    String epsgCode = GML2EncodingUtils.epsgCode(crs);
                    srs = Integer.parseInt(epsgCode);
                }
            }
            catch( Exception e ) {
                LOGGER.log(Level.WARNING, "Problem encoding:" + query.getSrsName(), e);
               
            }
           
            //track num decimals, in cases where the query has multiple types we choose the max
            // of all the values (same deal as above, might not be a vector due to GetFeatureInfo reusing this)
View Full Code Here

TOP

Related Classes of net.opengis.wfs.QueryType

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.