You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by pe...@apache.org on 2013/09/26 16:21:58 UTC
svn commit: r1526505 - in /chemistry/objectivecmis/trunk:
ObjectiveCMIS.xcodeproj/ ObjectiveCMIS/Bindings/
ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/ ObjectiveCMIS/Client/
ObjectiveCMIS/Common/ ObjectiveCMIS/Utils/ ObjectiveCMISTests/
Author: peberlein
Date: Thu Sep 26 14:21:57 2013
New Revision: 1526505
URL: http://svn.apache.org/r1526505
Log:
added auto-retrieval of CMISTypeDefinition (like in OpenCMIS), added support for 'versionable' and 'contentStreamAllowed' properties in CMISDocumentTypeDefinition
Added:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.m
Modified:
chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m
chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj Thu Sep 26 14:21:57 2013
@@ -186,6 +186,8 @@
BD5C9713162C11E3002DDC6E /* CMISHttpResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BD5C9711162C11E3002DDC6E /* CMISHttpResponse.h */; settings = {ATTRIBUTES = (Public, ); }; };
BD5C9714162C11E3002DDC6E /* CMISHttpResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = BD5C9712162C11E3002DDC6E /* CMISHttpResponse.m */; };
BD5C9715162C11E3002DDC6E /* CMISHttpResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = BD5C9712162C11E3002DDC6E /* CMISHttpResponse.m */; };
+ BD70F11B17F4649B00AE2B0C /* CMISDocumentTypeDefinition.h in Headers */ = {isa = PBXBuildFile; fileRef = BD70F11917F4649B00AE2B0C /* CMISDocumentTypeDefinition.h */; };
+ BD70F11C17F4649B00AE2B0C /* CMISDocumentTypeDefinition.m in Sources */ = {isa = PBXBuildFile; fileRef = BD70F11A17F4649B00AE2B0C /* CMISDocumentTypeDefinition.m */; };
FE21296415946B94005234FE /* CMISAuthenticationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 82C1C62A153426E4009B7B3D /* CMISAuthenticationProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE417D5715761A0C009056AA /* CMISOperationContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE417D5315761A0C009056AA /* CMISOperationContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE417D5815761A0C009056AA /* CMISOperationContext.m in Sources */ = {isa = PBXBuildFile; fileRef = FE417D5415761A0C009056AA /* CMISOperationContext.m */; };
@@ -378,6 +380,8 @@
BD5C970D16282977002DDC6E /* CMISHttpDownloadRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CMISHttpDownloadRequest.m; path = Utils/CMISHttpDownloadRequest.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
BD5C9711162C11E3002DDC6E /* CMISHttpResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISHttpResponse.h; path = Utils/CMISHttpResponse.h; sourceTree = "<group>"; };
BD5C9712162C11E3002DDC6E /* CMISHttpResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CMISHttpResponse.m; path = Utils/CMISHttpResponse.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ BD70F11917F4649B00AE2B0C /* CMISDocumentTypeDefinition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISDocumentTypeDefinition.h; path = Bindings/CMISDocumentTypeDefinition.h; sourceTree = "<group>"; };
+ BD70F11A17F4649B00AE2B0C /* CMISDocumentTypeDefinition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CMISDocumentTypeDefinition.m; path = Bindings/CMISDocumentTypeDefinition.m; sourceTree = "<group>"; };
FE417D5315761A0C009056AA /* CMISOperationContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISOperationContext.h; path = Client/CMISOperationContext.h; sourceTree = "<group>"; };
FE417D5415761A0C009056AA /* CMISOperationContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CMISOperationContext.m; path = Client/CMISOperationContext.m; sourceTree = "<group>"; };
FE417D5515761A0C009056AA /* CMISPagedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMISPagedResult.h; path = Client/CMISPagedResult.h; sourceTree = "<group>"; };
@@ -618,6 +622,8 @@
8276E157155E392A00344A29 /* CMISRepositoryService.h */,
FE417D6115761A34009056AA /* CMISTypeDefinition.h */,
FE417D6215761A34009056AA /* CMISTypeDefinition.m */,
+ BD70F11917F4649B00AE2B0C /* CMISDocumentTypeDefinition.h */,
+ BD70F11A17F4649B00AE2B0C /* CMISDocumentTypeDefinition.m */,
8276E158155E392A00344A29 /* CMISVersioningService.h */,
8280730D1515405C00EF635C /* AtomPub */,
);
@@ -810,6 +816,7 @@
BD30D33D162D7DD7001FFF80 /* CMISRequest.h in Headers */,
278B269C177BB10B0049C229 /* CMISStandardAuthenticationProvider.h in Headers */,
278B269F177BB3000049C229 /* CMISStandardUntrustedSSLAuthenticationProvider.h in Headers */,
+ BD70F11B17F4649B00AE2B0C /* CMISDocumentTypeDefinition.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1021,6 +1028,7 @@
4E3C32A916C4EF190099B21E /* CMISAtomPubVersioningService.m in Sources */,
82895A1B16D8A8C5007BC80A /* CMISLog.m in Sources */,
278B26A0177BB3000049C229 /* CMISStandardUntrustedSSLAuthenticationProvider.m in Sources */,
+ BD70F11C17F4649B00AE2B0C /* CMISDocumentTypeDefinition.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.h Thu Sep 26 14:21:57 2013
@@ -156,6 +156,10 @@ extern NSString * const kCMISCoreInherit
extern NSString * const kCMISCoreRequired;
extern NSString * const kCMISCoreOrderable;
extern NSString * const kCMISCoreOpenChoice;
+extern NSString * const kCMISCoreVersionable;
+extern NSString * const kCMISCoreContentStreamAllowed;
+extern NSString * const kCMISCoreAllowed;
+extern NSString * const kCMISCoreNotAllowed;
extern NSString * const kCMISCorePropertyStringDefinition;
extern NSString * const kCMISCorePropertyIdDefinition;
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubConstants.m Thu Sep 26 14:21:57 2013
@@ -155,6 +155,10 @@ NSString * const kCMISCoreInherited = @"
NSString * const kCMISCoreRequired = @"required";
NSString * const kCMISCoreOrderable = @"queryable";
NSString * const kCMISCoreOpenChoice = @"openChoice";
+NSString * const kCMISCoreVersionable = @"versionable";
+NSString * const kCMISCoreContentStreamAllowed = @"contentStreamAllowed";
+NSString * const kCMISCoreAllowed = @"allowed";
+NSString * const kCMISCoreNotAllowed = @"notallowed";
NSString * const kCMISCorePropertyStringDefinition = @"propertyStringDefinition";
NSString * const kCMISCorePropertyIdDefinition = @"propertyIdDefinition";
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m Thu Sep 26 14:21:57 2013
@@ -19,6 +19,7 @@
#import "CMISTypeDefinitionAtomEntryParser.h"
#import "CMISTypeDefinition.h"
+#import "CMISDocumentTypeDefinition.h"
#import "CMISAtomPubConstants.h"
#import "CMISConstants.h"
@@ -70,7 +71,18 @@
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if ([elementName isEqualToString:kCMISRestAtomType]) {
- self.typeDefinition = [[CMISTypeDefinition alloc] init];
+ __block BOOL documentType = NO;
+ [attributeDict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+ if ([key hasSuffix:@"type"] && [obj hasSuffix:@"cmisTypeDocumentDefinitionType"]) {
+ documentType = YES;
+ }
+ }];
+
+ if (documentType) {
+ self.typeDefinition = [[CMISDocumentTypeDefinition alloc] init];
+ } else {
+ self.typeDefinition = [[CMISTypeDefinition alloc] init];
+ }
self.isParsingTypeDefinition = YES;
} else if ([elementName isEqualToString:kCMISCorePropertyStringDefinition]
|| [elementName isEqualToString:kCMISCorePropertyIdDefinition]
@@ -157,6 +169,20 @@
if (self.isParsingTypeDefinition) {
self.typeDefinition.controllablePolicy = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
+ } else if ([elementName isEqualToString:kCMISCoreVersionable]) {
+ if (self.isParsingTypeDefinition && [self.typeDefinition isKindOfClass:CMISDocumentTypeDefinition.class]) {
+ ((CMISDocumentTypeDefinition*)self.typeDefinition).versionable = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
+ }
+ } else if ([elementName isEqualToString:kCMISCoreContentStreamAllowed]) {
+ if (self.isParsingTypeDefinition && [self.typeDefinition isKindOfClass:CMISDocumentTypeDefinition.class]) {
+ if ([self.currentString isEqualToString:kCMISCoreAllowed]) {
+ ((CMISDocumentTypeDefinition*)self.typeDefinition).contentStreamAllowed = CMISContentStreamAllowed;
+ } else if ([self.currentString isEqualToString:kCMISCoreNotAllowed]) {
+ ((CMISDocumentTypeDefinition*)self.typeDefinition).contentStreamAllowed = CMISContentStreamNotAllowed;
+ } else if ([self.currentString isEqualToString:kCMISCoreRequired]) {
+ ((CMISDocumentTypeDefinition*)self.typeDefinition).contentStreamAllowed = CMISContentStreamRequired;
+ }
+ }
}
self.currentString = nil;
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.h?rev=1526505&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.h Thu Sep 26 14:21:57 2013
@@ -0,0 +1,29 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+#import "CMISEnums.h"
+#import "CMISTypeDefinition.h"
+
+@interface CMISDocumentTypeDefinition : CMISTypeDefinition
+
+@property (nonatomic, assign, getter = isVersionable) BOOL versionable;
+@property (nonatomic, assign) CMISContentStreamAllowedType contentStreamAllowed;
+
+@end
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.m?rev=1526505&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDocumentTypeDefinition.m Thu Sep 26 14:21:57 2013
@@ -0,0 +1,24 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CMISDocumentTypeDefinition.h"
+
+@implementation CMISDocumentTypeDefinition
+
+@end
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISDocument.m Thu Sep 26 14:21:57 2013
@@ -76,7 +76,10 @@
CMISLogError(@"Error while retrieving all versions: %@", error.description);
completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
} else {
- completionBlock([self.session.objectConverter convertObjects:objects], nil);
+ [self.session.objectConverter convertObjects:objects
+ completionBlock:^(NSArray *objects, NSError *error) {
+ completionBlock([[CMISCollection alloc] initWithItems:objects], error);
+ }];
}
}];
}
@@ -142,7 +145,10 @@
if (error) {
completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]);
} else {
- completionBlock((CMISDocument *) [self.session.objectConverter convertObject:objectData], nil);
+ [self.session.objectConverter convertObject:objectData
+ completionBlock:^(CMISObject *object, NSError *error) {
+ completionBlock((CMISDocument *)object, error);
+ }];
}
}];
}
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFileableObject.m Thu Sep 26 14:21:57 2013
@@ -40,13 +40,10 @@
includeAllowableActions:operationContext.includeAllowableActions
includeRelativePathSegment:operationContext.includePathSegments
completionBlock:^(NSArray *parentObjectDataArray, NSError *error) {
- NSMutableArray *parentFolders = [NSMutableArray array];
- for (CMISObjectData *parentObjectData in parentObjectDataArray){
- [parentFolders addObject:[self.session.objectConverter convertObject:parentObjectData]];
- }
-
- completionBlock(parentFolders, error);
-
+ [self.session.objectConverter convertObjects:parentObjectDataArray
+ completionBlock:^(NSArray *objects, NSError *error) {
+ completionBlock(objects, error);
+ }];
}];
}
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISFolder.m Thu Sep 26 14:21:57 2013
@@ -96,8 +96,11 @@
result.hasMoreItems = objectList.hasMoreItems;
result.numItems = objectList.numItems;
- result.resultArray = [self.session.objectConverter convertObjects:objectList.objects].items;
- pageBlockCompletionBlock(result, nil);
+ [self.session.objectConverter convertObjects:objectList.objects
+ completionBlock:^(NSArray *objects, NSError *error) {
+ result.resultArray = objects;
+ pageBlockCompletionBlock(result, error);
+ }];
}
}];
};
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h Thu Sep 26 14:21:57 2013
@@ -36,6 +36,7 @@
@property (nonatomic, strong, readonly) NSDate *lastModificationDate;
@property (nonatomic, strong, readonly) NSString *objectType;
@property (nonatomic, strong, readonly) NSString *changeToken;
+@property (nonatomic, strong, readonly) CMISTypeDefinition *typeDefinition;
//@property (nonatomic, strong, readonly) CMISBaseTypeId *baseTypeId;
//@property (nonatomic, strong, readonly) CMISObjectType *baseType;
//@property (nonatomic, strong, readonly) CMISObjectType *type;
@@ -50,6 +51,12 @@
- (id)initWithObjectData:(CMISObjectData *)objectData session:(CMISSession *)session;
/**
+ * set the typeDefinition property initally
+ */
+- (void)fetchTypeDefinitionWithCompletionBlock:(void (^)(NSError *error))completionBlock;
+
+
+/**
* Updates the properties that are provided.
* completionBlock returns the updated CMISObject instance or nil if unsuccessful
*/
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m Thu Sep 26 14:21:57 2013
@@ -25,6 +25,8 @@
#import "CMISSession.h"
#import "CMISRenditionData.h"
#import "CMISRendition.h"
+#import "CMISLog.h"
+
@interface CMISObject ()
@@ -39,6 +41,7 @@
@property (nonatomic, strong, readwrite) NSDate *lastModificationDate;
@property (nonatomic, strong, readwrite) NSString *objectType;
@property (nonatomic, strong, readwrite) NSString *changeToken;
+@property (nonatomic, strong, readwrite) CMISTypeDefinition *typeDefinition;
@property (nonatomic, strong, readwrite) CMISProperties *properties;
@property (nonatomic, strong, readwrite) CMISAllowableActions *allowableActions;
@@ -89,6 +92,29 @@
return self;
}
+
+- (void)fetchTypeDefinitionWithCompletionBlock:(void (^)(NSError *error))completionBlock
+{
+ if (self.typeDefinition) {
+ if (completionBlock) {
+ completionBlock(nil);
+ }
+ } else {
+ [self.session retrieveTypeDefinition:self.objectType
+ completionBlock:^(CMISTypeDefinition *typeDefinition, NSError *error) {
+ if (error == nil) {
+ self.typeDefinition = typeDefinition;
+ } else {
+ CMISLogError(@"Error while fetching type definiton for object type %@: %@", self.objectType, error.description);
+ }
+ if (completionBlock) {
+ completionBlock(error);
+ }
+ }];
+ }
+}
+
+
- (NSArray *)nonNilArray:(NSArray *)aArray
{ // Move to category on NSArray?
return ((aArray == nil) ? [NSArray array] : aArray);
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Thu Sep 26 14:21:57 2013
@@ -217,9 +217,13 @@
} else {
CMISObject *object = nil;
if (objectData) {
- object = [self.objectConverter convertObject:objectData];
+ [self.objectConverter convertObject:objectData
+ completionBlock:^(CMISObject *object, NSError *error) {
+ completionBlock(object, error);
+ }];
+ } else {
+ completionBlock(object, nil);
}
- completionBlock(object, nil);
}
}];
}
@@ -241,8 +245,11 @@
includeACL:operationContext.includeACLs
includeAllowableActions:operationContext.includeAllowableActions
completionBlock:^(CMISObjectData *objectData, NSError *error) {
- if (objectData != nil && error == nil) {
- completionBlock([self.objectConverter convertObject:objectData], nil);
+ if (objectData != nil && error == nil) {
+ [self.objectConverter convertObject:objectData
+ completionBlock:^(CMISObject *object, NSError *error) {
+ completionBlock(object, error);
+ }];
} else {
if (error == nil) {
NSError *error = [[NSError alloc] init];
@@ -368,13 +375,11 @@
result.hasMoreItems = objectList.hasMoreItems;
result.numItems = objectList.numItems;
- NSMutableArray *resultArray = [[NSMutableArray alloc] init];
- result.resultArray = resultArray;
- for (CMISObjectData *objectData in objectList.objects)
- {
- [resultArray addObject:[self.objectConverter convertObject:objectData]];
- }
- pageBlockCompletionBlock(result, nil);
+ [self.objectConverter convertObjects:objectList.objects
+ completionBlock:^(NSArray *objects, NSError *error) {
+ result.resultArray = objects;
+ pageBlockCompletionBlock(result, error);
+ }];
}
}];
};
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISEnums.h Thu Sep 26 14:21:57 2013
@@ -134,6 +134,14 @@ typedef enum
CMISDelete, // default
} CMISUnfileObject;
+// ContentStreamAllowed
+typedef enum
+{
+ CMISContentStreamNotAllowed,
+ CMISContentStreamAllowed,
+ CMISContentStreamRequired
+} CMISContentStreamAllowedType;
+
@interface CMISEnums : NSObject
+ (NSString *)stringForIncludeRelationShip:(CMISIncludeRelationship)includeRelationship;
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.h?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.h Thu Sep 26 14:21:57 2013
@@ -20,7 +20,6 @@
#import <Foundation/Foundation.h>
#import "CMISObject.h"
#import "CMISObjectData.h"
-#import "CMISCollection.h"
@class CMISSession;
@@ -28,8 +27,8 @@
- (id)initWithSession:(CMISSession *)session;
-- (CMISObject *)convertObject:(CMISObjectData *)objectData;
-- (CMISCollection *)convertObjects:(NSArray *)objects;
+- (void)convertObject:(CMISObjectData *)objectData completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
+- (void)convertObjects:(NSArray *)objectDatas completionBlock:(void (^)(NSArray *objects, NSError *error))completionBlock;
/**
* Converts the given dictionary of properties, where the key is the property id and the value
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISObjectConverter.m Thu Sep 26 14:21:57 2013
@@ -45,7 +45,7 @@
return self;
}
-- (CMISObject *)convertObject:(CMISObjectData *)objectData
+- (void)convertObject:(CMISObjectData *)objectData completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
{
CMISObject *object = nil;
@@ -55,21 +55,41 @@
object = [[CMISFolder alloc] initWithObjectData:objectData session:self.session];
}
- return object;
+ [object fetchTypeDefinitionWithCompletionBlock:^(NSError *error) {
+ completionBlock(object, error);
+ }];
}
-- (CMISCollection *)convertObjects:(NSArray *)objects
+
+- (void)internalConvertObject:(NSArray *)objectDatas position:(NSInteger)position completionBlock:(void (^)(NSMutableArray *objects, NSError *error))completionBlock
{
- NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:[objects count]];
-
- for (CMISObjectData *object in objects) {
- [items addObject:[self convertObject:object]];
+ [self convertObject:[objectDatas objectAtIndex:position]
+ completionBlock:^(CMISObject *object, NSError *error) {
+ if (position == 0) {
+ NSMutableArray *objects = [[NSMutableArray alloc] initWithCapacity:objectDatas.count];
+ [objects addObject:object];
+ completionBlock(objects, error);
+ } else {
+ [self internalConvertObject:objectDatas position:(position - 1) completionBlock:^(NSMutableArray *objects, NSError *error) {
+ [objects addObject:object];
+ completionBlock(objects, error);
+ }];
+ }
+ }];
+}
+
+
+- (void)convertObjects:(NSArray *)objectDatas completionBlock:(void (^)(NSArray *objects, NSError *error))completionBlock
+{
+ if (objectDatas.count > 0) {
+ [self internalConvertObject:objectDatas
+ position:(objectDatas.count - 1) // start recursion with last item
+ completionBlock:^(NSMutableArray *objects, NSError *error) {
+ completionBlock(objects, error);
+ }];
+ } else {
+ completionBlock([[NSArray alloc] init], nil);
}
-
- // create the collection
- CMISCollection *collection = [[CMISCollection alloc] initWithItems:items];
-
- return collection;
}
Modified: chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m?rev=1526505&r1=1526504&r2=1526505&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m Thu Sep 26 14:21:57 2013
@@ -353,7 +353,7 @@
NSError *fileError = nil;
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&fileError];
STAssertNil(fileError, @"Could not verify attributes of file %@: %@", filePath, [fileError description]);
- STAssertTrue([fileAttributes fileSize] > 10, @"Expected a file of at least 10 bytes, but found one of %d bytes", [fileAttributes fileSize]);
+ STAssertTrue([fileAttributes fileSize] >= 10, @"Expected a file of at least 10 bytes, but found one of %d bytes", [fileAttributes fileSize]);
// Nice boys clean up after themselves
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&fileError];