Author: pweschmidt
Date: Fri Feb 8 13:51:03 2013
New Revision: 1444011
URL: http://svn.apache.org/r1444011
Log:
reinstated versioning services to branch/trunk
Added:
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h
(with props)
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
(with props)
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
(with props)
Added:
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h
URL:
http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h?rev=1444011&view=auto
==============================================================================
---
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h
(added)
+++
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h
Fri Feb 8 13:51:03 2013
@@ -0,0 +1,25 @@
+/*
+ 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 "CMISAtomPubBaseService.h"
+
+
+@interface CMISAtomPubVersioningService : CMISAtomPubBaseService
<CMISVersioningService>
+@end
\ No newline at end of file
Propchange:
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.h
------------------------------------------------------------------------------
svn:eol-style = native
Added:
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
URL:
http://svn.apache.org/viewvc/chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m?rev=1444011&view=auto
==============================================================================
---
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
(added)
+++
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
Fri Feb 8 13:51:03 2013
@@ -0,0 +1,95 @@
+/*
+ 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 "CMISAtomPubVersioningService.h"
+#import "CMISAtomPubBaseService+Protected.h"
+#import "CMISAtomPubConstants.h"
+#import "CMISHttpResponse.h"
+#import "CMISAtomFeedParser.h"
+#import "CMISErrors.h"
+#import "CMISURLUtil.h"
+
+@implementation CMISAtomPubVersioningService
+
+- (void)retrieveObjectOfLatestVersion:(NSString *)objectId
+ major:(BOOL)major
+ filter:(NSString *)filter
+
includeRelationShips:(CMISIncludeRelationship)includeRelationships
+ includePolicyIds:(BOOL)includePolicyIds
+ renditionFilter:(NSString *)renditionFilter
+ includeACL:(BOOL)includeACL
+ includeAllowableActions:(BOOL)includeAllowableActions
+ completionBlock:(void (^)(CMISObjectData *objectData,
NSError *error))completionBlock
+{
+ [self retrieveObjectInternal:objectId withReturnVersion:(major ?
LATEST_MAJOR : LATEST)
+ withFilter:filter
andIncludeRelationShips:includeRelationships
+ andIncludePolicyIds:includePolicyIds
andRenditionFilder:renditionFilter
+ andIncludeACL:includeACL
andIncludeAllowableActions:includeAllowableActions
+ completionBlock:^(CMISObjectData *objectData, NSError *error)
{
+ completionBlock(objectData, error);
+ }];
+}
+
+- (void)retrieveAllVersions:(NSString *)objectId
+ filter:(NSString *)filter
+ includeAllowableActions:(BOOL)includeAllowableActions
+ completionBlock:(void (^)(NSArray *objects, NSError
*error))completionBlock
+{
+ // Validate params
+ if (!objectId)
+ {
+ log(@"Must provide an objectId when retrieving all versions");
+ completionBlock(nil, [CMISErrors
createCMISErrorWithCode:kCMISErrorCodeObjectNotFound
withDetailedDescription:nil]);
+ return;
+ }
+
+ // Fetch version history link
+ [self loadLinkForObjectId:objectId andRelation:kCMISLinkVersionHistory
completionBlock:^(NSString *versionHistoryLink, NSError *error) {
+ if (error) {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeObjectNotFound]);
+ return;
+ }
+
+ if (filter) {
+ versionHistoryLink = [CMISURLUtil
urlStringByAppendingParameter:kCMISParameterFilter withValue:filter
toUrlString:versionHistoryLink];
+ }
+ versionHistoryLink = [CMISURLUtil
urlStringByAppendingParameter:kCMISParameterIncludeAllowableActions
+
withValue:(includeAllowableActions ? @"true" : @"false")
toUrlString:versionHistoryLink];
+
+ // Execute call
+ [self.bindingSession.networkProvider invokeGET:[NSURL
URLWithString:versionHistoryLink]
+ withSession:self.bindingSession
+ completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) {
+ if (httpResponse) {
+ NSData *data = httpResponse.data;
+ CMISAtomFeedParser *feedParser = [[CMISAtomFeedParser
alloc] initWithData:data];
+ NSError *error;
+ if (![feedParser parseAndReturnError:&error]) {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeVersioning]);
+ } else {
+ completionBlock(feedParser.entries, nil);
+ }
+ } else {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeConnection]);
+ }
+ }];
+ }];
+}
+
+@end
\ No newline at end of file
Propchange:
chemistry/objectivecmis/branches/mdm/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
------------------------------------------------------------------------------
svn:eol-style = native
Added:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
URL:
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m?rev=1444011&view=auto
==============================================================================
---
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
(added)
+++
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
Fri Feb 8 13:51:03 2013
@@ -0,0 +1,95 @@
+/*
+ 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 "CMISAtomPubVersioningService.h"
+#import "CMISAtomPubBaseService+Protected.h"
+#import "CMISAtomPubConstants.h"
+#import "CMISHttpResponse.h"
+#import "CMISAtomFeedParser.h"
+#import "CMISErrors.h"
+#import "CMISURLUtil.h"
+
+@implementation CMISAtomPubVersioningService
+
+- (void)retrieveObjectOfLatestVersion:(NSString *)objectId
+ major:(BOOL)major
+ filter:(NSString *)filter
+
includeRelationShips:(CMISIncludeRelationship)includeRelationships
+ includePolicyIds:(BOOL)includePolicyIds
+ renditionFilter:(NSString *)renditionFilter
+ includeACL:(BOOL)includeACL
+ includeAllowableActions:(BOOL)includeAllowableActions
+ completionBlock:(void (^)(CMISObjectData *objectData,
NSError *error))completionBlock
+{
+ [self retrieveObjectInternal:objectId withReturnVersion:(major ?
LATEST_MAJOR : LATEST)
+ withFilter:filter
andIncludeRelationShips:includeRelationships
+ andIncludePolicyIds:includePolicyIds
andRenditionFilder:renditionFilter
+ andIncludeACL:includeACL
andIncludeAllowableActions:includeAllowableActions
+ completionBlock:^(CMISObjectData *objectData, NSError *error)
{
+ completionBlock(objectData, error);
+ }];
+}
+
+- (void)retrieveAllVersions:(NSString *)objectId
+ filter:(NSString *)filter
+ includeAllowableActions:(BOOL)includeAllowableActions
+ completionBlock:(void (^)(NSArray *objects, NSError
*error))completionBlock
+{
+ // Validate params
+ if (!objectId)
+ {
+ log(@"Must provide an objectId when retrieving all versions");
+ completionBlock(nil, [CMISErrors
createCMISErrorWithCode:kCMISErrorCodeObjectNotFound
withDetailedDescription:nil]);
+ return;
+ }
+
+ // Fetch version history link
+ [self loadLinkForObjectId:objectId andRelation:kCMISLinkVersionHistory
completionBlock:^(NSString *versionHistoryLink, NSError *error) {
+ if (error) {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeObjectNotFound]);
+ return;
+ }
+
+ if (filter) {
+ versionHistoryLink = [CMISURLUtil
urlStringByAppendingParameter:kCMISParameterFilter withValue:filter
toUrlString:versionHistoryLink];
+ }
+ versionHistoryLink = [CMISURLUtil
urlStringByAppendingParameter:kCMISParameterIncludeAllowableActions
+
withValue:(includeAllowableActions ? @"true" : @"false")
toUrlString:versionHistoryLink];
+
+ // Execute call
+ [self.bindingSession.networkProvider invokeGET:[NSURL
URLWithString:versionHistoryLink]
+ withSession:self.bindingSession
+ completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) {
+ if (httpResponse) {
+ NSData *data = httpResponse.data;
+ CMISAtomFeedParser *feedParser = [[CMISAtomFeedParser
alloc] initWithData:data];
+ NSError *error;
+ if (![feedParser parseAndReturnError:&error]) {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeVersioning]);
+ } else {
+ completionBlock(feedParser.entries, nil);
+ }
+ } else {
+ completionBlock(nil, [CMISErrors cmisError:error
withCMISErrorCode:kCMISErrorCodeConnection]);
+ }
+ }];
+ }];
+}
+
+@end
\ No newline at end of file
Propchange:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
------------------------------------------------------------------------------
svn:eol-style = native