org.vfny.geoserver.requests.wfs
Class InsertRequest

java.lang.Object
  extended byorg.vfny.geoserver.requests.wfs.SubTransactionRequest
      extended byorg.vfny.geoserver.requests.wfs.InsertRequest

public class InsertRequest
extends SubTransactionRequest

Represents a request for an insert operation. Does some type checking by making sure that all features added have the same schema names (which is also the type name). TODO: add increased typechecking, make sure schemas match one another.


Field Summary
protected  java.lang.String typeName
          Specifies the table of features
 
Fields inherited from class org.vfny.geoserver.requests.wfs.SubTransactionRequest
DELETE, handle, INSERT, UPDATE
 
Constructor Summary
InsertRequest()
          Empty constructor.
 
Method Summary
 void addFeature(org.geotools.feature.Feature feature)
          Adds a feature to this insert request.
 void addFeatures(org.geotools.feature.Feature[] features)
          Convenience method to add an array of features.
 boolean equals(java.lang.Object obj)
          Override of equals.
 org.geotools.feature.FeatureCollection getFeatures()
          Returns the features contained in this request.
 short getOpType()
          Returns the insert short.
 boolean getReleaseAll()
          Gets whether all locked features should be released after this transaction, or only those that were affected.
 java.lang.String getTypeName()
          Returns the type name of the features held in this request.
 void setFilter(org.geotools.filter.Filter filter)
          Filters can not be added to an insert request.
 void setReleaseAll(boolean releaseAll)
          Sets whether all locked features should be released after this transaction, or only those that were affected.
 void setTypeName(java.lang.String typeName)
          Sets the name.
 java.lang.String toString()
          Gets the string representation of this request.
 
Methods inherited from class org.vfny.geoserver.requests.wfs.SubTransactionRequest
getHandle, setHandle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

typeName

protected java.lang.String typeName
Specifies the table of features

Constructor Detail

InsertRequest

public InsertRequest()
Empty constructor.

Method Detail

getReleaseAll

public boolean getReleaseAll()
Gets whether all locked features should be released after this transaction, or only those that were affected.

Returns:
true if all locked features should be released.

setReleaseAll

public void setReleaseAll(boolean releaseAll)
Sets whether all locked features should be released after this transaction, or only those that were affected.

Parameters:
releaseAll - whether all locked features should be released.

addFeature

public void addFeature(org.geotools.feature.Feature feature)
                throws WfsException
Adds a feature to this insert request. Currently fairly permissive, just checks that the typenames match. The datasource will eventually complain, but it would be nice to do some more type-checking, to make sure the schemas match.

Parameters:
feature - To be inserted into the database.
Throws:
WfsException - if added typeName does not match the set typeNames.

addFeatures

public void addFeatures(org.geotools.feature.Feature[] features)
                 throws WfsException
Convenience method to add an array of features. See addFeature.

Parameters:
features - array of features to be inserted.
Throws:
WfsException - if the typeNames don't match.

getTypeName

public java.lang.String getTypeName()
Returns the type name of the features held in this request.

Overrides:
getTypeName in class SubTransactionRequest
Returns:
the typeName.

setTypeName

public void setTypeName(java.lang.String typeName)
Sets the name. This method should generally not be used, as features that are added set their own name and throw exceptions if they don't match the typename. But this can be set before adding features if you want to ensure that they all match this name.

Overrides:
setTypeName in class SubTransactionRequest
Parameters:
typeName - the name of the schema of the added features.

getFeatures

public org.geotools.feature.FeatureCollection getFeatures()
Returns the features contained in this request.

Returns:
the array of features.

setFilter

public void setFilter(org.geotools.filter.Filter filter)
               throws WfsException
Filters can not be added to an insert request. This is just an override of the setFilter method that throws an exception if called.

Overrides:
setFilter in class SubTransactionRequest
Parameters:
filter - a filter.
Throws:
WfsException - if called at all.

getOpType

public short getOpType()
Returns the insert short.

Specified by:
getOpType in class SubTransactionRequest
Returns:
the short representation of INSERT.

toString

public java.lang.String toString()
Gets the string representation of this request.

Returns:
A string of the handle, releaseAll status, typeName and features in this request.

equals

public boolean equals(java.lang.Object obj)
Override of equals.

Parameters:
obj - the object to test for equality.
Returns:
true if obj is equal to this.