home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / GameMedia.m < prev    next >
Encoding:
Text File  |  1996-08-23  |  1.5 KB  |  49 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/GameMedia.h>
  10.  
  11. @implementation GameMedia
  12.  
  13. - (NSString *)name {
  14.     return name;
  15. }
  16.  
  17. - (void)dealloc
  18. {
  19.     [name release];
  20.     [platform release];
  21.     [super dealloc];
  22. }
  23.  
  24. - (void)awakeFromInsertionInEditingContext:(EOEditingContext *)editingContext
  25. {
  26.     if(!rentalTerms) {
  27.         static EOGlobalID *gid = nil;
  28.  
  29.         // I'd like to setup some default for rental terms here
  30.         if(!gid) {
  31.             EOFetchSpecification *fetchSpec;
  32.             NSArray *results;
  33.  
  34.             // look up the global identifier for the rental with ID == 11
  35.             fetchSpec = [EOFetchSpecification fetchSpecificationWithEntityName:@"RentalTerms"
  36.                          qualifier:[EOQualifier qualifierWithQualifierFormat:@"rentalTermID = 11"]
  37.                                                            sortOrderings:nil];
  38.  
  39.             results = [editingContext objectsWithFetchSpecification:fetchSpec
  40.                                                      editingContext:editingContext];
  41.  
  42.             gid = [editingContext globalIDForObject:[results objectAtIndex:0]];
  43.         }
  44.         rentalTerms = [[editingContext faultForGlobalID:gid
  45.                                          editingContext:editingContext] retain];
  46.     }
  47. }
  48. @end
  49.