You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by lg...@apache.org on 2014/10/20 13:28:48 UTC
svn commit: r1633106 - in /chemistry/objectivecmis/trunk/ObjectiveCMIS:
Bindings/AtomPub/AtomPubParser/ Client/ Common/ Utils/
Author: lgross
Date: Mon Oct 20 11:28:47 2014
New Revision: 1633106
URL: http://svn.apache.org/r1633106
Log:
- Added interfaces to CMISSession to retrieve latest document revision
- Changed Parameter type of enumerateObjectsUsingBlock in CMISPagedResult from CMISObject to id, to make method usable also in other results, e.g. CMISQueryResult
- Fixed URL encoding in CMISURLUtil, some chars in repository identifier could break URL, e.g. '+'
- Additional minor fixes
Modified:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISURLUtil.m
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m Mon Oct 20 11:28:47 2014
@@ -140,6 +140,7 @@
self.currentPropertyData.identifier = [attributeDict objectForKey:kCMISAtomEntryPropertyDefId];
self.currentPropertyData.queryName = [attributeDict objectForKey:kCMISAtomEntryQueryName];
self.currentPropertyData.displayName = [attributeDict objectForKey:kCMISAtomEntryDisplayName];
+ self.currentPropertyData.type = [CMISAtomPubParserUtil atomPubTypeToInternalType:self.currentPropertyType];
} else if ([elementName isEqualToString:kCMISCoreProperties]) {
// create the CMISProperties object to hold all property data
self.currentObjectProperties = [[CMISProperties alloc] init];
@@ -241,7 +242,9 @@
if (self.currentRenditions == nil) {
self.currentRenditions = [[NSMutableArray alloc] init];
}
- [self.currentRenditions addObject:self.currentRendition];
+ if (self.currentRendition != nil) {
+ [self.currentRenditions addObject:self.currentRendition];
+ }
self.currentRendition = nil;
} else if ([elementName isEqualToString:kCMISAtomEntryExactACL]) {
self.isExcatAcl = [self.string isEqualToString:@"true"] ? YES : NO;
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.h?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.h Mon Oct 20 11:28:47 2014
@@ -62,7 +62,7 @@ typedef void (^CMISFetchNextPageBlock)(i
* enumerates through the items in a page
* completionBlock returns NSError nil if successful
*/
-- (void)enumerateItemsUsingBlock:(void (^)(CMISObject *object, BOOL *stop))enumerationBlock
+- (void)enumerateItemsUsingBlock:(void (^)(id object, BOOL *stop))enumerationBlock
completionBlock:(void (^)(NSError *error))completionBlock;
@end
\ No newline at end of file
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.m?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISPagedResult.m Mon Oct 20 11:28:47 2014
@@ -99,7 +99,7 @@
completionBlock:completionBlock];
}
-- (void)enumerateItemsUsingBlock:(void (^)(CMISObject *object, BOOL *stop))enumerationBlock completionBlock:(void (^)(NSError *error))completionBlock
+- (void)enumerateItemsUsingBlock:(void (^)(id object, BOOL *stop))enumerationBlock completionBlock:(void (^)(NSError *error))completionBlock
{
BOOL stop = NO;
for (CMISObject *object in self.resultArray) {
@@ -110,7 +110,8 @@
return;
}
}
- if (self.hasMoreItems) {
+ // Additional check if call returned any result as server may return hasMoreItems even if there are none; this could result in an endless loop
+ if (self.hasMoreItems && [self.resultArray count] > 0) {
[self fetchNextPageWithCompletionBlock:^(CMISPagedResult *result, NSError *error) {
if (error) {
completionBlock(error);
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h Mon Oct 20 11:28:47 2014
@@ -122,6 +122,25 @@
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
+ * Retrieves the latest version in a version series with the given identifier of an arbitrary version in the version series.
+ * completionBlock returns the CMIS document or nil if unsuccessful
+ */
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+
+/**
+ * Retrieves the latest version in a version series with the given identifier of an arbitrary version in the version series, using the provided operation context.
+ * completionBlock returns the CMIS document or nil if unsuccessful
+ */
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId operationContext:(CMISOperationContext*)operationContext completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+
+/**
+ * Retrieves the latest version in a version series with the given identifier of an arbitrary version in the version series, using the provided operation context.
+ * if major is 'YES' the latest major version will be returned, otherwise the very last version will be returned
+ * completionBlock returns the CMIS document or nil if unsuccessful
+ */
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId operationContext:(CMISOperationContext*)operationContext major:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+
+/**
* Retrieves the definition for the given type.
* completionBlock returns the CMIS type definition or nil if unsuccessful
*/
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.m Mon Oct 20 11:28:47 2014
@@ -310,6 +310,45 @@
}];
}
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
+{
+ return [self retrieveDocumentOfLatestVersion:objectId
+ operationContext:[CMISOperationContext defaultOperationContext]
+ completionBlock:completionBlock];
+}
+
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId operationContext:(CMISOperationContext*)operationContext completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
+{
+ return [self retrieveDocumentOfLatestVersion:objectId
+ operationContext:operationContext
+ major:NO completionBlock:completionBlock];
+}
+
+- (CMISRequest*)retrieveDocumentOfLatestVersion:(NSString *)objectId operationContext:(CMISOperationContext*)operationContext major:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
+{
+ return [self.binding.versioningService retrieveObjectOfLatestVersion:objectId
+ major:major
+ filter:operationContext.filterString
+ relationships:operationContext.relationships
+ includePolicyIds:operationContext.includePolicies
+ renditionFilter:operationContext.renditionFilterString
+ includeACL:operationContext.includeACLs
+ includeAllowableActions:operationContext.includeAllowableActions
+ completionBlock:^(CMISObjectData *objectData, NSError *error) {
+ if (objectData != nil && error == nil) {
+ [self.objectConverter convertObject:objectData
+ completionBlock:^(CMISObject *object, NSError *error) {
+ completionBlock((CMISDocument*)object, error);
+ }];
+ } else {
+ if (error == nil) {
+ error = [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeObjectNotFound];
+ }
+ completionBlock(nil, error);
+ }
+ }];
+}
+
- (CMISRequest*)retrieveTypeDefinition:(NSString *)typeId completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock
{
CMISTypeDefinition *typeDefinition = [self.typeCache objectForKey:typeId];
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAllowableActions.m Mon Oct 20 11:28:47 2014
@@ -65,7 +65,9 @@
// TODO: Check that the idx is valid in the defined enum
NSInteger idx = [actionsArray indexOfObject:actionStrValue];
- [allowableActionTypesSet addObject:INT_OBJ(idx)];
+ if (idx != NSNotFound) {
+ [allowableActionTypesSet addObject:INT_OBJ(idx)];
+ }
}
return [allowableActionTypesSet copy];
}
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISURLUtil.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISURLUtil.m?rev=1633106&r1=1633105&r2=1633106&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISURLUtil.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISURLUtil.m Mon Oct 20 11:28:47 2014
@@ -56,7 +56,7 @@ NSString * const kCMISRFC3986Reserved =
// Append param
[result appendString:parameterName];
[result appendString:@"="];
- [result appendString:[parameterValue stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+ [result appendString:[CMISURLUtil encodeUrlParameterValue:parameterValue]];
return result;
}