COCommand class documentation
COCommand : NSObject <COTrackNode>Overview
For each store change operation (e.g. branch creation, new revision etc.), there is a distinct command in the COCommand class hierarchy.
A commit is not atomic, if it spans several persistent roots. Non-atomic commits are represented as a COCommandGroup that contains one or more command objects to describe each store structure change independently.
If you make multiple store structure changes on a single persistent root (e.g. branch creation and new revision at the same time), the command group is going to contain several commands just for a single persistent root.
Basic Properties
- - (NSString *) kind
A localized string describing the command.
For example, -[COCommandDeletePersistentRoot kind] returns Persistent Root Deletion.
- - (COUndoTrack *) parentUndoTrack
The undo track on which the command was recorded.
Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .
- - (void) setParentUndoTrack: (COUndoTrack *)parentUndoTrack
The undo track on which the command was recorded.
Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .
- - (ETUUID *) storeUUID
The UUID of the store against which the changes were or would be committed (for an inverse).
- - (void) setStoreUUID: (ETUUID *)storeUUID
The UUID of the store against which the changes were or would be committed (for an inverse).
- - (ETUUID *) persistentRootUUID
The UUID of the persistent root to which the changes were or would be applied (for an inverse).
- - (void) setPersistentRootUUID: (ETUUID *)persistentRootUUID
The UUID of the persistent root to which the changes were or would be applied (for an inverse).
- - (id <COTrackNode>) parentNode
Returns nil.
An atomic command belongs to a command group which has a parent command.
- - (id <COTrackNode>) mergeParentNode
Returns nil.
Applying and Reverting Changes
- - (COCommand *) inverse
Returns a command that represents an inverse action.
You can use the inverse to unapply the receiver changes in an editing context.
[[command inverse] inverse] must be equal [command inverse].
A single command corresponds to an atomic operation inside a commit (e.g. just a branch creation or just a new revision).
For each commit, single commands are grouped into a COCommandGroup.
- - (BOOL) canApplyToContext: (COEditingContext *)aContext
Returns whether the receiver changes can be applied to the editing context.
- - (void) applyToContext: (COEditingContext *)aContext
Applies the receiver changes to the editing context.
- - (void) addToStoreTransaction: (COStoreTransaction *)txn withRevisionMetadata: (NSDictionary *)metadata assumingEditingContextState: (COEditingContext *)ctx
Applies the receiver changes directly to a store transaction.
Framework Private
- + (COCommand *) commandWithPropertyList: (id)aPlist parentUndoTrack: (COUndoTrack *)aParent
- - (id) initWithPropertyList: (id)plist parentUndoTrack: (COUndoTrack *)aParent
Initializes and returns a command deserialized from a property list.