Annotation of Examples/EnterpriseObjects/MasteringDetails/EOFExtensions.subproj/RelationshipKeySetter.h, revision 1.1.1.1

1.1       root        1: /* RelationshipKeySetter.h created by cfeder on Tue 08-Nov-1994 */
                      2: 
                      3: #import <eoaccess/eoaccess.h>
                      4: 
                      5: @interface EOEntity (attrsNamed)
                      6: - attributesNamed:(NSArray *)names;
                      7: - createObject;
                      8: @end
                      9: 
                     10: // Extensions to EORelationship to handle assigning foreign keys in
                     11: // objects when they are newly assigned to point at one another.
                     12: // For instance, if an employee is set to point at a new department object
                     13: // [toEmpRelationship updateKeysForSourceObject:theEmp destinationObject:theNewDept]
                     14: // will change to dept_id property of theEmp to the dept_id of theNewDept
                     15: // and return the modified object (theEmp) so the caller can make sure that object
                     16: // is updated in the database.
                     17: //
                     18: // The following relationship types are handled:
                     19: //
                     20: // M     Detail   Insert rule              Delete                 Types
                     21: // PK -> PK       D->PK := M->PK           delete D               to-one
                     22: // FK -> PK       M->FK := D->PK           M->FK=NULL             to-one
                     23: // PK -> FK       D->FK := M->PK           Delete D               to-many
                     24: // Many to many   create link obj          Delete link            to-many
                     25: //
                     26: // Decoding: The first line means, when a relationship joins from the
                     27: // primary key of the master entity to the primary key of the detail,
                     28: // handle and insertion by setting the primary key of the detail to match
                     29: // the primary key of the master.
                     30: //
                     31: @interface EORelationship (setPropsInDestObject)
                     32: - (NSArray *)sourceKeys;
                     33: - (NSDictionary *)destinationValuesFromSourceObject:sourceObject;
                     34: - (void)setJoinPropertiesInDestinationObject:destination fromSourceObject:source;
                     35: - (void)setJoinPropertiesInSourceObject:source fromDestinationObject:destination;
                     36: - (BOOL)hasJoinsOnPrimaryKeyOfSourceEntity;
                     37: - (void)updateMasterObject:master withNewDestinationObject:destination;
                     38: - linkObjectForSourceObject:master destinationObject:destination;
                     39: - updateKeysForSourceObject:source destinationObject:destination;
                     40:     // Sets keys on source or destination to maintain consistency for
                     41:     // the source to now map to destination for this relationship.
                     42:     // Does not actually assign destination to ivar in source (just messes
                     43:     // with the keys).
                     44:     // Returns the modified object (source or destination). In the case of
                     45:     // a many to many returns a newly created link object.
                     46: 
                     47: - updateKeysForDeleteOfDestinationObject:destination fromSourceObject:source;
                     48:     // Sets keys on source or destination to maintain consistency for
                     49:     // a delete of the destination from the source.  Returns the object
                     50:     // modified, or a synthesized link object that must be deleted to
                     51:     // affect the delete.  The caller is responsible for updating the
                     52:     // source object, or deleting the destination or link in the database.
                     53:     //
                     54:     // This does not actually update destination to ivar in source (just messes
                     55:     // with the keys).
                     56: @end
                     57: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.