4
Copyright (C) 1996 Free Software Foundation, Inc.
6
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
9
This file is part of the GNUstep Database Library.
11
This library is free software; you can redistribute it and/or
12
modify it under the terms of the GNU Library General Public
13
License as published by the Free Software Foundation; either
14
version 2 of the License, or (at your option) any later version.
16
This library is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
Library General Public License for more details.
21
You should have received a copy of the GNU Library General Public
22
License along with this library; see the file COPYING.LIB.
23
If not, write to the Free Software Foundation,
24
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
#ifndef __EORelationship_h__
28
#define __EORelationship_h__
30
#import <Foundation/NSString.h>
31
#import <GDLAccess/EOJoinTypes.h>
33
@class NSString, NSDictionary, NSException;
34
@class EOModel, EOEntity, EOAttribute;
36
@interface EORelationship : NSObject
40
NSDictionary *userDictionary;
42
/* Garbage collectable objects */
43
EOEntity *entity; /* non-retained */
44
EOEntity *destinationEntity; /* non-retained */
47
NSMutableArray *componentRelationships;
52
BOOL createsMutableObjects:1;
58
EOAttribute *sourceAttribute;
59
EOAttribute *destinationAttribute;
62
/* Initializing instances */
63
- (id)initWithName:(NSString*)name;
65
/* Accessing the name */
66
- (BOOL)setName:(NSString*)name;
68
+ (BOOL)isValidName:(NSString*)name;
74
/* Convering source row in destination row */
75
- (NSDictionary*)foreignKeyForRow:(NSDictionary*)row;
77
/* Accessing the definition */
78
- (NSArray*)componentRelationships;
79
- (void)setDefinition:(NSString*)definition;
80
- (NSString*)definition;
82
/* Accessing the entities joined */
83
- (void)setEntity:(EOEntity*)entity;
85
- (void)resetEntities;
87
- (BOOL)hasDestinationEntity;
88
- (EOEntity*)destinationEntity;
91
- (BOOL)isCompound; // always NO (no compound joins supported)
94
/* Accessing to-many property */
95
- (BOOL)setToMany:(BOOL)flag;
98
/* Checking references */
99
- (BOOL)referencesProperty:(id)property;
101
/* Accessing the user dictionary */
102
- (void)setUserDictionary:(NSDictionary*)dictionary;
103
- (NSDictionary*)userDictionary;
107
@interface EORelationship(EOJoin)
109
- (void)loadJoinPropertyList:(id)propertyList;
111
/* Accessing join properties */
112
- (void)setDestinationAttribute:(EOAttribute*)attribute;
113
- (EOAttribute*)destinationAttribute;
114
- (void)setSourceAttribute:(EOAttribute*)attribute;
115
- (EOAttribute*)sourceAttribute;
116
- (EORelationship*)relationship;
120
@interface EORelationship (EORelationshipPrivate)
122
+ (EORelationship*)relationshipFromPropertyList:(id)propertyList
123
model:(EOModel*)model;
124
- (void)replaceStringsWithObjects;
125
- (void)initFlattenedRelationship;
129
- (void)setCreateMutableObjects:(BOOL)flag;
130
- (BOOL)createsMutableObjects;
132
@end /* EORelationship (EORelationshipPrivate) */
134
@class NSMutableDictionary;
136
@interface EORelationship(PropertyListCoding)
138
- (void)encodeIntoPropertyList:(NSMutableDictionary *)_plist;
144
@interface EORelationship(EOF2Additions)
148
- (void)setIsMandatory:(BOOL)_flag;
151
- (NSException *)validateValue:(id *)_value;
155
#endif /* __EORelationship_h__ */