Annotation of Examples/DatabaseKit/AssociationOracle/QualifiedAssociation.m, revision 1.1.1.1

1.1       root        1: /* QualifiedAssociation.m:
                      2:  * You may freely copy, distribute, and reuse the code in this example.
                      3:  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
                      4:  * fitness for any particular use.
                      5:  *
                      6:  * Written by Mai Nguyen, NeXT Developer Support
                      7:  *
                      8:  */
                      9: 
                     10: #import "QualifiedAssociation.h"
                     11: 
                     12: @implementation QualifiedAssociation
                     13: 
                     14: /*  initialization method.
                     15:  */
                     16: 
                     17: - (QualifiedAssociation *)initAndReplaceAssociationTo:(DBFetchGroup *)detailFG
                     18: {
                     19:        DBModule *                              dbModule;
                     20:        DBAssociation *                 dbAssociation;
                     21:        DBExpression *                  dbExpression;
                     22:        DBFetchGroup *                  masterFetchGroup;
                     23:                
                     24:        /* Get a hold of the association from master fetchgroup to detail
                     25:         * fetchgroup
                     26:         */
                     27:        dbModule = [detailFG module];
                     28:        dbAssociation = [dbModule associationForObject:detailFG];
                     29:        dbExpression = [dbAssociation expression];
                     30:        masterFetchGroup = [dbAssociation fetchGroup];
                     31:                /* Remove the association from the master fetchgroup
                     32:                 */
                     33:        [masterFetchGroup removeAssociation:dbAssociation];
                     34:        [self initFetchGroup:masterFetchGroup
                     35:                expression: dbExpression
                     36:                destination: detailFG ];
                     37:                        
                     38:        [masterFetchGroup addAssociation:self];
                     39:        
                     40:                /* Free old association */
                     41:        [dbAssociation free];
                     42:        return self;
                     43: }
                     44: 
                     45: - setValue:value
                     46: {
                     47:        [[self destination] fetchContentsOf:value usingQualifier:dbQualifier];
                     48:        return self;
                     49: }
                     50: 
                     51: - setQualifier: qualifier
                     52: {
                     53:        dbQualifier = (DBQualifier *)qualifier;
                     54:        return self;
                     55: }
                     56: 
                     57: - qualifier
                     58: {
                     59:        return dbQualifier;
                     60: }
                     61: 
                     62: 
                     63: @end

unix.superglobalmegacorp.com

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