+2005-08-06 Helge Hess <helge.hess@opengroupware.org>
+
+ * v4.5.8
+
+ * NSEntityDescription+EO.m: added -isReadOnly, -classPropertyNames,
+ -primaryKeyAttributeNames, -relationships, -attributes
+
+ * added NSAttributeDescription+EO category containing the -width
+ and -allowsNull methods
+
+ * added NSRelationshipDescription+EO category containing the
+ -sourceAttributes method
+
2005-08-04 Helge Hess <helge.hess@opengroupware.org>
* EOCoreDataSource.m: print a warning if no object-context was decoded
libEOCoreData_HEADER_FILES_DIR = .
libEOCoreData_HEADER_FILES_INSTALL_DIR = /EOCoreData
-libEOCoreData_HEADER_FILES = \
+
+# headers
+
+libEOCoreData_HEADER_FILES += \
EOCoreData.h \
EOCoreDataSource.h \
\
EOFetchSpecification+CoreData.h \
EOQualifier+CoreData.h \
EOSortOrdering+CoreData.h \
- \
+
+libEOCoreData_HEADER_FILES += \
NSExpression+EO.h \
NSPredicate+EO.h \
NSEntityDescription+EO.h \
+ NSAttributeDescription+EO.h \
+ NSRelationshipDescription+EO.h \
+
-libEOCoreData_OBJC_FILES = \
+# implementations
+
+libEOCoreData_OBJC_FILES += \
EOCoreDataSource.m \
\
EOFetchSpecification+CoreData.m \
EOKeyValueQualifier+CoreData.m \
EOKeyComparisonQualifier+CoreData.m \
EOCompoundQualifiers.m \
- \
+
+libEOCoreData_OBJC_FILES += \
NSExpression+EO.m \
NSPredicate+EO.m \
NSEntityDescription+EO.m \
+ NSAttributeDescription+EO.m \
+ NSRelationshipDescription+EO.m \
+ NSManagedObject+KVC.m \
+
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/library.make
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __NSAttributeDescription_EO_H__
+#define __NSAttributeDescription_EO_H__
+
+#import <CoreData/NSAttributeDescription.h>
+
+/*
+ NSAttributeDescription(EO)
+
+ Make an NSAttributeDescription behave like an EOAttribute. This is mostly to
+ make the CoreData model objects work with DirectToWeb and EO at the same
+ time.
+*/
+
+@interface NSAttributeDescription(EO)
+
+- (unsigned)width;
+- (BOOL)allowsNull;
+
+@end
+
+#endif /* __NSAttributeDescription_EO_H__ */
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "NSAttributeDescription+EO.h"
+#import <Foundation/NSComparisonPredicate.h>
+#include "common.h"
+
+@implementation NSAttributeDescription(EO)
+
+- (unsigned)width {
+ /*
+ This scans for a validation predicate checking for the maximum length. The
+ code looks for:
+ - an NSComparisonPredicate
+ - which has the operator <=
+ - and a keypath LHS with the keypath 'length'
+
+ Note: only scans one level, does not walk NSCompoundPredicates
+ */
+ NSArray *preds;
+ unsigned i, count;
+
+ if ((preds = [self validationPredicates]) == nil)
+ return 0;
+
+ if ((count = [preds count]) == 0)
+ return 0;
+
+ for (i = 0; i < count; i++) {
+ NSComparisonPredicate *p;
+
+ p = [preds objectAtIndex:i];
+ if (![p isKindOfClass:[NSComparisonPredicate class]])
+ continue;
+
+ if ([p predicateOperatorType] != NSLessThanOrEqualToPredicateOperatorType)
+ continue;
+
+ if (![[[p leftExpression] keyPath] isEqualToString:@"length"])
+ continue;
+
+ /* found it! */
+ return [[[p rightExpression] constantValue] unsignedIntValue];
+ }
+ return 0;
+}
+
+- (BOOL)allowsNull {
+ return [self isOptional];
+}
+
+@end /* NSAttributeDescription(EO) */
#define __NSEntityDescription_EO_H__
#import <CoreData/NSEntityDescription.h>
+
/*
NSEntityDescription(EO)
the CoreData model objects work with DirectToWeb and EO at the same time.
*/
+@class NSString, NSArray;
+
@interface NSEntityDescription(EO)
- (id)relationshipNamed:(NSString *)_name;
- (id)attributeNamed:(NSString *)_name;
+- (NSArray *)relationships;
+- (NSArray *)attributes;
+
+- (BOOL)isReadOnly;
+
+- (NSArray *)classPropertyNames;
+- (NSArray *)primaryKeyAttributeNames;
@end
return [[self attributesByName] objectForKey:_qname];
}
+- (BOOL)isReadOnly {
+ return NO; /* always read/write, no? */
+}
+- (NSArray *)classPropertyNames {
+ return [[self propertiesByName] allKeys];
+}
+- (NSArray *)primaryKeyAttributeNames {
+ /* such are transparent with CoreData */
+ return nil;
+}
+
+- (NSArray *)attributes {
+ return [[self attributesByName] allValues];
+}
+- (NSArray *)relationships {
+ return [[self relationshipsByName] allValues];
+}
+
@end /* NSEntityDescription(EO) */
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#import <CoreData/CoreData.h> // Note: just including NSManagedObject is a nogo
+#include "common.h"
+
+@implementation NSManagedObject(KVC)
+
+- (void)takeValue:(id)_value forKey:(NSString *)_key {
+ /* Yes, I know, deprecated. But hey, don't do this to us! */
+ [self setValue:_value forKey:_key];
+}
+
+@end /* NSManagedObject(KVC) */
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __NSRelationshipDescription_EO_H__
+#define __NSRelationshipDescription_EO_H__
+
+#import <CoreData/NSRelationshipDescription.h>
+
+/*
+ NSRelationshipDescription(EO)
+
+ Make an NSRelationshipDescription behave like an EORelationship. This is
+ mostly to make the CoreData model objects work with DirectToWeb and EO at
+ the same time.
+*/
+
+@class NSArray;
+
+@interface NSRelationshipDescription(EO)
+
+- (NSArray *)sourceAttributes;
+
+@end
+
+#endif /* __NSRelationshipDescription_EO_H__ */
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "NSRelationshipDescription+EO.h"
+#include "common.h"
+
+@implementation NSRelationshipDescription(EO)
+
+- (NSArray *)sourceAttributes {
+ /* such are transparent with CoreData */
+ return nil;
+}
+
+@end /* NSRelationshipDescription(EO) */
# version file
-SUBMINOR_VERSION:=7
+SUBMINOR_VERSION:=8