/*! @header FTGraphImplTransactions @abstract Module of FT @availability OS X, GNUstep @copyright 2004, 2005, 2006 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  -------------------------------------------------------------------------
  Modification history

  05.06.05 ola     initial version
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  
*/ #if !defined(__FTGraphImplTransactions_H) #define __FTGraphImplTransactions_H #include #include #include #include #include #include #include @class FTGraphImpl; /*! * @enum __FTGraphImplTransactionType * @abstract types of transaction */ enum __FTGraphImplTransactionType { __FTGRAPHIMPL_TX_UNKNOWN = 0, __FTGRAPHIMPL_TX_NODE_UPDATE, __FTGRAPHIMPL_TX_NODE_REMOVE }; /*! * @class FTGraphImplTransactions * @abstract Instances of this class resemble actions within a transaction. * These actions are related to {@link FTGraphImpl} instances. */ @interface FTGraphImplTransactions : FTObject { @private BOOL operationEnabled; } /*! * @method addGenericContextData * @abstratc Internal method for common entries to the context * @param node to add * @param graph to add * @param operation specifying the kind of operation to execute. * @param context to modify */ + (void) addGenericContextData:(FTNodeImpl *) node graph: (FTGraphImpl *) graph operation: (int) operation toContext: (FTTransactionContext *) context; /*! * @method createForDeletionOfNode * @abstract Creates a transaction used to remove a node * @param node node to remove * @param context transaction context to be used * @result transaction step which is initialized correspondingly */ + (FTGraphImplTransactions *) createForDeletionOfNode: (FTNodeImpl *) node withContext: (FTTransactionContext *) context withGraph: (FTGraphImpl *) graph; /*! * @method createForNodeUpdate * @abstract Creates a transaction used to update a node * @param node node to update * @param context transaction context to be used * @result transaction step which is initialized correspondingly */ + (FTGraphImplTransactions *) createForUpdateOfNode: (FTNodeImpl *) node withContext: (FTTransactionContext *) context withGraph: (FTGraphImpl *) graph; /** * @method enableOperation * @param doEnable set this to NO to disable any actions during a transaction * By default the value equals YES * @result self */ - enableOperation: (BOOL) doEnable; /*! * @method nodeFromContext * @abstract Utilitiy method to fetch the graph parameter from the transaction * context * @result graph parameter of transaction context or nil if not existent */ - (FTGraphImpl *) graphFromContext: (FTTransactionContext *) transactionContext; /*! * @method nodeFromContext * @abstract Utilitiy method to fetch the node parameter from the transaction * context * @result node parameter of transaction context or nil if not existent */ - (FTNodeImpl *) nodeFromContext: (FTTransactionContext *) transactionContext; /*! * @method operationIdFromContext * @abstract internal method to parse the current context in order to * determine the operation id * @param transactionContext underlying context * @result operation id */ + (enum __FTGraphImplTransactionType) operationIdFromContext: (FTTransactionContext *) transactionContext; /*! * @method performAction * @abstract Called by the transaction controll in order to run the * transaction * @result return information about the success of this operation * @throws ECIllegalStateException if the transaction context is not in * consistent state */ - (BOOL) performAction: (FTTransactionContext *) transactionContext; /*! * @method performDeletionWithContext * @abstract Performs the deletion of a node * @param transactionContext underlying context * @param aGraph related graph * @result YES in case of success */ - (BOOL) performDeletionWithContext: (FTTransactionContext *) transactionContext withGraph: (FTGraphImpl *) aGraph; /*! * @method performUpdate * @abstract performs an update of a node * @method performUpdate * @param transactionContext * @result YES on success */ - (BOOL) performUpdateWithContext: (FTTransactionContext *) transactionContext withGraph: (FTGraphImpl *) aGraph; /*! * @method undoAction * @abstract removes all modifications previously been done by * {@link #performAction} * @result return YES if done successfully */ - (BOOL) undoAction: (FTTransactionContext *) transactionContext; @end #endif