protected List<Query> getQueries(EObject eObject) { return GetFeatureRequest.adapt(eObject).getQueries(); }
@Override public String getAttachmentFileName(Object value, Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFileName = request.getQueries().get(0).getTypeNames().get(0).getLocalPart(); return outputFileName + ".kml"; }
/** * Gets current request extension (dxf or zip). * * @param operation * @return */ public String getDxfExtension(Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation .getParameters()[0]); String outputFormat = request.getOutputFormat().toUpperCase(); // DXF if (outputFormat.equals("DXF")) return "dxf"; // DXF-ZIP return "zip"; }
@Override public String getAttachmentFileName(Object value, Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFileName = request.getQueries().get(0).getTypeNames().get(0).getLocalPart(); return outputFileName + ".csv"; }
@Override public String getAttachmentFileName(Object value, Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFileName = request.getQueries().get(0).getTypeNames().get(0).getLocalPart(); return outputFileName + "." + fileExtension; }
/** * Looks up the charset parameter, either in the GetFeature request or as a global parameter * * @param getFeature * @return the found charset, or the platform's default one if none was specified */ private Charset getShapefileCharset(Operation getFeature) { Charset result = null; GetFeatureRequest gft = GetFeatureRequest.adapt(getFeature.getParameters()[0]); if (gft.getFormatOptions() != null && gft.getFormatOptions().get("CHARSET") != null) { result = (Charset) gft.getFormatOptions().get("CHARSET"); } else { final String charsetName = GeoServerExtensions.getProperty(GS_SHAPEFILE_CHARSET, applicationContext); if (charsetName != null) result = Charset.forName(charsetName); } // if not specified let's use the shapefile default one return result != null ? result : Charset.forName("ISO-8859-1"); }
@Override public String getAttachmentFileName(Object value, Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFormat = request.getOutputFormat(); Format format = formats.get(outputFormat); List<Query> queries = request.getQueries(); if (format == null) { throw new WFSException("Unknown output format " + outputFormat); } else { String outputFileName = queries.get(0).getTypeNames().get(0).getLocalPart(); if (!format.isSingleFile() || queries.size() > 1) { return outputFileName + ".zip"; } else { return outputFileName + format.getFileExtension(); } } }
@Override public String getPreferredDisposition(Object value, Operation operation) { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFormat = request.getOutputFormat(); Format format = formats.get(outputFormat); List<Query> queries = request.getQueries(); if (format == null) { throw new WFSException("Unknown output format " + outputFormat); } else if (format.getType() == OutputType.BINARY || queries.size() > 1) { return DISPOSITION_ATTACH; } else { return DISPOSITION_INLINE; } }
GetFeatureRequest request = GetFeatureRequest.adapt(operation .getParameters()[0]);
/** * Ensures that the operation being executed is a GetFeature operation. * * <p>Subclasses may implement */ public boolean canHandle(Operation operation) { // GetFeature operation? if ("GetFeature".equalsIgnoreCase(operation.getId()) || "GetFeatureWithLock".equalsIgnoreCase(operation.getId())) { // also check that the resultType is "results" GetFeatureRequest req = GetFeatureRequest.adapt(operation.getParameters()[0]); if (req.isResultTypeResults()) { // call subclass hook return canHandleInternal(operation); } } return false; }
protected void write( FeatureCollectionResponse featureCollection, OutputStream output, Operation getFeature) throws IOException, ServiceException { GetFeatureRequest request = GetFeatureRequest.adapt(getFeature.getParameters()[0]); prepare(request.getOutputFormat(), featureCollection, request); encode(output, featureCollection, request); }
GetFeatureRequest req = GetFeatureRequest.adapt(request);
/** @see WFSGetFeatureOutputFormat#getMimeType(Object, Operation) */ public String getMimeType(Object value, Operation operation) throws ServiceException { GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFormat = request.getOutputFormat(); String mimeType = ""; Format format = formats.get(outputFormat); if (format == null) { throw new WFSException("Unknown output format " + outputFormat); } else if (format.isSingleFile() && request.getQueries().size() <= 1) { if (format.getMimeType() != null) { mimeType = format.getMimeType(); } else { // use a default binary blob mimeType = "application/octet-stream"; } } else { mimeType = "application/zip"; } return mimeType; }
GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); if (request != null) { Map<String, ?> formatOptions = request.getFormatOptions();
protected void buildStoredQueries(EObject request, List<URI> storedQueryIds, Map kvp) { GetFeatureRequest req = GetFeatureRequest.adapt(request);
protected Encoder createEncoder( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { // reuse the WFS configuration feature builder, otherwise build a new one FeatureTypeSchemaBuilder schemaBuilder; if (configuration instanceof WFSConfiguration) { schemaBuilder = ((WFSConfiguration) configuration).getSchemaBuilder(); } else { schemaBuilder = new FeatureTypeSchemaBuilder.GML3(geoServer); } // create this request specific schema ApplicationSchemaXSD1 schema = new ApplicationSchemaXSD1(schemaBuilder); schema.setBaseURL(GetFeatureRequest.adapt(request).getBaseURL()); schema.setResources(resources); if (schema.getFeatureTypes().isEmpty()) { // no feature types so let's use the base WFS schema return new Encoder(configuration, configuration.schema()); } try { // let's just instantiate the encoder return new Encoder(configuration, schema.getSchema()); } catch (IOException exception) { throw new RuntimeException( "Error generating the XSD schema during the encoder instantiation.", exception); } }
@Override protected Configuration customizeConfiguration( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { FeatureTypeSchemaBuilder schemaBuilder = new FeatureTypeSchemaBuilder.GML32(geoServer); ApplicationSchemaXSD2 xsd = new ApplicationSchemaXSD2(schemaBuilder); xsd.setBaseURL(GetFeatureRequest.adapt(request).getBaseURL()); xsd.setResources(resources); org.geotools.wfs.v2_0.WFSConfiguration wfs = new org.geotools.wfs.v2_0.WFSConfiguration(); wfs.getDependency(GMLConfiguration.class) .setSrsSyntax( getInfo() .getGML() .get(WFSInfo.Version.V_20) .getSrsNameStyle() .toSrsSyntax()); ApplicationSchemaConfiguration2 config = new ApplicationSchemaConfiguration2(xsd, wfs); // adding properties from original configuration to allow // hints handling config.getProperties().addAll(configuration.getProperties()); return config; }
private TransformInfo locateTransformation(FeatureCollectionResponse collections, Operation operation) throws IOException { GetFeatureRequest req = GetFeatureRequest.adapt(operation.getParameters()[0]); String outputFormat = req.getOutputFormat(); // locate the transformation, and make sure it's the same for all feature types Set<FeatureType> featureTypes = getFeatureTypes(collections); TransformInfo result = null; FeatureType reference = null; for (FeatureType ft : featureTypes) { TransformInfo curr = locateTransform(outputFormat, ft); if (curr == null) { throw new WFSException("Could not find a XSLT transformation generating " + outputFormat + " for feature type " + ft.getName(), "InvalidParameterValue", "typeName"); } else if (result == null) { reference = ft; result = curr; } else if (!result.equals(curr)) { throw new WFSException( "Multiple feature types are mapped to different XLST transformations, cannot proceed: " + result.getXslt() + ", " + curr.getXslt(), "InvalidParameterValue", "typeName"); } } return result; }
String featureId) { List<String> formats = getAvailableFormats(FeatureCollectionResponse.class); GetFeatureRequest request = GetFeatureRequest.adapt(operation.getParameters()[0]); FeatureTypeInfo featureType = getFeatureType(request); String baseUrl = request.getBaseUrl();
GetFeatureRequest.adapt( OwsUtils.parameter(operation.getParameters(), EObject.class)); if (gf != null) {