File:  [NeXTSTEP 3.3 examples] / Examples / EnterpriseObjects / DistributedEO / Employee.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:44 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

// Employee.m
//
// Created on Fri Jan 13 15:56:20 PST 1995 by NeXT EOModeler.app Version 71
/*
   modified by enoyau

   You may freely copy, distribute, and reuse the code in this example.
   NeXT disclaims any warranty of any kind, expressed or implied, as to its
   fitness for any particular use.
*/

#import "Employee.h"
#import <appkit/NXImage.h>

@implementation Employee
static NSString *localLockString;

+ (void)setLocalLockString:(NSString *)lockString
{
    if(localLockString) [localLockString autorelease];
    localLockString = [lockString copy];
}

- (NSString *)lock { return lock; }

- (void)dealloc
{
    [address autorelease];
    [city autorelease];
    [first_name autorelease];
    [hire_date autorelease];
    [last_name autorelease];
    [phone autorelease];
    [state autorelease];
    [zip autorelease];
    [toJob_Title autorelease];
    [toEmp_Photo autorelease];
    [photo autorelease];
    [lock autorelease];
    [super dealloc];
}

// Determine if the EO is editable by comparing the local lock string with
// the EO lock string stored in the database.
- (BOOL)isEditable
{
    return [[self lock] isEqual:localLockString];
}

- (BOOL)isLocked
{
    return ![[self lock] isEqual:[EONull null]];
}

// lockImage is an attribute added to the Employee entity in InterfaceBuilder.
// This method retrieves the proper lock image to be displayed in the
// tableview.
- lockImage
{
    if(![self isLocked])
        return nil;
    else if([self isEditable])
        return [NXImage findImageNamed:"lock_h"];
    else
        return [NXImage findImageNamed:"lock"];
}

@end

unix.superglobalmegacorp.com

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