home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / GamePlayer.m < prev    next >
Encoding:
Text File  |  1996-08-23  |  1.5 KB  |  48 lines

  1. /*
  2.         Copyright (c) 1996, NeXT Software, Inc.
  3.         All rights reserved.
  4.  
  5.         You may freely copy, distribute and reuse the code in this example.
  6.         NeXT disclaims any warranty of any kind, expressed or implied,
  7.         as to its fitness for any particular use.
  8. */
  9. #import <BusinessLogic/GamePlayer.h>
  10.  
  11. @implementation GamePlayer
  12.  
  13. - (NSString *)name {
  14.     return name;
  15. }
  16.  
  17. - (void)dealloc
  18. {
  19.     [name release];
  20.     [super dealloc];
  21. }
  22.  
  23. - (void)awakeFromInsertionInEditingContext:(EOEditingContext *)editingContext
  24. {
  25.     // set up default values
  26.     if(!rentalTerms) {
  27.         static EOGlobalID *gid = nil;
  28.  
  29.         // Fetch default rental terms for new GamePlayers
  30.         if(!gid) {
  31.             EOFetchSpecification *fetchSpec;
  32.             NSArray *results;
  33.  
  34.             // look up the global ID of the rental term with ID = 14
  35.             fetchSpec = [EOFetchSpecification fetchSpecificationWithEntityName:@"RentalTerms"
  36.                         qualifier:[EOQualifier qualifierWithQualifierFormat:@"rentalTermID = 14"]
  37.                                                                  sortOrderings:nil];
  38.  
  39.             results = [editingContext objectsWithFetchSpecification:fetchSpec
  40.                                                      editingContext:editingContext];
  41.             gid = [editingContext globalIDForObject:[results objectAtIndex:0]];
  42.         }
  43.         rentalTerms = [[editingContext faultForGlobalID:gid editingContext:editingContext] retain];
  44.     }
  45. }
  46.  
  47. @end
  48.