mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-05-31 17:31:02 +00:00
* EOAccess/EODatabase.[hm]
add -forgetSnapshotForSourceGlobalID:relationshipName: * EOAccess/EODatabaseContext.[hm] add -forgetSnapshotForSourceGlobalID:relationshipName: add -refaultObject:withSourceGlobalID:relationshipName:editingContext: add -clearOriginalSnapshotForObject:sourceGlobalID:relationshipName:editingContext: add -_turnToArrayFault:sourceGID:relationshipName:editingContext:isComplete: * EOControl/EOCustomObject.m fix -validateValue:forKey: fix -validateValue:forKey:error: fix -addObject:toPropertyWithKey: fix -removeObject:object fromPropertyWithKey: * EOControl/EOEditingContext.[hm] add -refaultObject:withSourceGlobalID:relationshipName:editingContext: * EOControl/EONSAddOns.[hm] add -performSelector:withPointer: * EOControl/EOObjectStore.[hm] add -refaultObject:withSourceGlobalID:relationshipName:editingContext: add -clearOriginalSnapshotForObject:sourceGlobalID:relationshipName:editingContext: * EOControl/EOObjectStoreCoordinator.m add -refaultObject:withSourceGlobalID:relationshipName:editingContext: add -clearOriginalSnapshotForObject:sourceGlobalID:relationshipName:editingContext: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@38006 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c8cfc0fed3
commit
858cbe7f44
13 changed files with 296 additions and 6 deletions
|
@ -50,6 +50,7 @@
|
|||
|
||||
#include "EOCustomObject.h"
|
||||
#include "EOPrivate.h"
|
||||
#include "EONSAddOns.h"
|
||||
|
||||
|
||||
@implementation EOCustomObject
|
||||
|
@ -222,12 +223,12 @@
|
|||
{
|
||||
SEL validateSelector;
|
||||
NSUInteger length = [key length];
|
||||
char buf[length + 10];
|
||||
char buf[length + 10]; //validate + key + : + \0
|
||||
|
||||
strcpy(buf, "validate");
|
||||
|
||||
[key getCString:&buf[8]
|
||||
maxLength:length
|
||||
maxLength:length+1 //maxLength is total buffer size (See NSString.m comment)
|
||||
encoding:NSASCIIStringEncoding];
|
||||
|
||||
buf[8] = toupper((int)buf[8]);
|
||||
|
@ -238,7 +239,7 @@
|
|||
if (validateSelector && [self respondsToSelector: validateSelector])
|
||||
{
|
||||
exception = [self performSelector: validateSelector
|
||||
withObject: *valueP];
|
||||
withPointer: valueP];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +261,7 @@
|
|||
NSDictionary * uInfo;
|
||||
|
||||
uInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
(*value ? *value : (id)@"nil"), @"EOValidatedObjectUserInfoKey",
|
||||
self, @"EOValidatedObjectUserInfoKey",
|
||||
key, @"EOValidatedPropertyUserInfoKey",
|
||||
[ex reason], NSLocalizedDescriptionKey,
|
||||
nil];
|
||||
|
@ -444,7 +445,7 @@
|
|||
strcpy(buf, "addTo");
|
||||
|
||||
[key getCString:&buf[5]
|
||||
maxLength:size
|
||||
maxLength:size+1 //maxLength is total buffer size (See NSString.m comment)
|
||||
encoding:NSASCIIStringEncoding];
|
||||
|
||||
buf[5] = toupper(buf[5]);
|
||||
|
@ -520,7 +521,7 @@
|
|||
strcpy(buf, "removeFrom");
|
||||
|
||||
[key getCString:&buf[10]
|
||||
maxLength:size
|
||||
maxLength:size+1 //maxLength is total buffer size (See NSString.m comment)
|
||||
encoding:NSASCIIStringEncoding];
|
||||
|
||||
buf[10] = toupper(buf[10]);
|
||||
|
|
|
@ -238,6 +238,11 @@ modified state of the object.**/
|
|||
withGlobalID: (EOGlobalID *)globalID
|
||||
editingContext: (EOEditingContext *)context;
|
||||
|
||||
- (void)refaultObject: (NSArray*)object
|
||||
withSourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString*)relName
|
||||
editingContext: (EOEditingContext *)context;
|
||||
|
||||
- (void)saveChangesInEditingContext: (EOEditingContext *)context;
|
||||
|
||||
- (NSArray *)objectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
|
||||
|
|
|
@ -3573,6 +3573,46 @@ modified state of the object.**/
|
|||
}
|
||||
}
|
||||
|
||||
//GDL2 addition: enable refaulting object to-many property
|
||||
- (void)refaultObject: (NSArray*)object
|
||||
withSourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString *)relName
|
||||
editingContext: (EOEditingContext *)context
|
||||
{
|
||||
//Near OK
|
||||
if (object && [EOFault isFault: object] == NO)
|
||||
{
|
||||
//call globalID isTemporary //ret NO
|
||||
if (self == context)//??
|
||||
{
|
||||
//NO: in EODatabaseConetxt [object clearProperties];
|
||||
|
||||
if (NSMapGet(_objectsByGID, globalID) == nil
|
||||
&& _sharedContext
|
||||
&& [_sharedContext objectForGlobalID: globalID])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Attempt to initialize object contained in EOSharedEditingContext"];
|
||||
}
|
||||
|
||||
//OK
|
||||
[_objectStore refaultObject: object
|
||||
withSourceGlobalID: globalID
|
||||
relationshipName: relName
|
||||
editingContext: context];
|
||||
//OK
|
||||
[_objectStore clearOriginalSnapshotForObject: object
|
||||
sourceGlobalID: globalID
|
||||
relationshipName: relName
|
||||
editingContext: context];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)saveChangesInEditingContext: (EOEditingContext *)context
|
||||
{
|
||||
if (context != self)
|
||||
|
|
|
@ -119,6 +119,10 @@ returnsRemovedValues:(NSArray**)removedValues
|
|||
@end
|
||||
|
||||
@interface NSObject (PerformSelect3)
|
||||
|
||||
- (id) performSelector: (SEL)selector
|
||||
withPointer: (void*) ptr;
|
||||
|
||||
/**
|
||||
* Causes the receiver to execute the method implementation corresponding
|
||||
* to selector and returns the result.<br />
|
||||
|
|
|
@ -720,6 +720,27 @@ returnsRemovedValues:(NSArray**)removedValues
|
|||
@end
|
||||
|
||||
@implementation NSObject (PerformSelect3)
|
||||
|
||||
- (id) performSelector: (SEL)selector
|
||||
withPointer: (void*) ptr
|
||||
{
|
||||
IMP msg;
|
||||
|
||||
if (selector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
msg = class_getMethodImplementation([self class], selector);
|
||||
if (!msg)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"invalid selector passed to %s", sel_getName(_cmd)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return (*msg)(self, selector, ptr);
|
||||
}
|
||||
|
||||
//Ayers: Review (Do we really need this?)
|
||||
/**
|
||||
* Causes the receiver to execute the method implementation corresponding
|
||||
|
|
|
@ -69,6 +69,16 @@
|
|||
withGlobalID: (EOGlobalID *)globalID
|
||||
editingContext: (EOEditingContext *)context;
|
||||
|
||||
- (void)refaultObject: (NSArray*)object
|
||||
withSourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString*)relName
|
||||
editingContext: (EOEditingContext *)context;
|
||||
|
||||
- (void) clearOriginalSnapshotForObject: (NSArray*)object
|
||||
sourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString *)name
|
||||
editingContext: (EOEditingContext *)context;
|
||||
|
||||
- (void)saveChangesInEditingContext: (EOEditingContext *)context;
|
||||
|
||||
- (NSArray *)objectsWithFetchSpecification: (EOFetchSpecification *)fetchSpecification
|
||||
|
|
|
@ -103,6 +103,24 @@ NSString *EOUpdatedKey = @"updated";
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
//GDL2 addition: enable refaulting object to-many property
|
||||
- (void)refaultObject: (NSArray*)object
|
||||
withSourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString*)relName
|
||||
editingContext: (EOEditingContext *)context
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
//GDL2 addition: enable refaulting object to-many property
|
||||
- (void) clearOriginalSnapshotForObject: (NSArray*)object
|
||||
sourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString *)name
|
||||
editingContext: (EOEditingContext *)context
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void)saveChangesInEditingContext: (EOEditingContext *)context
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
|
|
@ -342,6 +342,32 @@ NSString *EOCooperatingObjectStoreNeeded = @"EOCooperatingObjectStoreNeeded";
|
|||
editingContext: context];
|
||||
}
|
||||
|
||||
//GDL2 addition: enable refaulting object to-many property
|
||||
- (void)refaultObject: (NSArray*)object
|
||||
withSourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString*)relName
|
||||
editingContext: (EOEditingContext *)context
|
||||
{
|
||||
[[self objectStoreForGlobalID: globalID]
|
||||
refaultObject: object
|
||||
withSourceGlobalID: globalID
|
||||
relationshipName: relName
|
||||
editingContext: context];
|
||||
}
|
||||
|
||||
//GDL2 addition: enable refaulting object to-many property
|
||||
- (void) clearOriginalSnapshotForObject: (NSArray*)object
|
||||
sourceGlobalID: (EOGlobalID *)globalID
|
||||
relationshipName: (NSString *)name
|
||||
editingContext: (EOEditingContext *)context
|
||||
{
|
||||
return [[self objectStoreForGlobalID: globalID]
|
||||
clearOriginalSnapshotForObject: object
|
||||
sourceGlobalID: globalID
|
||||
relationshipName: name
|
||||
editingContext: context];
|
||||
}
|
||||
|
||||
- (void)initializeObject: (id)object
|
||||
withGlobalID: (EOGlobalID *)globalID
|
||||
editingContext: (EOEditingContext *)context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue