|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eoaccess.EODatabaseOperation
public class EODatabaseOperation
An EODatabaseOperation object represents an operation (insert, update, or delete) to perform on an Enterprise Object and all the necessary information required to perform that operation. You don't ordinarily create instances of EODatabaseOperation. Rather, the Framework automatically creates an EODatabaseOperation object for each new, updated, or deleted object in an EOEditingContext. An EODatabaseContext object analyzes a set of database operations and maps each operation to one or more adaptor operations. The adaptor operations are then performed by an EOAdaptorChannel object. You generally interact with EODatabaseOperation objects only if you need to specify the order in which a set of operations are carried out.
An EODatabaseOperation specifies the Enterprise Object (called "object") on
which the operation is performed, the EOGlobalID for the object, and the
object's entity. In addition, the database operation has a snapshot
containing the last known database values for the object and a
newRow
dictionary of new or updated values to save in the database.
EODatabaseContext.Delegate.databaseContextWillOrderAdaptorOperations(
EODatabaseContext dbCtxt, NSArray databaseOps)
Field Summary | |
---|---|
static int |
AdaptorDeleteOperator
An EOAdaptorOperation object that deletes a row in a database server. |
static int |
AdaptorInsertOperator
An EOAdaptorOperation object that inserts a row in a database server. |
static int |
AdaptorLockOperator
An EOAdaptorOperation object that locks a row in a database server. |
static int |
AdaptorStoredProcedureOperator
An EOAdaptorOperation object that executes a stored procedure in a database server. |
static int |
AdaptorUpdateOperator
An EOAdaptorOperation object that updates a row in a database server. |
static int |
DatabaseDeleteOperator
An EODatabaseOperation object that deletes an Enterprise Object. |
static int |
DatabaseInsertOperator
An EODatabaseOperation object that inserts an Enterprise Object. |
static int |
DatabaseNothingOperator
An EODatabaseOperation object that does nothing on an Enterprise Object. |
static int |
DatabaseUpdateOperator
An EODatabaseOperation object that updates an Enterprise Object. |
Constructor Summary | |
---|---|
EODatabaseOperation(EOGlobalID globalID,
Object object,
EOEntity entity)
Creates and returns a new EODatabaseOperation object, setting the Enterprise Object to which the operation will be applied to object , its globalID to globalID ,
and its entity to entity . |
Method Summary | |
---|---|
NSArray |
adaptorOperations()
Returns the EOAdaptorOperation objects that need to be performed to carry out the database operation represented by the receiver. |
void |
addAdaptorOperation(EOAdaptorOperation adaptorOp)
Adds adaptorOp to the receiver's list of adaptor operations. |
int |
databaseOperator()
Returns the receiver's database operator. |
NSDictionary |
dbSnapshot()
Returns the database snapshot for the receiver's Enterprise Object. |
EOEntity |
entity()
Returns the EOEntity that owns to the receiver's enterprise object. |
EOGlobalID |
globalID()
Returns the EOGlobalID object that corresponds to the receiver's Enterprise Object. |
NSMutableDictionary |
newRow()
Returns a dictionary representation of the receiver's enterprise object. |
Object |
object()
Returns the receiver's Enterprise Object. |
NSDictionary |
primaryKeyDiffs()
Returns a dictionary that contains any primary key values in newRow that are different from those in the object's
database snapshot. |
void |
recordToManySnapshot(NSArray gids,
String name)
Records the to-many snapshot gids for the relationship identified by
name , belonging to the receiver's Enterprise Object. |
void |
removeAdaptorOperation(EOAdaptorOperation adaptorOp)
Removes adaptorOp from the receiver's list of adaptor
operations. |
NSDictionary |
rowDiffs()
Returns the values in the receiver's newRow dictionary that are
different than the corresponding values in its dbSnapshot , in other
words, the new values for its Enterprise Object. |
NSDictionary |
rowDiffsForAttributes(NSArray atts)
Returns the values for the EOAttributes of the receiver's Enterprise Object specified in atts that are new or updated relative to the object's
database snapshot. |
void |
setDatabaseOperator(int databaseOperator)
Sets the receiver's database operator to databaseOperator ,
which must be one of the list below. |
void |
setDBSnapshot(NSDictionary dbSnapshot)
Sets the snapshot for the receiver's Enterprise Object. |
void |
setNewRow(NSMutableDictionary newRow)
Sets the dictionary representation of the receiver's enterprise object. |
NSDictionary |
toManySnapshots()
Returns the NSDictionary containing the snapshots for the to-many relationships of the receiver's Enterprise Object. |
String |
toString()
Returns a string representation of the receiver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DatabaseNothingOperator
public static final int DatabaseInsertOperator
public static final int DatabaseUpdateOperator
public static final int DatabaseDeleteOperator
public static final int AdaptorLockOperator
public static final int AdaptorInsertOperator
public static final int AdaptorUpdateOperator
public static final int AdaptorDeleteOperator
public static final int AdaptorStoredProcedureOperator
Constructor Detail |
---|
public EODatabaseOperation(EOGlobalID globalID, Object object, EOEntity entity)
object
, its globalID to globalID
,
and its entity to entity
.
globalID
- The unique identifier for object
.object
- The Enterprise Object on which the receiver will operate.entity
- The EOEntity to which object
belongs.Method Detail |
---|
public NSDictionary dbSnapshot()
EODatabaseOperation.setDatabaseOperator(int databaseOperator)
,
EOEditingContext
public void setDBSnapshot(NSDictionary dbSnapshot)
dbSnapshot
should
be an empty dictionary.
dbSnapshot
- The database snapshot for the receiver's
Enterprise Object, or an empty dictionary.public NSMutableDictionary newRow()
The newRow
dictionary is initialized with the values in
the receiver's snapshot. New or updated values are added to
newRow
(replacing out-of-date values) as the Enterprise Objects
Framework maps changes in the object to an operation.
public void setNewRow(NSMutableDictionary newRow)
newRow
should contain values for all the properties of the
Enterprise Object that are stored in the database and for the non-derived
attributes of the Enterprise Object's entity that aren't
visible in the Enterprise Object.
newRow
- A dictionary representation of the receiver's
Enterprise Object containing values for all properties
and non-derived attributes of the object.EODatabaseOperation.databaseOperator()
,
EOAttribute
public EOGlobalID globalID()
EODatabaseOperation.EODatabaseOperation(EOGlobalID aGlobalID,
Object anObject,
EOEntity anEntity)
public Object object()
public EOEntity entity()
EODatabaseOperation.EODatabaseOperation(EOGlobalID aGlobalID,
Object anObject,
EOEntity anEntity)
public int databaseOperator()
public void setDatabaseOperator(int databaseOperator)
databaseOperator
,
which must be one of the list below.
DatabaseNothingOperator
DatabaseInsertOperator
DatabaseDeleteOperator
databaseOperator
is DatabaseInsertOperator
and
the database operator that is currently set for the receiver is
DatabaseDeleteOperator
databaseOperator
is DatabaseDeleteOperator
and
the database operator that is currently set for the receiver is
DatabaseInsertOperator
databaseOperator
- The database operator to set for the receiver.
IllegalStateException
- if attempting to change
the receiver's operation from insert to delete,
or from delete to insert.public NSDictionary rowDiffs()
newRow
dictionary that are
different than the corresponding values in its dbSnapshot
, in other
words, the new values for its Enterprise Object.
EODatabaseOperation.primaryKeyDiffs()
public NSDictionary rowDiffsForAttributes(NSArray atts)
atts
that are new or updated relative to the object's
database snapshot. In other words, the attribute values in the object's
newRow
dictionary that are different than the corresponding values
in its dbSnapshot
. Returns an empty dictionary if there are no
differences in attribute values.
Throws an exception if atts
contains an attribute that is not
present in the the database snapshot for the receiver's object.
atts
- The attributes of the receiver's Enterprise Object.
IllegalStateException
- if any of the attributes in
atts
is not found in the object's snapshot.public NSDictionary primaryKeyDiffs()
newRow
that are different from those in the object's
database snapshot. Returns an empty dictionary if the database operation
set for the receiver is not EODatabaseUpdateOperator
.
EODatabaseOperation.setDatabaseOperator(int databaseOperator)
,
EODatabaseOperation.newRow()
public NSArray adaptorOperations()
EODatabaseOperation.addAdaptorOperation(EOAdaptorOperation adaptorOperation)
,
EODatabaseOperation.removeAdaptorOperation(EOAdaptorOperation adaptorOperation)
public void addAdaptorOperation(EOAdaptorOperation adaptorOp)
adaptorOp
to the receiver's list of adaptor operations.
adaptorOp
- A adaptor operation to add to the receiver's list
of adaptor operations.EODatabaseOperation.adaptorOperations()
,
EODatabaseOperation.removeAdaptorOperation(EOAdaptorOperation
adaptorOperation)
public void removeAdaptorOperation(EOAdaptorOperation adaptorOp)
adaptorOp
from the receiver's list of adaptor
operations.
adaptorOp
- A adaptor operation to remove from the receiver's list
of adaptor operations.EODatabaseOperation.adaptorOperations()
,
EODatabaseOperation.addAdaptorOperation(EOAdaptorOperation adaptorOperation)
public String toString()
toString
in class Object
public void recordToManySnapshot(NSArray gids, String name)
gids
for the relationship identified by
name
, belonging to the receiver's Enterprise Object. gids
is an array of globalIDs that identify the objects at the destination of the
specified to-many relationship.
gids
- The globalIDs that comprise the to-many snapshot for the
relationship specified by name
.name
- The name of the to-many relationship for which to record a
snapshot.EODatabaseOperation.toManySnapshots()
,
EODatabase
,
EORelationship
public NSDictionary toManySnapshots()
EODatabaseOperation.recordToManySnapshot(NSArray globalIDs, String name)
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |