Package org.opengis.cite.iso19142.util

# Class WFSMessage

java.lang.Object
org.opengis.cite.iso19142.util.WFSMessage

public class WFSMessage extends Object
Provides various utility methods for constructing, accessing, or manipulating the content of WFS request and response messages.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WFSMessage()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addInsertStatement(Document request, Node feature)`
  Appends a wfs:Insert element to the document element in the given request entity.
  `static void`
  `addNamespaceBinding(Document doc, QName qName)`
  Adds a namespace binding to the document element.
  `static void`
  `addReplaceStatements(Document trxRequest, List<Element> replacements)`
  Adds a sequence of wfs:Replace statements to the given transaction request entity.
  `static void`
  `addResourceIdPredicate(Document request, Set<String> idSet)`
  Adds a ResourceId predicate to a GetFeature (or GetFeatureWithLock) request entity that contains a simple query expression without a filter.
  `static void`
  `addTemporalPredicate(Document request, String temporalOp, Document gmlTime, Element valueRef)`
  Adds a temporal predicate to a GetFeature request entity.
  `static Element`
  `appendSimpleQuery(Document doc, QName... qNames)`
  Adds a simple wfs:Query element (without a filter) to the given request entity.
  `static void`
  `appendStoredQuery(Document doc, String queryId, Map<String,Object> params)`
  Adds a wfs:StoredQuery element to the given request entity.
  `static boolean`
  `containsGetProtocolBinding(Object[] testParams)`
  Checks the given list of objects for the presence of a `ProtocolBinding.GET` object.
  `static Document`
  `createGMLEnvelope()`
  Creates a GML envelope covering the area of use for the "WGS 84" CRS (srsName="urn:ogc:def:crs:EPSG::4326").
  `static Document`
  `createRequestEntity(String reqResource, String wfsVersion)`
  Creates an XML request entity of the specified request type.
  `static Element`
  `createValueReference(org.apache.xerces.xs.XSElementDeclaration propertyElem)`
  Creates an Element node (fes:ValueReference) containing an XPath expression derived from a property element declaration.
  `static Set<String>`
  `extractFeatureIdentifiers(Document doc, QName featureType)`
  Returns the set of feature identifiers found in the given WFS response entity.
  `static List<Node>`
  `findMatchingElements(Document doc, org.apache.xerces.xs.XSElementDeclaration... elemDeclarations)`
  Finds elements in a DOM Document that correspond to the given collection of element declarations.
  `static void`
  `insertGMLProperty(Element feature, Element gmlProperty)`
  Inserts a standard GML property into a given feature instance.
  `static Element`
  `newResourceIdFilter(String id)`
  Builds a filter predicate containing a fes:ResourceId element that identifies the feature instance to be modified.
  `static void`
  `setReturnTypesAndTypeNamesAttribute(Document request, QName featureTypeName)`
  Sets the attribute CreateStoredQuery/StoredQueryDefinition/QueryExpressionText/Query/@typeNames to the passed feature type name.
  `static void`
  `setTypeName(Element elem, QName qName)`
  Sets the value of the typeName attribute on an action element (wfs:Update, wfs:Delete) contained in a Transaction request entity.
  `static String`
  `transformEntityToKVP(Source xmlSource)`
  Transforms the XML representation of a WFS request entity to its corresponding KVP serialization format.
  `static void`
  `updateVersion(Document doc, String wfsVersion)`
  Sets the @version attribute in the root element of the doc to the specified version
  `static Document`
  `wrapEntityInSOAPEnvelope(Source xmlSource, String version)`
  Wraps the given XML request entity in the body of a SOAP envelope.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### WFSMessage

    public WFSMessage()

- ## Method Details

  - ### transformEntityToKVP

    public static String transformEntityToKVP(Source xmlSource)
    Transforms the XML representation of a WFS request entity to its corresponding KVP serialization format.
    Parameters:
      `xmlSource` - A Source representing the XML request entity.
    Returns:
      A String containing the resulting query component.

  - ### wrapEntityInSOAPEnvelope

    public static Document wrapEntityInSOAPEnvelope(Source xmlSource, String version)
    Wraps the given XML request entity in the body of a SOAP envelope.
    Parameters:
      `xmlSource` - The Source providing the XML request entity.
      `version` - The version of the SOAP protocol (either "1.1" or "1.2"); if not specified the latest version is assumed.
    Returns:
      A DOM Document node representing a SOAP request message.

  - ### appendSimpleQuery

    public static Element appendSimpleQuery(Document doc, QName... qNames)
    Adds a simple wfs:Query element (without a filter) to the given request entity. The typeNames attribute value is set using the supplied QName objects. Namespace bindings are added if necessary.
    Parameters:
      `doc` - A Document representing a WFS request entity that accepts wfs:Query elements as children of the document element (GetFeature, GetPropertyValue, GetFeatureWithLock, LockFeature).
      `qNames` - A sequence of QName objects representing (qualified) feature type names recognized by the IUT.
    Returns:
      The Element representing the query expression (wfs:Query); it will be empty.

  - ### appendStoredQuery

    public static void appendStoredQuery(Document doc, String queryId, Map<String,Object> params)
    Adds a wfs:StoredQuery element to the given request entity.
    Parameters:
      `doc` - A Document representing a WFS request entity that accepts wfs:StoredQuery elements as children of the document element (GetFeature, GetPropertyValue, GetFeatureWithLock, LockFeature).
      `queryId` - A URI that identifies the stored query to invoke.
      `params` - A Map containing query parameters (may be empty, e.g. Collections.<String, Object>.emptyMap()). A parameter name is associated with an Object (String or QName) representing its value.

  - ### createRequestEntity

    public static Document createRequestEntity(String reqResource, String wfsVersion)
    Creates an XML request entity of the specified request type.
    Parameters:
      `reqResource` - The name of a classpath resource containing an XML request entity.
      `wfsVersion` - A WFS version identifier ("2.0.0" if not specified).
    Returns:
      A Document representing a WFS request entity.

  - ### updateVersion

    public static void updateVersion(Document doc, String wfsVersion)
    Sets the @version attribute in the root element of the doc to the specified version
    Parameters:
      `doc` - the doc to update. never `null`
      `wfsVersion` - A WFS version identifier ("2.0.0" if not specified).

  - ### setTypeName

    public static void setTypeName(Element elem, QName qName)
    Sets the value of the typeName attribute on an action element (wfs:Update, wfs:Delete) contained in a Transaction request entity.
    Parameters:
      `elem` - An action element in a transaction request.
      `qName` - The qualified name of a feature type.

  - ### newResourceIdFilter

    public static Element newResourceIdFilter(String id)
    Builds a filter predicate containing a fes:ResourceId element that identifies the feature instance to be modified.
    Parameters:
      `id` - A String denoting a GML object identifier (gml:id).
    Returns:
      An Element node (fes:Filter).

  - ### insertGMLProperty

    public static void insertGMLProperty(Element feature, Element gmlProperty)
    Inserts a standard GML property into a given feature instance. If the property node already exists it is replaced.
    Parameters:
      `feature` - An Element node representing a GML feature
      `gmlProperty` - An Element node representing a standard (non-deprecated) GML feature property.

  - ### createValueReference

    public static Element createValueReference(org.apache.xerces.xs.XSElementDeclaration propertyElem)
    Creates an Element node (fes:ValueReference) containing an XPath expression derived from a property element declaration.
    Parameters:
      `propertyElem` - An element declaration that defines some feature property.
    Returns:
      An Element containing an XPath expression and an appropriate namespace binding.

  - ### createGMLEnvelope

    public static Document createGMLEnvelope()
    Creates a GML envelope covering the area of use for the "WGS 84" CRS (srsName="urn:ogc:def:crs:EPSG::4326").
    Returns:
      A Document containing gml:Envelope as the document element.

  - ### addNamespaceBinding

    public static void addNamespaceBinding(Document doc, QName qName)
    Adds a namespace binding to the document element.
    Parameters:
      `doc` - A Document representing a request entity.
      `qName` - A QName containing a namespace URI and prefix; the local part is ignored.

  - ### addReplaceStatements

    public static void addReplaceStatements(Document trxRequest, List<Element> replacements)
    Adds a sequence of wfs:Replace statements to the given transaction request entity.
    Parameters:
      `trxRequest` - A Document node representing a wfs:Transaction request entity.
      `replacements` - A List containing replacement feature representations (as GML).

  - ### addInsertStatement

    public static void addInsertStatement(Document request, Node feature)
    Appends a wfs:Insert element to the document element in the given request entity. The wfs:Insert element contains the supplied feature instance.
    Parameters:
      `request` - A Document node representing a wfs:Transaction request entity.
      `feature` - A Node representing a GML feature instance.

  - ### addResourceIdPredicate

    public static void addResourceIdPredicate(Document request, Set<String> idSet)
    Adds a ResourceId predicate to a GetFeature (or GetFeatureWithLock) request entity that contains a simple query expression without a filter. The identifiers should match features of the indicated type.
    Parameters:
      `request` - The request entity (/wfs:GetFeature/[wfs:Query]).
      `idSet` - A Set<String> of feature identifiers that conform to the xsd:ID datatype.

  - ### containsGetProtocolBinding

    public static boolean containsGetProtocolBinding(Object[] testParams)
    Checks the given list of objects for the presence of a `ProtocolBinding.GET` object.
    Parameters:
      `testParams` - A list of objects representing test method parameters.
    Returns:
      true if a ProtocolBinding#GET object was found; false otherwise.

  - ### findMatchingElements

    public static List<Node> findMatchingElements(Document doc, org.apache.xerces.xs.XSElementDeclaration... elemDeclarations)
    Finds elements in a DOM Document that correspond to the given collection of element declarations.
    Parameters:
      `doc` - A Document node containing an XML entity.
      `elemDeclarations` - A collection of element declarations.
    Returns:
      A list of matching element nodes (it may be empty).

  - ### extractFeatureIdentifiers

    public static Set<String> extractFeatureIdentifiers(Document doc, QName featureType)
    Returns the set of feature identifiers found in the given WFS response entity.
    Parameters:
      `doc` - A WFS response entity that may contain feature instances.
      `featureType` - The feature type of interest.
    Returns:
      A set of feature identifiers (gml:id attribute values); it may be empty.

  - ### addTemporalPredicate

    public static void addTemporalPredicate(Document request, String temporalOp, Document gmlTime, Element valueRef)
    Adds a temporal predicate to a GetFeature request entity. If the given temporal element has no temporal reference (frame) it is assumed to use the default frame (ISO 8601).
    Parameters:
      `request` - The request entity (wfs:GetFeature).
      `temporalOp` - The name of a spatial operator.
      `gmlTime` - A Document containing a GML temporal primitive.
      `valueRef` - An Element (fes:ValueReference) that specifies the temporal property to check. If it is `null`, the predicate applies to all temporal properties.

  - ### setReturnTypesAndTypeNamesAttribute

    public static void setReturnTypesAndTypeNamesAttribute(Document request, QName featureTypeName)
    Sets the attribute CreateStoredQuery/StoredQueryDefinition/QueryExpressionText/Query/@typeNames to the passed feature type name.
    Parameters:
      `request` - request to modify, never `null`
      `featureTypeName` - name to set, never `null`