Class TLcdWFSTransactionRequest

java.lang.Object
com.luciad.ogc.wfs.client.TLcdWFSTransactionRequest
All Implemented Interfaces:
ILcdOWSRequest

public class TLcdWFSTransactionRequest extends Object implements ILcdOWSRequest
A WFS Transaction request. Instances of this class can not be created directly. An instance can be created using the TLcdWFSClient.createTransactionRequest() method. This method will ensure a request object is created that is compatible with the WFS version implemented by the WFS server.

This class will preserve the order in which the methods are called, to determine the order of transaction actions in the request. For update transactions, it is important to first invoke updateFeatures(QName, TLcdOGCFilter, String) for each action, followed by invoking addPropertyToUpdate(...) to specify which feature properties should be updated.

This WFS transaction request does not support KVP encoding.

Since:
10.0
  • Method Details

    • updateFeatures

      public void updateFeatures(QName aTypeName, TLcdOGCFilter aFilter, String aHandle)
      Adds an "Update" element to the transaction. This method is used to specify the features that should be updated. The actual properties of the selected features should be specified using the addPropertyToUpdate(java.util.List<com.luciad.datamodel.TLcdDataProperty>, java.lang.Object) method.

      This update will be removed from the transaction if a call to this method is immediately followed by a method which adds another update, insert or delete part of the transaction.

      The order in which this method is called with respect to other insert, update or delete methods will be preserved.

      Parameters:
      aTypeName - The name of the feature type which will be updated.
      aFilter - A filter which selects the features that should be updated.
      aHandle - A handle which will be used by the server in an exception report if present. Can be set to null.
      See Also:
    • addPropertyToUpdate

      public void addPropertyToUpdate(List<TLcdDataProperty> aProperties, Object aValue) throws IllegalStateException
      Adds a property which should be changed by a previously initiated "Update" element. A call to this method should be preceded by a call to updateFeatures(javax.xml.namespace.QName, com.luciad.ogc.filter.model.TLcdOGCFilter, java.lang.String).

      Properties will be sent to the server in the order in which they are added to this request.

      Parameters:
      aProperties - The List of properties which represents a path from the feature to the property to update which is represented by aValue, The List can not contain many-valued properties.
      aValue - The new value of the specified property, can be null in case the property should be removed. This value should not be a collection, use predicates to update collections.
      Throws:
      IllegalStateException - In case the previously added transaction element is not an "Update".
      See Also:
    • addPropertyToUpdate

      public void addPropertyToUpdate(List<TLcdDataProperty> aProperties, List<Integer> aPredicates, Object aValue) throws IllegalStateException
      Adds a property which should be changed by a previously initiated "Update" element. A call to this method should be preceded by a call to updateFeatures(javax.xml.namespace.QName, com.luciad.ogc.filter.model.TLcdOGCFilter, java.lang.String).

      Properties will be sent to the server in the order in which they are added to this request.

      This method takes an extra list of 'predicates' that will be encoded in the xpath. A predicate is used with many-valued properties to point to a specific element in a list of values. Predicates are in general required for all many-valued properties but the last one in the list.

      Specify a predicate for the last TLcdDataProperty in aProperties to replace or remove a specific element from a list of elements. Adding elements to lists of elements is not specified by the WFS 1.0/1.1 specification.

      Parameters:
      aProperties - The List of properties which represents a path from the feature to the property to update which is represented by aValue, The List can not contain many-valued properties.
      aPredicates - An optional list of predicates that matches aProperties.
      aValue - The new value of the specified property, can be null in case the property should be removed.
      Throws:
      IllegalStateException - In case the previously added transaction element is not an "Update".
      See Also:
    • deleteFeatures

      public void deleteFeatures(QName aTypeName, TLcdOGCFilter aFilter, String aHandle)
      Specifies the features which should be deleted by the server. Each call of this method will add a new "delete" request to the transaction.

      The order in which this method is called with respect to other insert, update or delete methods will be preserved.

      Parameters:
      aTypeName - The type of the features that should be deleted, this should correspond to a type which is available on the server.
      aFilter - The filter which specifies the features of aTypeName that will be deleted. The server will return an exception in case the filter is not set.
      aHandle - If set, the server will use this handle in an exception report if this part of the transaction fails.
    • insertFeatures

      public void insertFeatures(List<ILcdDataObject> aFeatures, String aHandle)
      Adds a list of GML features which should be inserted on the server. The list can also contain a feature collection which will be sent to the server as is. The GML version of the features should either match the corresponding WFS version, or should be explicitly specified as a supported input format by the server.

      The order in which this method is called with respect to other insert, update or delete methods will be preserved.

      Parameters:
      aFeatures - A list of features which should be added to the server.
      aHandle - A String that identifies this operation. If present, it will be used in any exception reports that might be returned by the server. Set to null if no handle is required.
    • setReleaseAction

      public void setReleaseAction(TLcdWFSTransactionRequest.ReleaseAction aReleaseAction)
      Sets the release action attribute on this request.

      The releaseAction attribute is used to control how a Web Feature service releases locks on feature instances after a Transaction request has been processed.

      Valid values are the constants ALL or SOME, as defined in this class. Setting this value to any other value results in undefined behaviour.

      A value of ALL means that the Web Feature Service shall release the locks of all feature instances locked with the specified lockId regardless or whether or not the features were actually modified.

      A value of SOME means that the Web Feature Service will only release the locks held on feature instances that were actually operated upon by the transaction. The lockId that the client application obtained shall remain valid and the other, unmodified, feature instances shall remain locked.

      The default release action is ALL.

      Parameters:
      aReleaseAction - The release action which should be equal to ALL or SOME.
      See Also:
    • setLockId

      public void setLockId(String aLockId)
      Sets a previously obtained lock id on this request. A lock id can be obtained with a lockFeature or getFeatureWithLock request. The given id should match a valid lock which locks at least all features which are operated upon by this request.

      You do not need a lock id in case the features are not locked or the server does not support locking.

      Parameters:
      aLockId - A valid lock id obtained from the server, or null if no lock id should be used.
    • setHandle

      public void setHandle(String aHandle)
      Sets the optional handle of this request. A handle will be used in exception reports to identify the failed request.
      Parameters:
      aHandle - A String which can be used to identify this request, or null if no handle should be used.
    • setModelReferenceFormatter

      public void setModelReferenceFormatter(ILcdModelReferenceFormatter aReferenceFormatter)
      Sets a reference formatter to format a model reference (i.e., an instance of ILcdModelReference) to a String in the transaction request encoding. This can be used to support servers that use custom reference names. If none is set, a model reference will by default be encoded to an EPSG code; if there is no EPSG code available for the reference, the encoding of the request will fail.
      Parameters:
      aReferenceFormatter - A valid model reference formatter.
      Since:
      2012.1
    • getModelReferenceFormatter

      public ILcdModelReferenceFormatter getModelReferenceFormatter()
      Returns the model reference formatter of this transaction request. By default, no explicit model reference formatter is set and null is returned; in this case, model references are formatted as EPSG codes.
      Returns:
      A model reference formatter or null.
      Since:
      2012.1
      See Also:
    • getKVPEncoding

      public Map getKVPEncoding()
      Transaction requests do not support KVP encoding.
      Specified by:
      getKVPEncoding in interface ILcdOWSRequest
      Returns:
      null, indicating that KVP encoding is not supported for Transaction requests.
    • getTransportData

      public Object getTransportData()
      Returns an object representing data to be used by the transportation layer (see ILcdOWSTransport) to perform this OGC Web Service request. The type of object and the data contained in it depends on the ILcdOWSTransport object used to perform this request.

      An example in the case of a HTTP transport connection is a map of request properties (see URLConnection.getRequestProperties()) to be used for the request.

      Specified by:
      getTransportData in interface ILcdOWSRequest
      Returns:
      an object representing data to be used by the transportation layer to perform this OGC Web Service request.
    • getXMLEncoding

      public InputStream getXMLEncoding()
      Returns the XML encoding of this request.

      If no XML encoding is supported for this request, nullshould be returned.

      Specified by:
      getXMLEncoding in interface ILcdOWSRequest
      Returns:
      the XML representation of this request.
    • getRestEncoding

      public URI getRestEncoding(URI aBaseURI)
      Returns null, REST encoding is not supported.
      Specified by:
      getRestEncoding in interface ILcdOWSRequest
      Parameters:
      aBaseURI -
      Returns:
      null
      Since:
      2013.0