DADeltaChange
Overview
A DADeltaChange represents a single changed table row within DADelta object. DADeltaChange object is used as an intermediate container for passing changes in a DADataTableRow} to the server side for committing, and for merging changes that come back from server with table rows on the client side.
Tasks
Creating DADeltaChange Object
*initWithDelta:andTableRow:andId: *changeWithDelta:andTableRow:andId:
Getting values from DADeltaChange
*valueForField: *oldValueForField:
Setting values to DADeltaChange
*setValue:forField: *setOldValue:forField:
Location
- Reference: DADelta.h
- Namespace: DataAbstract
- Ancestry: NSObject | DADeltaChange
changeId assign
Represents identification for a given change. The integer value should be unique for each change inside a certain DADelta object. It usually starts with 1100 and grows by one for each change.
@property (assign) int changeId
changeMessage retain
Represents the exception message if the change failed to apply on the server side.
@property (retain) NSString *changeMessage
changeStatus assign
Represents the status of the current change.
@property (assign) enum DAChangeStatus changeStatus
changeType assign
Represents the type (Insert, Update or Delete) of the current change.
@property (assign) enum DAChangeType changeType
changeWithDelta:andTableRow:andId:
Creates and initializes changes with values from a given table row and with a given change identifier. It extracts all changes from a given DADataTableRow automatically.
+ (id) changeWithDelta:(DADelta *)ownerDelta andTableRow:(DADataTableRow *)row andId:(int)anId
Parameters:
- ownerDelta: Reference to a parent DADelta object that owns the created change.
- row: Reference to the original DADataTableRow for which that change is created.
- anId: New integer identifier for the created change.
DADataTableRowStateToDAChangeType:
- (enum DAChangeType) DADataTableRowStateToDAChangeType:(enum DADataTableRowState)aValue
Parameters:
- aValue:
delta
Represents the reference to The parent DADelta object to which this change belongs.
@property (readonly) DADelta *delta
fields
Represents an array of the DAFieldDefinition of all fields used in the current change.
@property (readonly) NSArray *fields
initWithDelta:andTableRow:andId:
- (InstanceType) initWithDelta:(DADelta *)ownerDelta andTableRow:(DADataTableRow *)row andId:(int)anId
Parameters:
- ownerDelta:
- row:
- anId:
oldValueForField:
Returns the old (original) value for a given field name in a delta change.
- (id) oldValueForField:(NSString *)fieldName
Parameters:
- fieldName: Name of the field for which we want to get the original value.
originalRow
References the original row from which this change was built; this can be used for quickly locating a record on the client side during the merging of deltas that come back from the server side.
@property (readonly) DADataTableRow *originalRow
setOldValue:forField:
Set old (original) value for given field name in delta change.
- (void) setOldValue:(id)value forField:(NSString *)fieldName
Parameters:
- value: Original field value we want to set.
- fieldName: Name of the field for which we want to set original value.
setValue:forField:
Sets the new (changed) value for a given field name in a delta change.
- (void) setValue:(id)value forField:(NSString *)fieldName
Parameters:
- value: Changed field value we want to set.
- fieldName: Name of the field for which we want to set the original value.
updateWithChange:
- (void) updateWithChange:(DADeltaChange *)change
Parameters:
- change:
valueForField:
Returns new (changed) value for given field name in delta change.
- (id) valueForField:(NSString *)fieldName
Parameters:
- fieldName: Name of the field for which we want to set the original value.
valueForField:getOriginal:
- (id) valueForField:(NSString *)aField getOriginal:(BOOL)aOriginal
Parameters:
- aField:
- aOriginal:
changeId assign
Represents identification for a given change. The integer value should be unique for each change inside a certain DADelta object. It usually starts with 1100 and grows by one for each change.
@property (assign) int changeId
changeMessage retain
Represents the exception message if the change failed to apply on the server side.
@property (retain) NSString *changeMessage
changeStatus assign
Represents the status of the current change.
@property (assign) enum DAChangeStatus changeStatus
changeType assign
Represents the type (Insert, Update or Delete) of the current change.
@property (assign) enum DAChangeType changeType
delta
Represents the reference to The parent DADelta object to which this change belongs.
@property (readonly) DADelta *delta
fields
Represents an array of the DAFieldDefinition of all fields used in the current change.
@property (readonly) NSArray *fields
originalRow
References the original row from which this change was built; this can be used for quickly locating a record on the client side during the merging of deltas that come back from the server side.
@property (readonly) DADataTableRow *originalRow
changeWithDelta:andTableRow:andId:
Creates and initializes changes with values from a given table row and with a given change identifier. It extracts all changes from a given DADataTableRow automatically.
+ (id) changeWithDelta:(DADelta *)ownerDelta andTableRow:(DADataTableRow *)row andId:(int)anId
Parameters:
- ownerDelta: Reference to a parent DADelta object that owns the created change.
- row: Reference to the original DADataTableRow for which that change is created.
- anId: New integer identifier for the created change.
DADataTableRowStateToDAChangeType:
- (enum DAChangeType) DADataTableRowStateToDAChangeType:(enum DADataTableRowState)aValue
Parameters:
- aValue:
initWithDelta:andTableRow:andId:
- (InstanceType) initWithDelta:(DADelta *)ownerDelta andTableRow:(DADataTableRow *)row andId:(int)anId
Parameters:
- ownerDelta:
- row:
- anId:
oldValueForField:
Returns the old (original) value for a given field name in a delta change.
- (id) oldValueForField:(NSString *)fieldName
Parameters:
- fieldName: Name of the field for which we want to get the original value.
setOldValue:forField:
Set old (original) value for given field name in delta change.
- (void) setOldValue:(id)value forField:(NSString *)fieldName
Parameters:
- value: Original field value we want to set.
- fieldName: Name of the field for which we want to set original value.
setValue:forField:
Sets the new (changed) value for a given field name in a delta change.
- (void) setValue:(id)value forField:(NSString *)fieldName
Parameters:
- value: Changed field value we want to set.
- fieldName: Name of the field for which we want to set the original value.
updateWithChange:
- (void) updateWithChange:(DADeltaChange *)change
Parameters:
- change:
valueForField:
Returns new (changed) value for given field name in delta change.
- (id) valueForField:(NSString *)fieldName
Parameters:
- fieldName: Name of the field for which we want to set the original value.
valueForField:getOriginal:
- (id) valueForField:(NSString *)aField getOriginal:(BOOL)aOriginal
Parameters:
- aField:
- aOriginal: