Package org.opengis.cite.iso19142.util
Class WFSMessage
java.lang.Object
org.opengis.cite.iso19142.util.WFSMessage
Provides various utility methods for constructing, accessing, or manipulating the
content of WFS request and response messages.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddInsertStatement(Document request, Node feature) Appends a wfs:Insert element to the document element in the given request entity.static voidaddNamespaceBinding(Document doc, QName qName) Adds a namespace binding to the document element.static voidaddReplaceStatements(Document trxRequest, List<Element> replacements) Adds a sequence of wfs:Replace statements to the given transaction request entity.static voidaddResourceIdPredicate(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 voidaddTemporalPredicate(Document request, String temporalOp, Document gmlTime, Element valueRef) Adds a temporal predicate to a GetFeature request entity.static ElementappendSimpleQuery(Document doc, QName... qNames) Adds a simple wfs:Query element (without a filter) to the given request entity.static voidAdds a wfs:StoredQuery element to the given request entity.static booleancontainsGetProtocolBinding(Object[] testParams) Checks the given list of objects for the presence of aProtocolBinding.GETobject.static DocumentCreates a GML envelope covering the area of use for the "WGS 84" CRS (srsName="urn:ogc:def:crs:EPSG::4326").static DocumentcreateRequestEntity(String reqResource, String wfsVersion) Creates an XML request entity of the specified request type.static ElementcreateValueReference(org.apache.xerces.xs.XSElementDeclaration propertyElem) Creates an Element node (fes:ValueReference) containing an XPath expression derived from a property element declaration.extractFeatureIdentifiers(Document doc, QName featureType) Returns the set of feature identifiers found in the given WFS response entity.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 voidinsertGMLProperty(Element feature, Element gmlProperty) Inserts a standard GML property into a given feature instance.static ElementBuilds a filter predicate containing a fes:ResourceId element that identifies the feature instance to be modified.static voidsetReturnTypesAndTypeNamesAttribute(Document request, QName featureTypeName) Sets the attribute CreateStoredQuery/StoredQueryDefinition/QueryExpressionText/Query/@typeNames to the passed feature type name.static voidsetTypeName(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 StringtransformEntityToKVP(Source xmlSource) Transforms the XML representation of a WFS request entity to its corresponding KVP serialization format.static voidupdateVersion(Document doc, String wfsVersion) Sets the @version attribute in the root element of the doc to the specified versionstatic DocumentwrapEntityInSOAPEnvelope(Source xmlSource, String version) Wraps the given XML request entity in the body of a SOAP envelope.
-
Constructor Details
-
WFSMessage
public WFSMessage()
-
-
Method Details
-
transformEntityToKVP
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
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
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
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
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
Sets the @version attribute in the root element of the doc to the specified version- Parameters:
doc- the doc to update. nevernullwfsVersion- A WFS version identifier ("2.0.0" if not specified).
-
setTypeName
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
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
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 featuregmlProperty- An Element node representing a standard (non-deprecated) GML feature property.
-
createValueReference
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
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
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
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
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
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
Checks the given list of objects for the presence of aProtocolBinding.GETobject.- 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
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 isnull, the predicate applies to all temporal properties.
-
setReturnTypesAndTypeNamesAttribute
Sets the attribute CreateStoredQuery/StoredQueryDefinition/QueryExpressionText/Query/@typeNames to the passed feature type name.- Parameters:
request- request to modify, nevernullfeatureTypeName- name to set, nevernull
-