org.geotools.data.wfs.v1_0_0
Class WFSTransactionState

Object
  extended by WFSTransactionState
All Implemented Interfaces:
Transaction.State

public class WFSTransactionState
extends Object
implements Transaction.State

Hold the list of actions to perform in the Transaction.

Author:
dzwiers

Constructor Summary
WFSTransactionState(WFS_1_0_0_DataStore ds)
           
 
Method Summary
 void addAction(String typeName, Action a)
           
 void addAuthorization(String AuthID)
          Call back used for Transaction.setAuthorization()
protected  void combineActions()
          Combines updates and inserts reducing the number of actions in the commit.
 void commit()
          Call back used for Transaction.commit()
 List<Action> getActions(String typeName)
           
 List<Action> getAllActions()
          Returns all the actions for all FeatureTypes
 String[] getFids(String typeName)
           
 String getLockId()
          Not implemented
 String nextFid(String typeName)
           
 void rollback()
          Call back used for Transaction.rollback()
 void setTransaction(Transaction transaction)
          Provides configuration information for Transaction.State setTransaction is called with non null transaction when Transaction.State is putState into a Transaction.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WFSTransactionState

public WFSTransactionState(WFS_1_0_0_DataStore ds)
Parameters:
ds -
Method Detail

setTransaction

public void setTransaction(Transaction transaction)
Description copied from interface: Transaction.State
Provides configuration information for Transaction.State

setTransaction is called with non null transaction when Transaction.State is putState into a Transaction. This tranasction will be used to determine correct event notification.

setTransaction is called with null when removeState is called (usually during Transaction.close() ).

Specified by:
setTransaction in interface Transaction.State
See Also:
Transaction.State.setTransaction(org.geotools.data.Transaction)

addAuthorization

public void addAuthorization(String AuthID)
Description copied from interface: Transaction.State
Call back used for Transaction.setAuthorization()

Specified by:
addAuthorization in interface Transaction.State
See Also:
Transaction.State.addAuthorization(java.lang.String)

getLockId

public String getLockId()
Not implemented

Returns:
String

commit

public void commit()
            throws IOException
Description copied from interface: Transaction.State
Call back used for Transaction.commit()

Specified by:
commit in interface Transaction.State
Throws:
IOException
See Also:
Transaction.State.commit()

rollback

public void rollback()
Description copied from interface: Transaction.State
Call back used for Transaction.rollback()

Specified by:
rollback in interface Transaction.State
See Also:
Transaction.State.rollback()

getFids

public String[] getFids(String typeName)
Returns:
Fid Set

addAction

public void addAction(String typeName,
                      Action a)
Parameters:
a -

getActions

public List<Action> getActions(String typeName)
Returns:
List of Actions

getAllActions

public List<Action> getAllActions()
Returns all the actions for all FeatureTypes

Returns:
all the actions for all FeatureTypes

combineActions

protected void combineActions()
Combines updates and inserts reducing the number of actions in the commit.

This is in response to an issue where the FID is not known until after the commit so if a Feature is inserted then later updated(using a FID filter to identify the feature to update) within a single transactin then the commit will fail because the fid filter will be not apply once the insert action is processed.

For Example:

  1. Insert Feature.

    Transaction assigns it the id: NewFeature.

  2. Update Feature.

    Fid filter is used to update NewFeature.

  3. Commit.

    Update will fail because when the Insert action is processed NewFeature will not refer to any feature.

The algorithm is essentially foreach( insertAction ){ Apply each update and Delete action that applies to the inserted feature move insertAction to end of list }

Mind you this only works assuming there aren't any direct dependencies between the actions beyond the ones specified by the API. For example if the value of an update depends directly on an earlier feature object (which is bad practice and should never be done). Then we may have problems with this solution. But I think that this solution is better than doing nothing because at least in the proper use of the API the correct result will be obtained. Whereas before the correct use of the API could obtain incorrect results.


nextFid

public String nextFid(String typeName)


Copyright © 1996-2014 Geotools. All Rights Reserved.