cleaned up comments. Removed @synthesize statements. Consistent use of curly brackets in methods
git-svn-id: https://svn.apache.org/repos/asf/chemistry/objectivecmis/branches/mdm@1444689 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ObjectiveCMIS.xcodeproj/project.pbxproj b/ObjectiveCMIS.xcodeproj/project.pbxproj
index 6364aa6..8a83da3 100644
--- a/ObjectiveCMIS.xcodeproj/project.pbxproj
+++ b/ObjectiveCMIS.xcodeproj/project.pbxproj
@@ -561,8 +561,8 @@
752067F8156AC0FE00231A5D /* CMISExtensionElement.h */,
752067F9156AC0FE00231A5D /* CMISExtensionElement.m */,
828072F61515404F00EF635C /* CMISObjectData.h */,
- 4E3E14B116AFFB190057CE22 /* CMISNetworkProvider.h */,
828072F71515404F00EF635C /* CMISObjectData.m */,
+ 4E3E14B116AFFB190057CE22 /* CMISNetworkProvider.h */,
828072F81515404F00EF635C /* CMISProperties.h */,
828072F91515404F00EF635C /* CMISProperties.m */,
828072FA1515404F00EF635C /* CMISPropertyData.h */,
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.h
index 0a1c3cc..b9bbe6d 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.h
@@ -33,11 +33,15 @@
@interface CMISAllowableActionsParser : CMISAtomPubExtensionDataParserBase <NSXMLParserDelegate>
@property (nonatomic, strong) CMISAllowableActions *allowableActions;
-// Designated Initializer
+/// Designated Initializer
- (id)initWithData:(NSData*)atomData;
+
+/**
+ parse method. returns NO if unsuccessful
+ */
- (BOOL)parseAndReturnError:(NSError **)error;
-// Delegates parsing to child parser, ensure that the Element is 'allowableActions'
+/// Delegates parsing to child parser, ensure that the Element is 'allowableActions'
+ (id)allowableActionsParserWithParentDelegate:(id<NSXMLParserDelegate, CMISAllowableActionsParserDelegate>)parentDelegate parser:(NSXMLParser *)parser;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.m
index 7743d30..33d1fba 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAllowableActionsParser.m
@@ -34,20 +34,13 @@
@implementation CMISAllowableActionsParser
-@synthesize internalAllowableActionsDict = _internalAllowableActionsDict;
-@synthesize parentDelegate = _parentDelegate;
-@synthesize string = _string;
-@synthesize atomData = _atomData;
-@synthesize allowableActions;
-
#pragma mark -
#pragma mark Init/Create methods
- (id)initWithParentDelegate:(id<NSXMLParserDelegate, CMISAllowableActionsParserDelegate>)parentDelegate parser:(NSXMLParser *)parser
{
self = [self initWithData:nil];
- if (self)
- {
+ if (self) {
self.parentDelegate = parentDelegate;
self.internalAllowableActionsDict = [[NSMutableDictionary alloc] init];
@@ -69,8 +62,7 @@
- (id)initWithData:(NSData*)atomData
{
self = [super init];
- if (self)
- {
+ if (self) {
self.atomData = atomData;
}
@@ -88,10 +80,8 @@
parseSuccessful = [parser parse];
- if (!parseSuccessful)
- {
- if (error)
- {
+ if (!parseSuccessful) {
+ if (error) {
*error = [parser parserError];
}
}
@@ -106,23 +96,18 @@
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict
{
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
- if ([elementName isEqualToString:kCMISAtomEntryAllowableActions])
- {
+ if ([elementName isEqualToString:kCMISAtomEntryAllowableActions]) {
[self setInternalAllowableActionsDict:[NSMutableDictionary dictionary]];
self.allowableActions = [[CMISAllowableActions alloc] init];
[self pushNewCurrentExtensionData:self.allowableActions];
- }
- else
- {
+ } else {
self.string = [NSMutableString string];
}
}
- else
- {
+ else {
self.childParserDelegate = [CMISAtomPubExtensionElementParser extensionElementParserWithElementName:elementName namespaceUri:namespaceURI
attributes:attributeDict parentDelegate:self parser:parser];
}
@@ -135,19 +120,15 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
- if ([elementName isEqualToString:kCMISAtomEntryAllowableActions])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
+ if ([elementName isEqualToString:kCMISAtomEntryAllowableActions]) {
// Set the parsed dictionary of allowable actions
[self.allowableActions setAllowableActionsWithDictionary:[self.internalAllowableActionsDict copy]];
// Save the extension data
[self saveCurrentExtensionsAndPushPreviousExtensionData];
- if (self.parentDelegate)
- {
- if ([self.parentDelegate respondsToSelector:@selector(allowableActionsParser:didFinishParsingAllowableActions:)])
- {
+ if (self.parentDelegate) {
+ if ([self.parentDelegate respondsToSelector:@selector(allowableActionsParser:didFinishParsingAllowableActions:)]) {
[self.parentDelegate performSelector:@selector(allowableActionsParser:didFinishParsingAllowableActions:) withObject:self withObject:self.allowableActions];
}
@@ -155,9 +136,7 @@
[parser setDelegate:self.parentDelegate];
self.parentDelegate = nil;
}
- }
- else
- {
+ } else {
[self.internalAllowableActionsDict setObject:self.string forKey:elementName];
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h
index 1b0e170..5f7364d 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.h
@@ -33,11 +33,12 @@
@property (nonatomic, strong, readonly) CMISObjectData *objectData;
-// Designated Initializer
+/// Designated Initializer
- (id)initWithData:(NSData *)atomData;
+/// parse method. returns NO if unsuccessful
- (BOOL)parseAndReturnError:(NSError **)error;
-// Initializes a child parser for an Atom Entry and takes over parsing control while parsing the Atom Entry
+/// Initializes a child parser for an Atom Entry and takes over parsing control while parsing the Atom Entry
+ (id)atomEntryParserWithAtomEntryAttributes:(NSDictionary *)attributes parentDelegate:(id<NSXMLParserDelegate, CMISAtomEntryParserDelegate>)parentDelegate parser:(NSXMLParser *)parser;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
index c5c20b9..505e328 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
@@ -49,25 +49,12 @@
@implementation CMISAtomEntryParser
-@synthesize objectData = _objectData;
-@synthesize atomData = _atomData;
-@synthesize currentPropertyType = _currentPropertyType;
-@synthesize currentPropertyData = _currentPropertyData;
-@synthesize propertyValues = _propertyValues;
-@synthesize currentObjectProperties = _currentObjectProperties;
-@synthesize currentLinkRelations = _currentLinkRelations;
-@synthesize parentDelegate = _parentDelegate;
-@synthesize entryAttributesDict = _entryAttributesDict;
-@synthesize currentRendition = _currentRendition;
-@synthesize currentRenditions = _currentRenditions;
-@synthesize string = _string;
// Designated Initializer
- (id)init
{
self = [super init];
- if (self)
- {
+ if (self) {
self.currentLinkRelations = [NSMutableSet set];
}
return self;
@@ -76,8 +63,7 @@
- (id)initWithData:(NSData *)atomData
{
self = [self init];
- if (self)
- {
+ if (self) {
self.atomData = atomData;
}
@@ -98,10 +84,8 @@
parseSuccessful = [parser parse];
- if (!parseSuccessful)
- {
- if (error)
- {
+ if (!parseSuccessful){
+ if (error) {
*error = [parser parserError];
}
}
@@ -112,8 +96,7 @@
- (id)initWithAtomEntryAttributes:(NSDictionary *)attributes parentDelegate:(id<NSXMLParserDelegate, CMISAtomEntryParserDelegate>)parentDelegate parser:(NSXMLParser *)parser
{
self = [self init];
- if (self)
- {
+ if (self) {
self.objectData = [[CMISObjectData alloc] init];
self.entryAttributesDict = attributes;
self.parentDelegate = parentDelegate;
@@ -137,8 +120,7 @@
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
if ([elementName isEqualToString:kCMISAtomEntryPropertyId] ||
[elementName isEqualToString:kCMISAtomEntryPropertyString] ||
[elementName isEqualToString:kCMISAtomEntryPropertyInteger] ||
@@ -146,8 +128,7 @@
[elementName isEqualToString:kCMISAtomEntryPropertyBoolean] ||
[elementName isEqualToString:kCMISAtomEntryPropertyUri] ||
[elementName isEqualToString:kCMISAtomEntryPropertyHtml] ||
- [elementName isEqualToString:kCMISAtomEntryPropertyDecimal])
- {
+ [elementName isEqualToString:kCMISAtomEntryPropertyDecimal]) {
self.propertyValues = [NSMutableArray array];
// store attribute values in CMISPropertyData object
self.currentPropertyType = elementName;
@@ -155,57 +136,38 @@
self.currentPropertyData.identifier = [attributeDict objectForKey:kCMISAtomEntryPropertyDefId];
self.currentPropertyData.queryName = [attributeDict objectForKey:kCMISAtomEntryQueryName];
self.currentPropertyData.displayName = [attributeDict objectForKey:kCMISAtomEntryDisplayName];
- }
- else if ([elementName isEqualToString:kCMISCoreProperties])
- {
+ } else if ([elementName isEqualToString:kCMISCoreProperties]) {
// create the CMISProperties object to hold all property data
self.currentObjectProperties = [[CMISProperties alloc] init];
// Set ObjectProperties as the current extensionData object
[self pushNewCurrentExtensionData:self.currentObjectProperties];
- }
- else if ([elementName isEqualToString:kCMISCoreRendition])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRendition]) {
self.currentRendition = [[CMISRenditionData alloc] init];
- }
- else if ([elementName isEqualToString:kCMISAtomEntryAllowableActions])
- {
+ } else if ([elementName isEqualToString:kCMISAtomEntryAllowableActions]) {
// Delegate parsing to child parser for allowableActions element
self.childParserDelegate = [CMISAllowableActionsParser allowableActionsParserWithParentDelegate:self parser:parser];
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom])
- {
- if ([elementName isEqualToString:kCMISAtomEntryObject])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom]) {
+ if ([elementName isEqualToString:kCMISAtomEntryObject]) {
// Set object data as the current extensionData object
[self pushNewCurrentExtensionData:self.objectData];
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceAtom])
- {
- if ([elementName isEqualToString:kCMISAtomEntryLink])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceAtom]) {
+ if ([elementName isEqualToString:kCMISAtomEntryLink]) {
NSString *linkType = [attributeDict objectForKey:kCMISAtomEntryType];
NSString *rel = [attributeDict objectForKey:kCMISAtomEntryRel];
NSString *href = [attributeDict objectForKey:kCMISAtomEntryHref];
CMISAtomLink *link = [[CMISAtomLink alloc] initWithRelation:rel type:linkType href:href];
[self.currentLinkRelations addObject:link];
- }
- else if ([elementName isEqualToString:kCMISAtomEntryContent])
- {
+ } else if ([elementName isEqualToString:kCMISAtomEntryContent]) {
self.objectData.contentUrl = [NSURL URLWithString:[attributeDict objectForKey:kCMISAtomEntrySrc]];
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceApp])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceApp]) {
// Nothing to do in this namespace
- }
- else
- {
- if (self.currentExtensionData != nil)
- {
+ } else {
+ if (self.currentExtensionData != nil) {
self.childParserDelegate = [CMISAtomPubExtensionElementParser extensionElementParserWithElementName:elementName namespaceUri:namespaceURI
attributes:attributeDict parentDelegate:self parser:parser];
}
@@ -223,48 +185,29 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([elementName isEqualToString:kCMISAtomEntryValue])
- {
+ if ([elementName isEqualToString:kCMISAtomEntryValue]) {
[CMISAtomParserUtil parsePropertyValue:self.string withPropertyType:self.currentPropertyType addToArray:self.propertyValues];
- }
- else if (self.currentRendition != nil)
- {
- if ([elementName isEqualToString:kCMISCoreStreamId])
- {
+ } else if (self.currentRendition != nil) {
+ if ([elementName isEqualToString:kCMISCoreStreamId]) {
self.currentRendition.streamId = self.string;
- }
- else if ([elementName isEqualToString:kCMISCoreMimetype])
- {
+ } else if ([elementName isEqualToString:kCMISCoreMimetype]) {
self.currentRendition.mimeType = self.string;
- }
- else if ([elementName isEqualToString:kCMISCoreLength])
- {
+ } else if ([elementName isEqualToString:kCMISCoreLength]) {
self.currentRendition.length = [NSNumber numberWithInteger:[self.string integerValue]];
- }
- else if ([elementName isEqualToString:kCMISCoreTitle])
- {
+ } else if ([elementName isEqualToString:kCMISCoreTitle]) {
self.currentRendition.title = self.string;
- }
- else if ([elementName isEqualToString:kCMISCoreKind])
- {
+ } else if ([elementName isEqualToString:kCMISCoreKind]) {
self.currentRendition.kind = self.string;
- }
- else if ([elementName isEqualToString:kCMISCoreHeight])
- {
+ } else if ([elementName isEqualToString:kCMISCoreHeight]) {
self.currentRendition.height = [NSNumber numberWithInteger:[self.string integerValue]];
- }
- else if ([elementName isEqualToString:kCMISCoreWidth])
- {
+ } else if ([elementName isEqualToString:kCMISCoreWidth]) {
self.currentRendition.width = [NSNumber numberWithInteger:[self.string integerValue]];
- }
- else if ([elementName isEqualToString:kCMISCoreRenditionDocumentId])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRenditionDocumentId]) {
self.currentRendition.renditionDocumentId = self.string;
}
}
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
if ([elementName isEqualToString:kCMISAtomEntryPropertyId] ||
[elementName isEqualToString:kCMISAtomEntryPropertyString] ||
[elementName isEqualToString:kCMISAtomEntryPropertyInteger] ||
@@ -272,33 +215,24 @@
[elementName isEqualToString:kCMISAtomEntryPropertyBoolean] ||
[elementName isEqualToString:kCMISAtomEntryPropertyUri] ||
[elementName isEqualToString:kCMISAtomEntryPropertyHtml] ||
- [elementName isEqualToString:kCMISAtomEntryPropertyDecimal])
- {
+ [elementName isEqualToString:kCMISAtomEntryPropertyDecimal]) {
// add the property to the properties dictionary
self.currentPropertyData.values = self.propertyValues;
self.propertyValues = nil;
[self.currentObjectProperties addProperty:self.currentPropertyData];
self.currentPropertyData = nil;
- }
- else if ([elementName isEqualToString:kCMISCoreProperties])
- {
+ } else if ([elementName isEqualToString:kCMISCoreProperties]) {
// Finished parsing Properties & its ExtensionData
[self saveCurrentExtensionsAndPushPreviousExtensionData];
- }
- else if ([elementName isEqualToString:kCMISCoreRendition])
- {
- if (self.currentRenditions == nil)
- {
+ } else if ([elementName isEqualToString:kCMISCoreRendition]) {
+ if (self.currentRenditions == nil) {
self.currentRenditions = [[NSMutableArray alloc] init];
}
[self.currentRenditions addObject:self.currentRendition];
self.currentRendition = nil;
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceAtom])
- {
- if ( [elementName isEqualToString:kCMISAtomEntry])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceAtom]) {
+ if ( [elementName isEqualToString:kCMISAtomEntry]) {
// set the properties on the objectData object
self.objectData.properties = self.currentObjectProperties;
@@ -315,12 +249,9 @@
// set the objectData baseType
CMISPropertyData *baseTypeProperty = [self.currentObjectProperties.propertiesDictionary objectForKey:kCMISPropertyBaseTypeId];
NSString *baseType = [baseTypeProperty firstValue];
- if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueDocument])
- {
+ if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueDocument]) {
self.objectData.baseType = CMISBaseTypeDocument;
- }
- else if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueFolder])
- {
+ } else if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueFolder]) {
self.objectData.baseType = CMISBaseTypeFolder;
}
@@ -329,10 +260,8 @@
self.currentObjectProperties = nil;
- if (self.parentDelegate)
- {
- if ([self.parentDelegate respondsToSelector:@selector(cmisAtomEntryParser:didFinishParsingCMISObjectData:)])
- {
+ if (self.parentDelegate) {
+ if ([self.parentDelegate respondsToSelector:@selector(cmisAtomEntryParser:didFinishParsingCMISObjectData:)]) {
// Message the parent delegate the parsed ObjectData
[self.parentDelegate performSelector:@selector(cmisAtomEntryParser:didFinishParsingCMISObjectData:)
withObject:self withObject:self.objectData];
@@ -343,13 +272,9 @@
self.parentDelegate = nil;
}
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceApp])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceApp]) {
// Nothing to do in this namespace
- }
- else
- {
+ } else {
// TODO other namespaces?
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
index 763b9b9..97241f6 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
@@ -41,7 +41,9 @@
*/
@property (readonly) NSInteger numItems;
+/// designated initialiser
- (id)initWithData:(NSData*)feedData;
+/// parses the atom XML data. returns NO if unsuccessful
- (BOOL)parseAndReturnError:(NSError **)error;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
index cb10897..07499ee 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
@@ -31,18 +31,11 @@
@implementation CMISAtomFeedParser
-@synthesize feedData = _feedData;
-@synthesize internalEntries = _internalEntries;
-@synthesize numItems = _numItems;
-@synthesize feedLinkRelations = _feedLinkRelations;
-@synthesize childParserDelegate = _childParserDelegate;
-@synthesize string = _string;
- (id)initWithData:(NSData*)feedData
{
self = [super init];
- if (self)
- {
+ if (self) {
self.feedData = feedData;
self.feedLinkRelations = [NSMutableSet set];
}
@@ -52,12 +45,9 @@
- (NSArray *)entries
{
- if (self.internalEntries != nil)
- {
+ if (self.internalEntries != nil) {
return [NSArray arrayWithArray:self.internalEntries];
- }
- else
- {
+ } else {
return nil;
}
}
@@ -80,10 +70,8 @@
[parser setDelegate:self];
parseSuccessful = [parser parse];
- if (!parseSuccessful)
- {
- if (error)
- {
+ if (!parseSuccessful) {
+ if (error) {
*error = [parser parserError];
}
}
@@ -96,13 +84,10 @@
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
- if ([elementName isEqualToString:kCMISAtomEntry])
- {
+ if ([elementName isEqualToString:kCMISAtomEntry]) {
// Delegate parsing of AtomEntry element to the entry child parser
self.childParserDelegate = [CMISAtomEntryParser atomEntryParserWithAtomEntryAttributes:attributeDict parentDelegate:self parser:parser];
- }
- else if ([elementName isEqualToString:kCMISAtomEntryLink])
- {
+ } else if ([elementName isEqualToString:kCMISAtomEntryLink]) {
CMISAtomLink *link = [[CMISAtomLink alloc] init];
[link setValuesForKeysWithDictionary:attributeDict];
[self.feedLinkRelations addObject:link];
@@ -119,8 +104,7 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([elementName isEqualToString:kCMISAtomFeedNumItems])
- {
+ if ([elementName isEqualToString:kCMISAtomFeedNumItems]) {
self.numItems = [self.string integerValue];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.h
index e1e927b..38b2ebc 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.h
@@ -27,8 +27,14 @@
@interface CMISAtomParserUtil : NSObject
+/**
+ * converts an atomPubType to a CMISPropertyType object
+ */
+ (CMISPropertyType)atomPubTypeToInternalType:(NSString *)atomPubType;
+/**
+ * parses the property value and adds it to an array
+ */
+ (void)parsePropertyValue:(NSString *)stringValue withPropertyType:(NSString *)propertyType addToArray:(NSMutableArray*)array;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.m
index 43dff5c..cd63394 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomParserUtil.m
@@ -29,40 +29,23 @@
+ (CMISPropertyType)atomPubTypeToInternalType:(NSString *)atomPubType
{
- if([atomPubType isEqualToString:kCMISAtomEntryPropertyId])
- {
+ if([atomPubType isEqualToString:kCMISAtomEntryPropertyId]) {
return CMISPropertyTypeId;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyString])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyString]) {
return CMISPropertyTypeString;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyInteger])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyInteger]) {
return CMISPropertyTypeInteger;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyBoolean])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyBoolean]) {
return CMISPropertyTypeBoolean;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyDateTime])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyDateTime]) {
return CMISPropertyTypeDateTime;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyDecimal])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyDecimal]) {
return CMISPropertyTypeDecimal;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyHtml])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyHtml]) {
return CMISPropertyTypeHtml;
- }
- else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyUri])
- {
+ } else if ([atomPubType isEqualToString:kCMISAtomEntryPropertyUri]) {
return CMISPropertyTypeUri;
- }
- else
- {
+ } else {
log(@"Unknow property type %@. Go tell a developer to fix this.", atomPubType);
return CMISPropertyTypeString;
}
@@ -72,32 +55,19 @@
{
if ([propertyType isEqualToString:kCMISAtomEntryPropertyString] ||
[propertyType isEqualToString:kCMISAtomEntryPropertyId] ||
- [propertyType isEqualToString:kCMISAtomEntryPropertyHtml])
- {
+ [propertyType isEqualToString:kCMISAtomEntryPropertyHtml]) {
[array addObject:stringValue];
- }
- else if ([propertyType isEqualToString:kCMISAtomEntryPropertyInteger])
- {
+ } else if ([propertyType isEqualToString:kCMISAtomEntryPropertyInteger]) {
[array addObject:[NSNumber numberWithInt:[stringValue intValue]]];
- }
- else if ([propertyType isEqualToString:kCMISAtomEntryPropertyBoolean])
- {
+ } else if ([propertyType isEqualToString:kCMISAtomEntryPropertyBoolean]) {
[array addObject:[NSNumber numberWithBool:[stringValue isEqualToString:kCMISAtomEntryValueTrue]]];
- }
- else if ([propertyType isEqualToString:kCMISAtomEntryPropertyDateTime])
- {
+ } else if ([propertyType isEqualToString:kCMISAtomEntryPropertyDateTime]) {
[array addObject:[CMISDateUtil dateFromString:stringValue]];
- }
- else if ([propertyType isEqualToString:kCMISAtomEntryPropertyDecimal])
- {
+ } else if ([propertyType isEqualToString:kCMISAtomEntryPropertyDecimal]) {
[array addObject:[NSDecimalNumber decimalNumberWithString:stringValue]];
- }
- else if ([propertyType isEqualToString:kCMISAtomEntryPropertyUri])
- {
+ } else if ([propertyType isEqualToString:kCMISAtomEntryPropertyUri]) {
[array addObject:[NSURL URLWithString:stringValue]];
- }
- else
- {
+ } else {
log(@"Unknow property type %@. Go tell a developer to fix this.", propertyType);
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.h
index 11e35f7..ab57aff 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.h
@@ -30,9 +30,11 @@
- (id)init;
-// Saves the current extensionData and extensions state and sets the messaged object as the new current extensionData object
+/// Saves the current extensionData and extensions state and sets the messaged object as the new current extensionData object
+
- (void)pushNewCurrentExtensionData:(CMISExtensionData *)extensionDataObject;
-// Saves the current extensions on the extensionData object and makes the previous extensionData and extensions the current objects
+
+/// Saves the current extensions on the extensionData object and makes the previous extensionData and extensions the current objects
- (void)saveCurrentExtensionsAndPushPreviousExtensionData;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.m
index 20cea0b..d39442c 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionDataParserBase.m
@@ -21,10 +21,6 @@
@implementation CMISAtomPubExtensionDataParserBase
-@synthesize childParserDelegate = _childParserDelegate;
-@synthesize currentExtensions = _currentExtensions;
-@synthesize currentExtensionData = _currentExtensionData;
-@synthesize previousExtensionDataArray = _previousExtensionDataArray;
#pragma mark -
#pragma mark Initializers
@@ -33,8 +29,7 @@
- (id)init
{
self = [super init];
- if (self)
- {
+ if (self) {
self.previousExtensionDataArray = [NSMutableArray array];
}
return self;
@@ -46,10 +41,8 @@
- (void)pushNewCurrentExtensionData:(CMISExtensionData *)extensionDataObject
{
// Save the current state of the extensionData objects used for parsing
- if (self.currentExtensionData)
- {
- if (self.currentExtensions)
- {
+ if (self.currentExtensionData) {
+ if (self.currentExtensions) {
self.currentExtensionData.extensions = [self.currentExtensions copy];
}
@@ -73,8 +66,7 @@
self.currentExtensions = [self.currentExtensionData.extensions mutableCopy];
// if previous actually existed, remove last object
- if (self.currentExtensionData)
- {
+ if (self.currentExtensionData) {
[self.previousExtensionDataArray removeLastObject];
}
}
@@ -86,8 +78,7 @@
{
// TODO Should abstract the ExtensionData parsing as this pattern is repeated everywhere ExtensionData is getting parsed.
- if (self.currentExtensions == nil)
- {
+ if (self.currentExtensions == nil) {
self.currentExtensions = [[NSMutableArray alloc] init];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.h
index 9067077..706812f 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.h
@@ -24,12 +24,13 @@
@protocol CMISAtomPubExtensionElementParserDelegate <NSObject>
@required
+/// parses extension element
- (void)extensionElementParser:(CMISAtomPubExtensionElementParser *)parser didFinishParsingExtensionElement:(CMISExtensionElement *)extensionElement;
@end
@interface CMISAtomPubExtensionElementParser : NSObject <NSXMLParserDelegate, CMISAtomPubExtensionElementParserDelegate>
-
+/// extension element parser. returns parsed element
+ (id)extensionElementParserWithElementName:(NSString *)elementName namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributes parentDelegate:(id<NSXMLParserDelegate, CMISAtomPubExtensionElementParserDelegate>)parentDelegate parser:(NSXMLParser *)parser;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.m
index b3b0593..92b8fd6 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomPubExtensionElementParser.m
@@ -38,13 +38,6 @@
@implementation CMISAtomPubExtensionElementParser
-@synthesize childDelegate = _childDelegate;
-@synthesize parentDelegate = _parentDelegate;
-@synthesize extensionName = _extensionName;
-@synthesize extensionNamespaceUri = _extensionNamespaceUri;
-@synthesize extensionValue = _extensionValue;
-@synthesize extensionAttributes = _extensionAttributes;
-@synthesize extensionChildren = _extensionChildren;
#pragma mark -
#pragma mark Initializers
@@ -52,8 +45,7 @@
- (id)initWithElementName:(NSString *)elementName namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributes parentDelegate:(id<NSXMLParserDelegate, CMISAtomPubExtensionElementParserDelegate>)parentDelegate parser:(NSXMLParser *)parser
{
self = [super init];
- if (self)
- {
+ if (self) {
self.extensionName = elementName;
self.extensionNamespaceUri = namespaceUri;
self.extensionAttributes = attributes;
@@ -80,8 +72,7 @@
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
- if (nil == self.extensionValue)
- {
+ if (nil == self.extensionValue) {
self.extensionValue = [[NSMutableString alloc] init];
}
[self.extensionValue appendString:string];
@@ -89,18 +80,14 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([elementName isEqualToString:self.extensionName] && [namespaceURI isEqualToString:self.extensionNamespaceUri])
- {
+ if ([elementName isEqualToString:self.extensionName] && [namespaceURI isEqualToString:self.extensionNamespaceUri]) {
CMISExtensionElement *extElement = nil;
- if ([self.extensionChildren count] > 0)
- {
+ if ([self.extensionChildren count] > 0) {
extElement = [[CMISExtensionElement alloc] initNodeWithName:self.extensionName
namespaceUri:self.extensionNamespaceUri
attributes:self.extensionAttributes
children:self.extensionChildren];
- }
- else
- {
+ } else {
extElement = [[CMISExtensionElement alloc] initLeafWithName:self.extensionName
namespaceUri:self.extensionNamespaceUri
attributes:self.extensionAttributes
@@ -119,8 +106,7 @@
- (void)extensionElementParser:(CMISAtomPubExtensionElementParser *)parser didFinishParsingExtensionElement:(CMISExtensionElement *)extensionElement
{
- if (self.extensionChildren == nil)
- {
+ if (self.extensionChildren == nil) {
self.extensionChildren = [[NSMutableArray alloc] init];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.h
index 5675144..65f93b3 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.h
@@ -24,7 +24,7 @@
@interface CMISPropertyDefinitionParser : NSObject <NSXMLParserDelegate>
-// Initializes a child parser for an Atom Entry and takes over parsing control while parsing the Atom Entry
+/// Initializes a child parser for an Atom Entry and takes over parsing control while parsing the Atom Entry
+ (id)parserForPropertyDefinition:(NSString *)propertyDefinitionElementName
withParentDelegate:(id<NSXMLParserDelegate, CMISPropertyDefinitionDelegate>)parentDelegate
parser:(NSXMLParser *)parser;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.m
index 8787740..3eab8b0 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISPropertyDefinitionParser.m
@@ -35,15 +35,11 @@
@implementation CMISPropertyDefinitionParser
-@synthesize propertyDefinition = _propertyDefinition;
-@synthesize currentString = _currentString;
-@synthesize parentDelegate = _parentDelegate;
- (id)init
{
self = [super init];
- if (self)
- {
+ if (self) {
self.propertyDefinition = [[CMISPropertyDefinition alloc] init];
}
return self;
@@ -54,36 +50,24 @@
parser:(NSXMLParser *)parser
{
self = [self init];
- if (self)
- {
+ if (self) {
self.parentDelegate = parentDelegate;
// Setting ourself, the entry parser, as the delegate, we reset back to our parent when we're done
[parser setDelegate:self];
// Select type based on element name that is passed
- if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyStringDefinition])
- {
+ if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyStringDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeString;
- }
- else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyIdDefinition])
- {
+ } else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyIdDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeId;
- }
- else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyBooleanDefinition])
- {
+ } else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyBooleanDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeBoolean;
- }
- else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyDateTimeDefinition])
- {
+ } else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyDateTimeDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeDateTime;
- }
- else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyIntegerDefinition])
- {
+ } else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyIntegerDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeInteger;
- }
- else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyDecimalDefinition])
- {
+ } else if ([propertyDefinitionElementName isEqualToString:kCMISCorePropertyDecimalDefinition]) {
self.propertyDefinition.propertyType = CMISPropertyTypeDecimal;
}
}
@@ -104,11 +88,9 @@
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
NSString *cleanedString = [string stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
- if (!self.currentString)
- {
+ if (!self.currentString) {
self.currentString = cleanedString;
- }
- else {
+ } else {
self.currentString = [self.currentString stringByAppendingString:cleanedString];
}
}
@@ -120,12 +102,9 @@
|| [elementName isEqualToString:kCMISCorePropertyBooleanDefinition]
|| [elementName isEqualToString:kCMISCorePropertyIntegerDefinition]
|| [elementName isEqualToString:kCMISCorePropertyDateTimeDefinition]
- || [elementName isEqualToString:kCMISCorePropertyDecimalDefinition])
- {
- if (self.parentDelegate)
- {
- if ([self.parentDelegate respondsToSelector:@selector(propertyDefinitionParser:didFinishParsingPropertyDefinition:)])
- {
+ || [elementName isEqualToString:kCMISCorePropertyDecimalDefinition]) {
+ if (self.parentDelegate) {
+ if ([self.parentDelegate respondsToSelector:@selector(propertyDefinitionParser:didFinishParsingPropertyDefinition:)]) {
[self.parentDelegate performSelector:@selector(propertyDefinitionParser:didFinishParsingPropertyDefinition:) withObject:self withObject:self.propertyDefinition];
}
@@ -133,88 +112,48 @@
parser.delegate = self.parentDelegate;
self.parentDelegate = nil;
}
- }
- else if ([elementName isEqualToString:kCMISCoreId])
- {
+ } else if ([elementName isEqualToString:kCMISCoreId]) {
self.propertyDefinition.id = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreLocalName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreLocalName]) {
self.propertyDefinition.localName = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreLocalNamespace])
- {
+ } else if ([elementName isEqualToString:kCMISCoreLocalNamespace]) {
self.propertyDefinition.localNamespace = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreDisplayName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreDisplayName]) {
self.propertyDefinition.displayName = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreQueryName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreQueryName]) {
self.propertyDefinition.queryName = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreDescription])
- {
+ } else if ([elementName isEqualToString:kCMISCoreDescription]) {
self.propertyDefinition.description = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreCardinality])
- {
- if ([self.currentString isEqualToString:@"multi"])
- {
+ } else if ([elementName isEqualToString:kCMISCoreCardinality]) {
+ if ([self.currentString isEqualToString:@"multi"]) {
self.propertyDefinition.cardinality = CMISCardinalityMulti;
- }
- else if ([self.currentString isEqualToString:@"single"])
- {
+ } else if ([self.currentString isEqualToString:@"single"]) {
self.propertyDefinition.cardinality = CMISCardinalitySingle;
- }
- else
- {
+ } else {
log(@"Invalid value for property definition cardinality : '%@'", self.currentString);
}
- }
- else if ([elementName isEqualToString:kCMISCoreUpdatability])
- {
- if ([self.currentString.lowercaseString isEqualToString:@"readonly"])
- {
+ } else if ([elementName isEqualToString:kCMISCoreUpdatability]) {
+ if ([self.currentString.lowercaseString isEqualToString:@"readonly"]) {
self.propertyDefinition.updatability = CMISUpdatabilityReadOnly;
- }
- else if ([self.currentString.lowercaseString isEqualToString:@"readwrite"])
- {
+ } else if ([self.currentString.lowercaseString isEqualToString:@"readwrite"]) {
self.propertyDefinition.updatability = CMISUpdatabilityReadWrite;
- }
- else if ([self.currentString.lowercaseString isEqualToString:@"whencheckedout"])
- {
+ } else if ([self.currentString.lowercaseString isEqualToString:@"whencheckedout"]) {
self.propertyDefinition.updatability = CMISUpdatabilityWhenCheckedOut;
- }
- else if ([self.currentString.lowercaseString isEqualToString:@"oncreate"])
- {
+ } else if ([self.currentString.lowercaseString isEqualToString:@"oncreate"]) {
self.propertyDefinition.updatability = CMISUpdatabilityOnCreate;
- }
- else
- {
+ } else {
log(@"Invalid value for property definition updatability : '%@'", self.currentString);
}
- }
- else if ([elementName isEqualToString:kCMISCoreInherited])
- {
+ } else if ([elementName isEqualToString:kCMISCoreInherited]) {
self.propertyDefinition.inherited = [self parseBooleanValue:self.currentString];
- }
- else if ([elementName isEqualToString:kCMISCoreRequired])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRequired]) {
self.propertyDefinition.required = [self parseBooleanValue:self.currentString];
- }
- else if ([elementName isEqualToString:kCMISCoreQueryable])
- {
+ } else if ([elementName isEqualToString:kCMISCoreQueryable]) {
self.propertyDefinition.queryable = [self parseBooleanValue:self.currentString];
- }
- else if ([elementName isEqualToString:kCMISCoreOrderable])
- {
+ } else if ([elementName isEqualToString:kCMISCoreOrderable]) {
self.propertyDefinition.orderable = [self parseBooleanValue:self.currentString];
- }
- else if ([elementName isEqualToString:kCMISCoreOpenChoice])
- {
+ } else if ([elementName isEqualToString:kCMISCoreOpenChoice]) {
self.propertyDefinition.openChoice = [self parseBooleanValue:self.currentString];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.h
index 2a7fd0f..931743a 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.h
@@ -25,6 +25,7 @@
@protocol CMISRepositoryInfoParserDelegate <NSObject>
@required
+/// parses repository info delegate method
- (void)repositoryInfoParser:(CMISRepositoryInfoParser *)epositoryInfoParser didFinishParsingRepositoryInfo:(CMISRepositoryInfo *)repositoryInfo;
@end
@@ -33,7 +34,9 @@
@property (nonatomic, strong, readonly) CMISRepositoryInfo *currentRepositoryInfo;
+/// designated initialiser
- (id)initRepositoryInfoParserWithParentDelegate:(id<NSXMLParserDelegate, CMISRepositoryInfoParserDelegate>)parentDelegate parser:(NSXMLParser *)parser;
+/// parses repository info
+ (id)repositoryInfoParserWithParentDelegate:(id<NSXMLParserDelegate, CMISRepositoryInfoParserDelegate>)parentDelegate parser:(NSXMLParser *)parser;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.m
index 225e7cf..b6319ae 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISRepositoryInfoParser.m
@@ -37,19 +37,12 @@
@implementation CMISRepositoryInfoParser
-@synthesize currentRepositoryInfo = _currentRepositoryInfo;
-@synthesize parentDelegate = _parentDelegate;
-@synthesize currentString = _currentString;
-@synthesize currentCollection = _currentCollection;
-@synthesize currentCapabilities = _currentCapabilities;
-@synthesize parsingExtensionElement = _parsingExtensionElement;
- (id)initRepositoryInfoParserWithParentDelegate:(id<NSXMLParserDelegate, CMISRepositoryInfoParserDelegate>)parentDelegate parser:(NSXMLParser *)parser
{
self = [super init];
- if (self)
- {
+ if (self) {
self.currentString = [[NSMutableString alloc] init];
self.currentRepositoryInfo = [[CMISRepositoryInfo alloc] init];
self.parentDelegate = parentDelegate;
@@ -75,16 +68,12 @@
{
self.currentString = [[NSMutableString alloc] init];
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
- if ([elementName isEqualToString:kCMISCoreCapabilities])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
+ if ([elementName isEqualToString:kCMISCoreCapabilities]) {
self.currentCapabilities = [NSMutableDictionary dictionaryWithCapacity:14];
}
- }
- else if ( ![namespaceURI isEqualToString:kCMISNamespaceCmis] && ![namespaceURI isEqualToString:kCMISNamespaceApp]
- && ![namespaceURI isEqualToString:kCMISNamespaceAtom] && ![namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom])
- {
+ } else if ( ![namespaceURI isEqualToString:kCMISNamespaceCmis] && ![namespaceURI isEqualToString:kCMISNamespaceApp]
+ && ![namespaceURI isEqualToString:kCMISNamespaceAtom] && ![namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom]) {
self.parsingExtensionElement = YES;
self.childParserDelegate = [CMISAtomPubExtensionElementParser extensionElementParserWithElementName:elementName namespaceUri:namespaceURI attributes:attributeDict parentDelegate:self parser:parser];
}
@@ -103,59 +92,35 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([namespaceURI isEqualToString:kCMISNamespaceCmis])
- {
- if ([elementName isEqualToString:kCMISCoreRepositoryId])
- {
+ if ([namespaceURI isEqualToString:kCMISNamespaceCmis]) {
+ if ([elementName isEqualToString:kCMISCoreRepositoryId]) {
self.currentRepositoryInfo.identifier = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreRepositoryName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRepositoryName]) {
self.currentRepositoryInfo.name = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreRepositoryDescription])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRepositoryDescription]) {
self.currentRepositoryInfo.desc = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreVendorName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreVendorName]) {
self.currentRepositoryInfo.vendorName = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreProductName])
- {
+ } else if ([elementName isEqualToString:kCMISCoreProductName]) {
self.currentRepositoryInfo.productName = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreProductVersion])
- {
+ } else if ([elementName isEqualToString:kCMISCoreProductVersion]) {
self.currentRepositoryInfo.productVersion = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreRootFolderId])
- {
+ } else if ([elementName isEqualToString:kCMISCoreRootFolderId]) {
self.currentRepositoryInfo.rootFolderId = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISCoreCmisVersionSupported])
- {
+ } else if ([elementName isEqualToString:kCMISCoreCmisVersionSupported]) {
self.currentRepositoryInfo.cmisVersionSupported = self.currentString;
- }
- else if ([elementName hasPrefix:_kCMISCoreCapabilityPrefix] && self.currentCapabilities)
- {
+ } else if ([elementName hasPrefix:_kCMISCoreCapabilityPrefix] && self.currentCapabilities) {
[self.currentCapabilities setValue:self.currentString forKeyPath:elementName];
- }
- else if ([elementName isEqualToString:kCMISCoreCapabilities])
- {
+ } else if ([elementName isEqualToString:kCMISCoreCapabilities]) {
self.currentRepositoryInfo.repositoryCapabilities = self.currentCapabilities;
self.currentCapabilities = nil;
- }
- else if ([elementName isEqualToString:kCMISCoreAclCapability] || [elementName isEqualToString:kCMISCorePermission]
+ } else if ([elementName isEqualToString:kCMISCoreAclCapability] || [elementName isEqualToString:kCMISCorePermission]
|| [elementName isEqualToString:kCMISCorePermissions]|| [elementName isEqualToString:kCMISCoreMapping]
|| [elementName isEqualToString:kCMISCoreKey]|| [elementName isEqualToString:kCMISCoreSupportedPermissions]
- || [elementName isEqualToString:kCMISCorePropagation] || [elementName isEqualToString:kCMISCoreDescription])
- {
+ || [elementName isEqualToString:kCMISCorePropagation] || [elementName isEqualToString:kCMISCoreDescription]) {
// TODO Handle ACL Capability tree
- }
- else
- {
+ } else {
/*
TODO Parse these into the repoItem object
kCMISCoreSupportedPermissions;
@@ -169,11 +134,8 @@
//log(@"TODO Cmis-Core Element was ignored: ElementName=%@, Value=%@",elementName, self.currentString);
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom])
- {
- if ([elementName isEqualToString:kCMISRestAtomRepositoryInfo] && self.parentDelegate)
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceCmisRestAtom]) {
+ if ([elementName isEqualToString:kCMISRestAtomRepositoryInfo] && self.parentDelegate) {
// Finished parsing Properties & its ExtensionData
[self saveCurrentExtensionsAndPushPreviousExtensionData];
@@ -182,13 +144,9 @@
parser.delegate = self.parentDelegate;
self.parentDelegate = nil;
}
- }
- else if ([namespaceURI isEqualToString:kCMISNamespaceApp] || [namespaceURI isEqualToString:kCMISNamespaceAtom])
- {
+ } else if ([namespaceURI isEqualToString:kCMISNamespaceApp] || [namespaceURI isEqualToString:kCMISNamespaceAtom]) {
log(@"WARNING: We should not get here");
- }
- else if (self.isParsingExtensionElement)
- {
+ } else if (self.isParsingExtensionElement) {
self.parsingExtensionElement = NO;
}
@@ -200,8 +158,7 @@
- (void)extensionElementParser:(CMISAtomPubExtensionElementParser *)parser didFinishParsingExtensionElement:(CMISExtensionElement *)extensionElement
{
- if (self.currentExtensions == nil)
- {
+ if (self.currentExtensions == nil) {
self.currentExtensions = [[NSMutableArray alloc] init];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.h
index ea3c50f..c1d403b 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.h
@@ -22,10 +22,12 @@
@interface CMISServiceDocumentParser : NSObject <NSXMLParserDelegate, CMISRepositoryInfoParserDelegate>
-// Available after parsing the service document
+/// Available after parsing the service document
@property (nonatomic, strong, readonly) NSArray *workspaces;
- (id)initWithData:(NSData*)atomData;
+
+/// parses the service document. returns NO if unsuccessful
- (BOOL)parseAndReturnError:(NSError **)error;
@end
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m
index c3f7653..e3cc61c 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISServiceDocumentParser.m
@@ -43,24 +43,11 @@
@implementation CMISServiceDocumentParser
-@synthesize atomData = _atomData;
-@synthesize internalWorkspaces = _internalWorkspaces;
-
-@synthesize currentString = _currentString;
-@synthesize currentWorkSpace = _currentWorkSpace;
-@synthesize currentCollection = _currentCollection;
-@synthesize currentAtomLinks = _currentAtomLinks;
-@synthesize currentTemplate = _currentTemplate;
-@synthesize currentType = _currentType;
-@synthesize currentMediaType = _currentMediaType;
-@synthesize childParserDelegate = _childParserDelegate;
-
- (id)initWithData:(NSData*)atomData
{
self = [super init];
- if (self)
- {
+ if (self) {
self.atomData = atomData;
}
@@ -78,8 +65,7 @@
[parser setDelegate:self];
BOOL parseSuccessful = [parser parse];
- if (!parseSuccessful)
- {
+ if (!parseSuccessful) {
NSError *parserError = [parser parserError];
log(@"Parsing error : %@", parserError);
if (error) {
@@ -101,23 +87,15 @@
{
self.currentString = [[NSMutableString alloc] init];
- if ([elementName isEqualToString:kCMISAppWorkspace])
- {
+ if ([elementName isEqualToString:kCMISAppWorkspace]) {
self.currentWorkSpace = [[CMISWorkspace alloc] init];
- }
- else if ([elementName isEqualToString:kCMISRestAtomRepositoryInfo])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomRepositoryInfo]) {
self.childParserDelegate = [CMISRepositoryInfoParser repositoryInfoParserWithParentDelegate:self parser:parser];
- }
- else if ([elementName isEqualToString:kCMISAppCollection])
- {
+ } else if ([elementName isEqualToString:kCMISAppCollection]) {
self.currentCollection = [[CMISAtomCollection alloc] init];
self.currentCollection.href = [attributeDict objectForKey:kCMISAtomLinkAttrHref];
- }
- else if ([elementName isEqualToString:kCMISAtomLink])
- {
- if (self.currentAtomLinks == nil)
- {
+ } else if ([elementName isEqualToString:kCMISAtomLink]) {
+ if (self.currentAtomLinks == nil) {
self.currentAtomLinks = [[NSMutableSet alloc] init];
}
@@ -141,63 +119,38 @@
{
// TODO: parser needs refactoring!
- if ([elementName isEqualToString:kCMISAppWorkspace])
- {
+ if ([elementName isEqualToString:kCMISAppWorkspace]) {
self.currentWorkSpace.linkRelations = [[CMISLinkRelations alloc] initWithLinkRelationSet:[self.currentAtomLinks copy]];
self.currentAtomLinks = nil;
[self.internalWorkspaces addObject:self.currentWorkSpace];
- }
- else if ([elementName isEqualToString:kCMISRestAtomUritemplate])
- {
- if ([self.currentType isEqualToString:kCMISUriTemplateObjectById])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomUritemplate]) {
+ if ([self.currentType isEqualToString:kCMISUriTemplateObjectById]) {
self.currentWorkSpace.objectByIdUriTemplate = self.currentTemplate;
- }
- else if ([self.currentType isEqualToString:kCMISUriTemplateObjectByPath])
- {
+ } else if ([self.currentType isEqualToString:kCMISUriTemplateObjectByPath]) {
self.currentWorkSpace.objectByPathUriTemplate = self.currentTemplate;
- }
- else if ([self.currentType isEqualToString:kCMISUriTemplateTypeById])
- {
+ } else if ([self.currentType isEqualToString:kCMISUriTemplateTypeById]) {
self.currentWorkSpace.typeByIdUriTemplate = self.currentTemplate;
- }
- else if ([self.currentType isEqualToString:kCMISUriTemplateQuery])
- {
+ } else if ([self.currentType isEqualToString:kCMISUriTemplateQuery]) {
self.currentWorkSpace.queryUriTemplate = self.currentTemplate;
}
- }
- else if ([elementName isEqualToString:kCMISRestAtomTemplate])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomTemplate]) {
self.currentTemplate = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISRestAtomType])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomType]) {
self.currentType = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISRestAtomMediaType])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomMediaType]) {
self.currentMediaType = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISAppCollection])
- {
- if (self.currentWorkSpace.collections == nil)
- {
+ } else if ([elementName isEqualToString:kCMISAppCollection]) {
+ if (self.currentWorkSpace.collections == nil) {
self.currentWorkSpace.collections = [[NSMutableArray alloc] init];
}
[self.currentWorkSpace.collections addObject:self.currentCollection];
self.currentCollection = nil;
- }
- else if ([elementName isEqualToString:kCMISAtomTitle])
- {
+ } else if ([elementName isEqualToString:kCMISAtomTitle]) {
self.currentCollection.title = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISAppAccept])
- {
+ } else if ([elementName isEqualToString:kCMISAppAccept]) {
self.currentCollection.accept = self.currentString;
- }
- else if ([elementName isEqualToString:kCMISRestAtomCollectionType])
- {
+ } else if ([elementName isEqualToString:kCMISRestAtomCollectionType]) {
self.currentCollection.type = self.currentString;
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.h
index b0d7224..3a5fd6a 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.h
@@ -31,6 +31,7 @@
@property (nonatomic, strong, readonly) CMISTypeDefinition *typeDefinition;
- (id)initWithData:(NSData *)atomData;
+/// parses the type definition. returns NO if unsuccessful
- (BOOL)parseAndReturnError:(NSError **)error;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m
index b8da061..6ea74fd 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISTypeDefinitionAtomEntryParser.m
@@ -36,17 +36,11 @@
@implementation CMISTypeDefinitionAtomEntryParser
-@synthesize typeDefinition = _typeDefinition;
-@synthesize isParsingTypeDefinition = _isParsingTypeDefinition;
-@synthesize atomData = _atomData;
-@synthesize currentString = _currentString;
-@synthesize childParserDelegate = _childParserDelegate;
- (id)initWithData:(NSData *)atomData
{
self = [self init];
- if (self)
- {
+ if (self) {
self.atomData = atomData;
}
@@ -64,10 +58,8 @@
parseSuccessful = [parser parse];
- if (!parseSuccessful)
- {
- if (error)
- {
+ if (!parseSuccessful) {
+ if (error) {
*error = [parser parserError];
}
}
@@ -77,18 +69,15 @@
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
- if ([elementName isEqualToString:kCMISRestAtomType])
- {
+ if ([elementName isEqualToString:kCMISRestAtomType]) {
self.typeDefinition = [[CMISTypeDefinition alloc] init];
self.isParsingTypeDefinition = YES;
- }
- else if ([elementName isEqualToString:kCMISCorePropertyStringDefinition]
+ } else if ([elementName isEqualToString:kCMISCorePropertyStringDefinition]
|| [elementName isEqualToString:kCMISCorePropertyIdDefinition]
|| [elementName isEqualToString:kCMISCorePropertyBooleanDefinition]
|| [elementName isEqualToString:kCMISCorePropertyIntegerDefinition]
|| [elementName isEqualToString:kCMISCorePropertyDateTimeDefinition]
- || [elementName isEqualToString:kCMISCorePropertyDecimalDefinition])
- {
+ || [elementName isEqualToString:kCMISCorePropertyDecimalDefinition]) {
self.childParserDelegate = [CMISPropertyDefinitionParser parserForPropertyDefinition:elementName withParentDelegate:self parser:parser];
}
}
@@ -97,123 +86,75 @@
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
NSString *cleanedString = [string stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
- if (!self.currentString)
- {
+ if (!self.currentString) {
self.currentString = cleanedString;
- }
- else {
+ } else {
self.currentString = [self.currentString stringByAppendingString:cleanedString];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
- if ([elementName isEqualToString:kCMISRestAtomType])
- {
+ if ([elementName isEqualToString:kCMISRestAtomType]) {
self.isParsingTypeDefinition = NO;
- }
- else if ([elementName isEqualToString:kCMISCoreId])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreId]) {
+ if (self.isParsingTypeDefinition){
self.typeDefinition.id = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreLocalName])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreLocalName]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.localName = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreLocalNamespace])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreLocalNamespace]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.localNameSpace = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreDisplayName])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreDisplayName]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.displayName = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreQueryName])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreQueryName]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.queryName = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreDescription])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreDescription]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.description = self.currentString;
}
- }
- else if ([elementName isEqualToString:kCMISCoreBaseId])
- {
- if (self.isParsingTypeDefinition)
- {
- if ([self.currentString isEqualToString:kCMISPropertyObjectTypeIdValueDocument])
- {
+ } else if ([elementName isEqualToString:kCMISCoreBaseId]) {
+ if (self.isParsingTypeDefinition) {
+ if ([self.currentString isEqualToString:kCMISPropertyObjectTypeIdValueDocument]) {
self.typeDefinition.baseTypeId = CMISBaseTypeDocument;
- }
- else if ([self.currentString isEqualToString:kCMISPropertyObjectTypeIdValueFolder])
- {
+ } else if ([self.currentString isEqualToString:kCMISPropertyObjectTypeIdValueFolder]) {
self.typeDefinition.baseTypeId = CMISBaseTypeFolder;
}
}
- }
- else if ([elementName isEqualToString:kCMISCoreCreatable])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreCreatable]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.creatable = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreFileable])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreFileable]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.fileable = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreQueryable])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreQueryable]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.queryable = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreFullTextIndexed])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreFullTextIndexed]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.fullTextIndexed = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreIncludedInSupertypeQuery])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreIncludedInSupertypeQuery]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.includedInSupertypeQuery = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreControllableACL])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreControllableACL]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.controllableAcl = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
- }
- else if ([elementName isEqualToString:kCMISCoreControllablePolicy])
- {
- if (self.isParsingTypeDefinition)
- {
+ } else if ([elementName isEqualToString:kCMISCoreControllablePolicy]) {
+ if (self.isParsingTypeDefinition) {
self.typeDefinition.controllablePolicy = [self.currentString.lowercaseString isEqualToString:kCMISAtomEntryValueTrue];
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h
index 36ca19f..d4249a8 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService+Protected.h
@@ -32,7 +32,9 @@
/** Convenience method with all the defaults for the retrieval parameters */
- (void)retrieveObjectInternal:(NSString *)objectId completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock;
-/** Full-blown object retrieval version */
+/** Full-blown object retrieval version
+ * completionBlock returns CMISObjectData instance or nil if unsuccessul
+ */
- (void)retrieveObjectInternal:(NSString *)objectId
withReturnVersion:(CMISReturnVersion)cmisReturnVersion
withFilter:(NSString *)filter
@@ -43,6 +45,9 @@
andIncludeAllowableActions:(BOOL)includeAllowableActions
completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock;
+/** retrieve object for a given path name
+ * completionBlock returns CMISObjectData instance or nil if unsuccessul
+ */
- (void)retrieveObjectByPathInternal:(NSString *)path
withFilter:(NSString *)filter
andIncludeRelationShips:(CMISIncludeRelationship)includeRelationship
@@ -52,13 +57,20 @@
andIncludeAllowableActions:(BOOL)includeAllowableActions
completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock;
+/** retrieve object from cache
+ * completionBlock returns the object (as id) or nil if unsuccessul
+ */
- (void)retrieveFromCache:(NSString *)cacheKey
completionBlock:(void (^)(id object, NSError *error))completionBlock;
+///load the link for a given object Id
+///completionBlock returns the link as NSString or nil if unsuccessful
- (void)loadLinkForObjectId:(NSString *)objectId
andRelation:(NSString *)rel
completionBlock:(void (^)(NSString *link, NSError *error))completionBlock;
+///load the link for a given object Id
+///completionBlock returns the link as NSString or nil if unsuccessful
- (void)loadLinkForObjectId:(NSString *)objectId
andRelation:(NSString *)rel
andType:(NSString *)type
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m
index 09033a4..eb0e112 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBaseService.m
@@ -38,14 +38,11 @@
@implementation CMISAtomPubBaseService
-@synthesize bindingSession = _bindingSession;
-@synthesize atomPubUrl = _atomPubUrl;
- (id)initWithBindingSession:(CMISBindingSession *)session
{
self = [super init];
- if (self)
- {
+ if (self) {
self.bindingSession = session;
self.atomPubUrl = [session objectForKey:kCMISBindingSessionKeyAtomPubUrl];
}
@@ -250,8 +247,7 @@
- (CMISLinkCache *)linkCache{
CMISLinkCache *linkCache = [self.bindingSession objectForKey:kCMISBindingSessionKeyLinkCache];
- if (linkCache == nil)
- {
+ if (linkCache == nil) {
linkCache = [[CMISLinkCache alloc] initWithBindingSession:self.bindingSession];
[self.bindingSession setObject:linkCache forKey:kCMISBindingSessionKeyLinkCache];
}
@@ -261,8 +257,7 @@
- (void)clearCacheFromService
{
CMISLinkCache *linkCache = [self.bindingSession objectForKey:kCMISBindingSessionKeyLinkCache];
- if (linkCache != nil)
- {
+ if (linkCache != nil) {
[linkCache removeAllLinks];
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m
index 4601f63..6783930 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m
@@ -42,22 +42,10 @@
@implementation CMISAtomPubBinding
-@synthesize session = _session;
-@synthesize aclService = _aclService;
-@synthesize discoveryService = _discoveryService;
-@synthesize multiFilingService = _multiFilingService;
-@synthesize objectService = _objectService;
-@synthesize policyService = _policyService;
-@synthesize relationshipService = _relationshipService;
-@synthesize repositoryService = _repositoryService;
-@synthesize navigationService = _navigationService;
-@synthesize versioningService = _versioningService;
-
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters
{
self = [super init];
- if (self)
- {
+ if (self) {
self.session = [[CMISBindingSession alloc] initWithSessionParameters:sessionParameters];
self.repositoryService = [[CMISAtomPubRepositoryService alloc] initWithBindingSession:self.session];
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m
index 3276897..df78582 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m
@@ -37,8 +37,7 @@
completionBlock:(void (^)(CMISObjectList *objectList, NSError *error))completionBlock;
{
// Validate params
- if (statement == nil)
- {
+ if (statement == nil) {
log(@"Must provide 'statement' parameter when executing a cmis query");
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:nil]);
return;
@@ -46,8 +45,7 @@
// Validate query uri
NSString *queryUrlString = [self.bindingSession objectForKey:kCMISBindingSessionKeyQueryCollection];
- if (queryUrlString == nil)
- {
+ if (queryUrlString == nil) {
log(@"Unknown repository or query not supported!");
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeObjectNotFound withDetailedDescription:nil]);
return;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubNavigationService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubNavigationService.m
index 1c6a210..26da4b5 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubNavigationService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubNavigationService.m
@@ -38,8 +38,7 @@
// Get Down link
[self loadLinkForObjectId:objectId andRelation:kCMISLinkRelationDown
andType:kCMISMediaTypeChildren completionBlock:^(NSString *downLink, NSError *error) {
- if (error)
- {
+ if (error) {
log(@"Could not retrieve down link: %@", error.description);
completionBlock(nil, error);
return;
@@ -69,8 +68,7 @@
// Parse the feed (containing entries for the children) you get back
CMISAtomFeedParser *parser = [[CMISAtomFeedParser alloc] initWithData:httpResponse.data];
NSError *internalError = nil;
- if ([parser parseAndReturnError:&internalError])
- {
+ if ([parser parseAndReturnError:&internalError]) {
NSString *nextLink = [parser.linkRelations linkHrefForRel:kCMISLinkRelationNext];
CMISObjectList *objectList = [[CMISObjectList alloc] init];
@@ -78,9 +76,7 @@
objectList.numItems = parser.numItems;
objectList.objects = parser.entries;
completionBlock(objectList, nil);
- }
- else
- {
+ } else {
NSError *error = [CMISErrors cmisError:internalError withCMISErrorCode:kCMISErrorCodeRuntime];
completionBlock(nil, error);
}
@@ -108,15 +104,13 @@
}
// Add optional parameters
- if (filter != nil)
- {
+ if (filter != nil) {
upLink = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterFilter withValue:filter toUrlString:upLink];
}
upLink = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterIncludeAllowableActions withValue:(includeAllowableActions ? @"true" : @"false") toUrlString:upLink];
upLink = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterIncludeRelationships withValue:[CMISEnums stringForIncludeRelationShip:includeRelationship] toUrlString:upLink];
- if (renditionFilter != nil)
- {
+ if (renditionFilter != nil) {
upLink = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterRenditionFilter withValue:renditionFilter toUrlString:upLink];
}
@@ -128,8 +122,7 @@
if (httpResponse) {
CMISAtomFeedParser *parser = [[CMISAtomFeedParser alloc] initWithData:httpResponse.data];
NSError *internalError;
- if (![parser parseAndReturnError:&internalError])
- {
+ if (![parser parseAndReturnError:&internalError]) {
NSError *error = [CMISErrors cmisError:internalError withCMISErrorCode:kCMISErrorCodeRuntime];
log(@"Failing because parsing the Atom Feed XML returns an error");
completionBlock([NSArray array], error);
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
index bfbf41b..7475e24 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
@@ -143,8 +143,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
{
// Validate object id param
- if (objectIdParam == nil || objectIdParam.inParameter == nil)
- {
+ if (objectIdParam == nil || objectIdParam.inParameter == nil) {
log(@"Object id is nil or inParameter of objectId is nil");
completionBlock([[NSError alloc] init]); // TODO: properly init error (CmisInvalidArgumentException)
return;
@@ -222,8 +221,7 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
{
// Validate object id param
- if (objectIdParam == nil || objectIdParam.inParameter == nil)
- {
+ if (objectIdParam == nil || objectIdParam.inParameter == nil) {
log(@"Object id is nil or inParameter of objectId is nil");
if (completionBlock) {
completionBlock([CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Must provide object id"]);
@@ -337,8 +335,7 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
{
// Validate properties
- if ([properties propertyValueForId:kCMISPropertyName] == nil || [properties propertyValueForId:kCMISPropertyObjectTypeId] == nil)
- {
+ if ([properties propertyValueForId:kCMISPropertyName] == nil || [properties propertyValueForId:kCMISPropertyObjectTypeId] == nil) {
log(@"Must provide %@ and %@ as properties", kCMISPropertyName, kCMISPropertyObjectTypeId);
if (completionBlock) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:nil]);
@@ -347,8 +344,7 @@
}
// Validate mimetype
- if (inputStream && !mimeType)
- {
+ if (inputStream && !mimeType) {
log(@"Must provide a mimetype when creating a cmis document");
if (completionBlock) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:nil]);
@@ -404,16 +400,14 @@
- (void)createFolderInParentFolder:(NSString *)folderObjectId withProperties:(CMISProperties *)properties completionBlock:(void (^)(NSString *, NSError *))completionBlock
{
- if ([properties propertyValueForId:kCMISPropertyName] == nil || [properties propertyValueForId:kCMISPropertyObjectTypeId] == nil)
- {
+ if ([properties propertyValueForId:kCMISPropertyName] == nil || [properties propertyValueForId:kCMISPropertyObjectTypeId] == nil) {
log(@"Must provide %@ and %@ as properties", kCMISPropertyName, kCMISPropertyObjectTypeId);
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:nil]);
return;
}
// Validate parent folder id
- if (!folderObjectId)
- {
+ if (!folderObjectId) {
log(@"Must provide a parent folder object id when creating a new folder");
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeObjectNotFound withDetailedDescription:nil]);
return;
@@ -443,8 +437,7 @@
completionBlock:(void (^)(NSArray *failedObjects, NSError *error))completionBlock
{
// Validate params
- if (!folderObjectId)
- {
+ if (!folderObjectId) {
log(@"Must provide a folder object id when deleting a folder tree");
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeObjectNotFound withDetailedDescription:nil]);
return;
@@ -498,8 +491,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
{
// Validate params
- if (objectIdParam == nil || objectIdParam.inParameter == nil)
- {
+ if (objectIdParam == nil || objectIdParam.inParameter == nil) {
log(@"Object id is nil or inParameter of objectId is nil");
completionBlock([[NSError alloc] init]); // TODO: properly init error (CmisInvalidArgumentException)
return;
@@ -507,16 +499,14 @@
// Get self link
[self loadLinkForObjectId:objectIdParam.inParameter andRelation:kCMISLinkRelationSelf completionBlock:^(NSString *selfLink, NSError *error) {
- if (selfLink == nil)
- {
+ if (selfLink == nil) {
log(@"Could not retrieve %@ link", kCMISLinkRelationSelf);
completionBlock([CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeConnection]);
return;
}
// Append optional params
- if (changeTokenParam != nil && changeTokenParam.inParameter != nil)
- {
+ if (changeTokenParam != nil && changeTokenParam.inParameter != nil) {
selfLink = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterChangeToken
withValue:changeTokenParam.inParameter toUrlString:selfLink];
}
@@ -541,12 +531,10 @@
// Object id and changeToken might have changed because of this operation
CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:httpResponse.data];
NSError *error = nil;
- if ([atomEntryParser parseAndReturnError:&error])
- {
+ if ([atomEntryParser parseAndReturnError:&error]) {
objectIdParam.outParameter = [[atomEntryParser.objectData.properties propertyForId:kCMISPropertyObjectId] firstValue];
- if (changeTokenParam != nil)
- {
+ if (changeTokenParam != nil) {
changeTokenParam.outParameter = [[atomEntryParser.objectData.properties propertyForId:kCMISPropertyChangeToken] firstValue];
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubRepositoryService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubRepositoryService.m
index 6d18b31..8a04f72 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubRepositoryService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubRepositoryService.m
@@ -36,7 +36,6 @@
@implementation CMISAtomPubRepositoryService
-@synthesize repositories = _repositories;
- (void)retrieveRepositoriesWithCompletionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock
{
@@ -64,10 +63,8 @@
{
self.repositories = [NSMutableDictionary dictionary];
[self retrieveCMISWorkspacesWithCompletionBlock:^(NSArray *cmisWorkSpaces, NSError *error) {
- if (cmisWorkSpaces != nil)
- {
- for (CMISWorkspace *workspace in cmisWorkSpaces)
- {
+ if (cmisWorkSpaces != nil) {
+ for (CMISWorkspace *workspace in cmisWorkSpaces) {
[self.repositories setObject:workspace.repositoryInfo forKey:workspace.repositoryInfo.identifier];
}
}
@@ -77,8 +74,7 @@
- (void)retrieveTypeDefinition:(NSString *)typeId completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock
{
- if (typeId == nil)
- {
+ if (typeId == nil) {
log(@"Parameter typeId is required");
NSError *error = [[NSError alloc] init]; // TODO: proper error init
completionBlock(nil, error);
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
index 56b92d8..28ec850 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubVersioningService.m
@@ -52,8 +52,7 @@
completionBlock:(void (^)(NSArray *objects, NSError *error))completionBlock
{
// Validate params
- if (!objectId)
- {
+ if (!objectId) {
log(@"Must provide an objectId when retrieving all versions");
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeObjectNotFound withDetailedDescription:nil]);
return;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
index 9db2f77..528843c 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
@@ -41,7 +41,13 @@
@property (nonatomic, strong) NSString *renditionFilter;
@property CMISReturnVersion returnVersion;
+/**
+ * initialise with the template URL string
+ */
- (id)initWithTemplateUrl:(NSString *)templateUrl;
+/**
+ * returns the URL
+ */
- (NSURL *)buildUrl;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
index 1823a4a..c6ab251 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.m
@@ -27,21 +27,11 @@
@implementation CMISObjectByIdUriBuilder
-@synthesize templateUrl = _templateUrl;
-@synthesize objectId = _objectId;
-@synthesize filter = _filter;
-@synthesize includeAllowableActions = _includeAllowableActions;
-@synthesize includePolicyIds = _includePolicyIds;
-@synthesize includeRelationships = _includeRelationships;
-@synthesize includeACL = _includeACL;
-@synthesize renditionFilter = _renditionFilter;
-@synthesize returnVersion = _returnVersion;
- (id)initWithTemplateUrl:(NSString *)templateUrl
{
self = [super init];
- if (self)
- {
+ if (self) {
self.templateUrl = templateUrl;
// Defaults
@@ -66,19 +56,13 @@
urlString = [urlString stringByReplacingOccurrencesOfString:@"{includeACL}" withString:(self.includeACL ? @"true" : @"false")];
urlString = [urlString stringByReplacingOccurrencesOfString:@"{renditionFilter}" withString:(self.renditionFilter != nil ? self.renditionFilter : @"")];
- if (self.returnVersion != NOT_PROVIDED)
- {
+ if (self.returnVersion != NOT_PROVIDED) {
NSString *returnVersionParam = nil;
- if (self.returnVersion == THIS)
- {
+ if (self.returnVersion == THIS) {
returnVersionParam = @"this";
- }
- else if (self.returnVersion == LATEST)
- {
+ } else if (self.returnVersion == LATEST) {
returnVersionParam = @"latest";
- }
- else
- {
+ } else {
returnVersionParam = @"latestmajor";
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.h b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.h
index 415ab07..4ca5f7a 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.h
@@ -31,7 +31,13 @@
@property BOOL includeACL;
@property (nonatomic, strong) NSString *renditionFilter;
+/**
+ * init the template URL with URL string
+ */
- (id)initWithTemplateUrl:(NSString *)templateUrl;
+/**
+ * return the full URL
+ */
- (NSURL *)buildUrl;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
index 6bbe8ec..fc48801 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByPathUriBuilder.m
@@ -28,20 +28,11 @@
@implementation CMISObjectByPathUriBuilder
-@synthesize templateUrl = _templateUrl;
-@synthesize path = _path;
-@synthesize filter = _filter;
-@synthesize includeAllowableActions = _includeAllowableActions;
-@synthesize includePolicyIds = _includePolicyIds;
-@synthesize includeRelationships = _includeRelationships;
-@synthesize includeACL = _includeACL;
-@synthesize renditionFilter = _renditionFilter;
- (id)initWithTemplateUrl:(NSString *)templateUrl
{
self = [super init];
- if (self)
- {
+ if (self) {
self.templateUrl = templateUrl;
}
return self;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.h b/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.h
index 63ed173..a4e6e80 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.h
@@ -31,6 +31,9 @@
@property (nonatomic, strong) NSNumber * skipCount;
@property (nonatomic, strong) NSNumber * maxItems;
+/**
+ @return the XML query as string
+ */
- (NSString *)generateAtomEntryXML;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.m b/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.m
index 9df7eea..314ca00 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISQueryAtomEntryWriter.m
@@ -22,20 +22,12 @@
@implementation CMISQueryAtomEntryWriter
-@synthesize statement = _statement;
-@synthesize searchAllVersions = _searchAllVersions;
-@synthesize includeRelationships = _includeRelationships;
-@synthesize renditionFilter = _renditionFilter;
-@synthesize includeAllowableActions = _includeAllowableActions;
-@synthesize skipCount = _skipCount;
-@synthesize maxItems = _maxItems;
- (id)init
{
self = [super init];
- if (self)
- {
+ if (self) {
self.includeRelationships = CMISIncludeRelationshipNone;
}
return self;
@@ -59,13 +51,11 @@
[xml appendFormat:@"<cmis:includeRelationships>%@</cmis:includeRelationships>", [CMISEnums stringForIncludeRelationShip:self.includeRelationships]];
[xml appendFormat:@"<cmis:renditionFilter>%@</cmis:renditionFilter>", self.renditionFilter != nil ? self.renditionFilter : @"*"];
- if (self.maxItems != nil)
- {
+ if (self.maxItems != nil) {
[xml appendFormat:@"<cmis:maxItems>%d</cmis:maxItems>", self.maxItems.intValue];
}
- if (self.skipCount != nil)
- {
+ if (self.skipCount != nil) {
[xml appendFormat:@"<cmis:skipCount>%d</cmis:skipCount>", self.skipCount.intValue];
}
[xml appendString:@"</cmis:query>"];
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.h b/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.h
index d177b9c..0c1ccb2 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.h
@@ -24,7 +24,13 @@
@property (nonatomic, strong) NSString *id;
+/**
+ * init the template URL with URL string
+ */
- (id)initWithTemplateUrl:(NSString *)templateUrl;
+/**
+ * @return the ready to use Url
+ */
- (NSURL *)buildUrl;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.m b/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.m
index b60f198..2f9f492 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISTypeByIdUriBuilder.m
@@ -28,14 +28,11 @@
@implementation CMISTypeByIdUriBuilder
-@synthesize id = _id;
-@synthesize templateUrl = _templateUrl;
- (id)initWithTemplateUrl:(NSString *)templateUrl
{
self = [super init];
- if (self)
- {
+ if (self) {
self.templateUrl = templateUrl;
}
return self;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomCollection.m b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomCollection.m
index 49920de..fdd5f54 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomCollection.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomCollection.m
@@ -22,9 +22,5 @@
@implementation CMISAtomCollection
-@synthesize href = _href;
-@synthesize title = _title;
-@synthesize accept = _accept;
-@synthesize type = _type;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomLink.m b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomLink.m
index 139b367..99612a4 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomLink.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISAtomLink.m
@@ -21,15 +21,11 @@
@implementation CMISAtomLink
-@synthesize rel = _rel;
-@synthesize type = _type;
-@synthesize href = _href;
- (id)initWithRelation:(NSString *)rel type:(NSString *)type href:(NSString *)href
{
self = [super init];
- if (self)
- {
+ if (self) {
self.rel = rel;
self.type = type;
self.href = href;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISLinkRelations.m b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISLinkRelations.m
index 4ed094d..710e37a 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISLinkRelations.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISLinkRelations.m
@@ -25,13 +25,11 @@
@implementation CMISLinkRelations
-@synthesize linkRelationSet = _linkRelationSet;
- (id)initWithLinkRelationSet:(NSSet *)linkRelationSet
{
self = [super init];
- if (self)
- {
+ if (self) {
self.linkRelationSet = linkRelationSet;
}
return self;
@@ -47,20 +45,16 @@
NSArray *predicateArgsArray = nil;
NSString *predicateFormat = @"(rel == %@)";
- if (type != nil && type.length > 0)
- {
+ if (type != nil && type.length > 0) {
predicateFormat = [predicateFormat stringByAppendingString:@"&& (type == %@)"];
predicateArgsArray = [NSArray arrayWithObjects:rel, type, nil];
- }
- else
- {
+ } else {
predicateArgsArray = [NSArray arrayWithObject:rel];
}
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFormat argumentArray:predicateArgsArray];
NSSet *filteredSet = [self.linkRelationSet filteredSetUsingPredicate:predicate];
- if ([filteredSet count] == 1)
- {
+ if ([filteredSet count] == 1) {
return [filteredSet.anyObject valueForKey:@"href"];
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
index f28d92f..a5a4260 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
@@ -24,25 +24,12 @@
@implementation CMISWorkspace
-@synthesize sessionParameters = _sessionParameters;
-@synthesize repositoryInfo = _repositoryInfo;
-
-@synthesize collections = _collections;
-@synthesize linkRelations = _linkRelations;
-
-@synthesize objectByIdUriTemplate = _objectByIdUriTemplate;
-@synthesize queryUriTemplate = _queryUriTemplate;
-@synthesize typeByIdUriTemplate = _typeByIdUriTemplate;
-@synthesize objectByPathUriTemplate = _objectByPathUriTemplate;
- (NSString *)collectionHrefForCollectionType:(NSString *)collectionType
{
- if (self.collections != nil)
- {
- for (CMISAtomCollection *collection in self.collections)
- {
- if ([collection.type isEqualToString:collectionType])
- {
+ if (self.collections != nil) {
+ for (CMISAtomCollection *collection in self.collections) {
+ if ([collection.type isEqualToString:collectionType]) {
return collection.href;
}
}
diff --git a/ObjectiveCMIS/Bindings/CMISBinding.h b/ObjectiveCMIS/Bindings/CMISBinding.h
index d36dff4..44a9ff6 100644
--- a/ObjectiveCMIS/Bindings/CMISBinding.h
+++ b/ObjectiveCMIS/Bindings/CMISBinding.h
@@ -57,13 +57,22 @@
// The versioning service object for the binding
@property (nonatomic, strong, readonly) id<CMISVersioningService> versioningService;
-
+/**
+ closes the session
+ */
- (void)close;
@optional
+/**
+ clears the cache from the session
+ */
- (void)clearAllCaches;
+/**
+ clears the repository cache from the session
+ @param repositoryId
+ */
- (void)clearCacheForRepositoryId:(NSString*)repositoryId;
@end
diff --git a/ObjectiveCMIS/Bindings/CMISBindingFactory.h b/ObjectiveCMIS/Bindings/CMISBindingFactory.h
index 89cff42..fbe2759 100644
--- a/ObjectiveCMIS/Bindings/CMISBindingFactory.h
+++ b/ObjectiveCMIS/Bindings/CMISBindingFactory.h
@@ -22,7 +22,7 @@
@interface CMISBindingFactory : NSObject
-// Returns an instance of a CMISBinding using the given session parameters
+/// Returns an instance of a CMISBinding using the given session parameters
- (id<CMISBinding>)bindingWithParameters:(CMISSessionParameters *)sessionParameters;
@end
diff --git a/ObjectiveCMIS/Bindings/CMISBindingFactory.m b/ObjectiveCMIS/Bindings/CMISBindingFactory.m
index de2c9a3..bab5760 100644
--- a/ObjectiveCMIS/Bindings/CMISBindingFactory.m
+++ b/ObjectiveCMIS/Bindings/CMISBindingFactory.m
@@ -29,8 +29,7 @@
// TODO: Allow for the creation of custom binding implementations using NSClassFromString.
id<CMISBinding> binding = nil;
- if (sessionParameters.bindingType == CMISBindingTypeAtomPub)
- {
+ if (sessionParameters.bindingType == CMISBindingTypeAtomPub) {
binding = [[CMISAtomPubBinding alloc] initWithSessionParameters:sessionParameters];
}
diff --git a/ObjectiveCMIS/Bindings/CMISBindingSession.h b/ObjectiveCMIS/Bindings/CMISBindingSession.h
index 25f7250..3039f32 100644
--- a/ObjectiveCMIS/Bindings/CMISBindingSession.h
+++ b/ObjectiveCMIS/Bindings/CMISBindingSession.h
@@ -41,7 +41,7 @@
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters;
-// Object storage methods
+/// @name Object storage methods
- (NSArray *)allKeys;
- (id)objectForKey:(id)key;
- (id)objectForKey:(id)key withDefaultValue:(id)defaultValue;
diff --git a/ObjectiveCMIS/Bindings/CMISBindingSession.m b/ObjectiveCMIS/Bindings/CMISBindingSession.m
index eb756cd..5f12bac 100644
--- a/ObjectiveCMIS/Bindings/CMISBindingSession.m
+++ b/ObjectiveCMIS/Bindings/CMISBindingSession.m
@@ -39,17 +39,11 @@
@implementation CMISBindingSession
-@synthesize username = _username;
-@synthesize repositoryId = _repositoryId;
-@synthesize authenticationProvider = _authenticationProvider;
-@synthesize sessionData = _sessionData;
-@synthesize networkProvider = _networkProvider;
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters
{
self = [super init];
- if (self)
- {
+ if (self) {
self.sessionData = [[NSMutableDictionary alloc] init];
// grab common data from session parameters
@@ -61,8 +55,7 @@
// store all other data in the dictionary
[self.sessionData setObject:sessionParameters.atomPubUrl forKey:kCMISBindingSessionKeyAtomPubUrl];
- for (id key in sessionParameters.allKeys)
- {
+ for (id key in sessionParameters.allKeys) {
[self.sessionData setObject:[sessionParameters objectForKey:key] forKey:key];
}
}
diff --git a/ObjectiveCMIS/Bindings/CMISDiscoveryService.h b/ObjectiveCMIS/Bindings/CMISDiscoveryService.h
index 2fbe09f..53eafd2 100644
--- a/ObjectiveCMIS/Bindings/CMISDiscoveryService.h
+++ b/ObjectiveCMIS/Bindings/CMISDiscoveryService.h
@@ -30,7 +30,9 @@
(optional) Integer skipCount: This is the number of potential results that the repository MUST skip/page over
before returning any results. Defaults to 0.
*/
-// TODO: add all params which are required by spec
+/** launches a query on the server with the parameters specified
+ * completionBlock returns the found object list or nil if unsuccessful
+ */
- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersions
includeRelationShips:(CMISIncludeRelationship)includeRelationships
renditionFilter:(NSString *)renditionFilter
diff --git a/ObjectiveCMIS/Bindings/CMISLinkCache.h b/ObjectiveCMIS/Bindings/CMISLinkCache.h
index 032d475..1707d2c 100644
--- a/ObjectiveCMIS/Bindings/CMISLinkCache.h
+++ b/ObjectiveCMIS/Bindings/CMISLinkCache.h
@@ -25,16 +25,24 @@
@interface CMISLinkCache : NSObject
+/// initialise with CMISBindingSession instance
- (id)initWithBindingSession:(CMISBindingSession *)bindingSession;
+/// retrieves the link for a given object Id/relationship
- (NSString *)linkForObjectId:(NSString *)objectId andRelation:(NSString *)rel;
+/// retrieves the link for a given objectId, relationship and type
- (NSString *)linkForObjectId:(NSString *)objectId andRelation:(NSString *)rel andType:(NSString *)type;
+/// adds a link for object Id
- (void)addLinks:(CMISLinkRelations *)links forObjectId:(NSString *)objectId;
+/// removes link for object Id
- (void)removeLinksForObjectId:(NSString *)objectId;
+/**
+ * removes all links
+ */
- (void)removeAllLinks;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/CMISLinkCache.m b/ObjectiveCMIS/Bindings/CMISLinkCache.m
index f02fdf2..9555420 100644
--- a/ObjectiveCMIS/Bindings/CMISLinkCache.m
+++ b/ObjectiveCMIS/Bindings/CMISLinkCache.m
@@ -35,13 +35,11 @@
@implementation CMISLinkCache
-@synthesize linkCache = _linkCache;
- (id)initWithBindingSession:(CMISBindingSession *)bindingSession
{
self = [super init];
- if (self)
- {
+ if (self) {
[self setupLinkCache:bindingSession];
}
@@ -53,20 +51,15 @@
self.linkCache = [[NSCache alloc] init];
id linkCacheSize = [bindingSession objectForKey:kCMISSessionParameterLinkCacheSize];
- if (linkCacheSize != nil)
- {
- if ([[linkCacheSize class] isEqual:[NSNumber class]])
- {
+ if (linkCacheSize != nil) {
+ if ([[linkCacheSize class] isEqual:[NSNumber class]]) {
self.linkCache.countLimit = [(NSNumber *) linkCacheSize unsignedIntValue];
- }
- else
- {
+ } else {
log(@"Invalid object set for %@ session parameter. Ignoring and using default instead", kCMISSessionParameterLinkCacheSize);
}
}
- if (self.linkCache.countLimit <= 0)
- {
+ if (self.linkCache.countLimit <= 0) {
self.linkCache.countLimit = DEFAULT_LINK_CACHE_SIZE;
}
diff --git a/ObjectiveCMIS/Bindings/CMISNavigationService.h b/ObjectiveCMIS/Bindings/CMISNavigationService.h
index f1e4d52..1b47802 100644
--- a/ObjectiveCMIS/Bindings/CMISNavigationService.h
+++ b/ObjectiveCMIS/Bindings/CMISNavigationService.h
@@ -25,8 +25,9 @@
@protocol CMISNavigationService <NSObject>
-/*
+/**
* Retrieves the children for the given object identifier.
+ * completionBlock returns object list or nil if unsuccessful
*/
- (void)retrieveChildren:(NSString *)objectId orderBy:(NSString *)orderBy
filter:(NSString *)filter includeRelationShips:(CMISIncludeRelationship)includeRelationship
@@ -36,11 +37,12 @@
completionBlock:(void (^)(CMISObjectList *objectList, NSError *error))completionBlock;
/**
-* Retrieves the parent of a given object.
-* Returns a list of CMISObjectData objects
-*
-* TODO: OpenCMIS returns an ObjectParentData object .... is this necessary?
-*/
+ * Retrieves the parent of a given object.
+ * Returns a list of CMISObjectData objects
+ *
+ * TODO: OpenCMIS returns an ObjectParentData object .... is this necessary?
+ * completionBlock returns array of parents or nil if unsuccessful
+ */
- (void)retrieveParentsForObject:(NSString *)objectId
withFilter:(NSString *)filter
withIncludeRelationships:(CMISIncludeRelationship)includeRelationship
diff --git a/ObjectiveCMIS/Bindings/CMISObjectList.m b/ObjectiveCMIS/Bindings/CMISObjectList.m
index a8a362f..20468ad 100644
--- a/ObjectiveCMIS/Bindings/CMISObjectList.m
+++ b/ObjectiveCMIS/Bindings/CMISObjectList.m
@@ -22,15 +22,11 @@
@implementation CMISObjectList
-@synthesize objects = _objects;
-@synthesize hasMoreItems = _hasMoreItems;
-@synthesize numItems = _numItems;
- (id)init
{
self = [super init];
- if (self)
- {
+ if (self) {
self.objects = [NSArray array];
self.numItems = 0;
self.hasMoreItems = NO;
diff --git a/ObjectiveCMIS/Bindings/CMISObjectService.h b/ObjectiveCMIS/Bindings/CMISObjectService.h
index e6865b1..3e8d341 100644
--- a/ObjectiveCMIS/Bindings/CMISObjectService.h
+++ b/ObjectiveCMIS/Bindings/CMISObjectService.h
@@ -27,8 +27,8 @@
@protocol CMISObjectService <NSObject>
/**
- *Retrieves the object with the given object identifier.
- *
+ * Retrieves the object with the given object identifier.
+ * completionBlock returns objectData for object or nil if unsuccessful
*/
- (void)retrieveObject:(NSString *)objectId
withFilter:(NSString *)filter
@@ -40,8 +40,8 @@
completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock;
/**
- *Retrieves an object using its path.
- *
+ * Retrieves an object using its path.
+ * completionBlock returns objectData for object or nil if unsuccessful
*/
- (void)retrieveObjectByPath:(NSString *)path
withFilter:(NSString *)filter
@@ -53,10 +53,11 @@
completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock;
/**
-* Gets the content stream for the specified Document object, or gets a rendition stream for a specified
-* rendition of a document or folder object. Downloads the content to a local file.
-*
-*/
+ * Gets the content stream for the specified Document object, or gets a rendition stream for a specified
+ * rendition of a document or folder object. Downloads the content to a local file.
+ * completionBlock returns objectData for object or nil if unsuccessful
+ *
+ */
- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
withStreamId:(NSString *)streamId
toFile:(NSString *)filePath
@@ -66,6 +67,7 @@
/**
* Gets the content stream for the specified Document object, or gets a rendition stream for a specified
* rendition of a document or folder object. Downloads the content to an output stream.
+ * completionBlock returns objectData for object or nil if unsuccessful
*
*/
- (CMISRequest*)downloadContentOfObject:(NSString *)objectId
@@ -76,12 +78,13 @@
/**
* Deletes the content stream for the specified document object.
- *
- * A Repository MAY automatically create new Document versions as part of this service method.
- * Therefore, the objectId output NEED NOT be identical to the objectId input
- *
- * NOTE for atom pub binding: deleteContentStream: This does not return the new object id and change token as specified by the domain model.
- * This is not possible without introducing a new HTTP header.
+ *
+ * A Repository MAY automatically create new Document versions as part of this service method.
+ * Therefore, the objectId output NEED NOT be identical to the objectId input
+ *
+ * NOTE for atom pub binding: deleteContentStream: This does not return the new object id and change token as specified by the domain model.
+ * This is not possible without introducing a new HTTP header.
+ * completionBlock - returns NSError nil if successful
*/
- (void)deleteContentOfObject:(CMISStringInOutParameter *)objectIdParam
withChangeToken:(CMISStringInOutParameter *)changeTokenParam
@@ -96,6 +99,7 @@
*
* NOTE for atom pub binding: This does not return the new object id and change token as specified by the domain model.
* (This is not possible without introducing a new HTTP header).
+ * completionBlock - returns NSError nil if successful
*/
- (CMISRequest*)changeContentOfObject:(CMISStringInOutParameter *)objectIdParam
toContentOfFile:(NSString *)filePath
@@ -113,6 +117,7 @@
*
* NOTE for atom pub binding: This does not return the new object id and change token as specified by the domain model.
* (This is not possible without introducing a new HTTP header).
+ * completionBlock - returns NSError nil if successful
*/
- (CMISRequest*)changeContentOfObject:(CMISStringInOutParameter *)objectId
toContentOfInputStream:(NSInputStream *)inputStream
@@ -124,8 +129,9 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
/**
-* uploads the file from the given path to the given folder.
-*
+ * uploads the file from the given path to the given folder.
+ *
+ * completionBlock - returns NSError nil if successful
*/
- (CMISRequest*)createDocumentFromFilePath:(NSString *)filePath
withMimeType:(NSString *)mimeType
@@ -137,6 +143,7 @@
/**
* uploads the file from the given input stream to the given folder.
*
+ * completionBlock - returns NSError nil if successful
*/
- (CMISRequest*)createDocumentFromInputStream:(NSInputStream *)inputStream
withMimeType:(NSString *)mimeType
@@ -147,15 +154,17 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
/**
-* Deletes the given object.
-*
-* The allVersions parameter is currently ignored.
-*/
+ * Deletes the given object.
+ *
+ * The allVersions parameter is currently ignored.
+ * completionBlock returns true if successful
+ */
- (void)deleteObject:(NSString *)objectId allVersions:(BOOL)allVersions completionBlock:(void (^)(BOOL objectDeleted, NSError *error))completionBlock;
/**
-* Creates a new folder with given properties under the provided parent folder.
-*/
+ * Creates a new folder with given properties under the provided parent folder.
+ * completionBlock returns objectId for the newly created folder or nil if unsuccessful
+ */
- (void)createFolderInParentFolder:(NSString *)folderObjectId
withProperties:(CMISProperties *)properties
completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
@@ -164,6 +173,7 @@
* Deletes the given folder and all of its subfolder and files
*
* Returns a list of objects which failed to be deleted.
+ * completionBlock returns array of failed objects if any. NSError will be nil if successful
*
*/
- (void)deleteTree:(NSString *)folderObjectId
@@ -174,6 +184,7 @@
/**
* Updates the properties of the given object.
+ * completionBlock returns NSError nil if successful
*/
- (void)updatePropertiesForObject:(CMISStringInOutParameter *)objectIdParam
withProperties:(CMISProperties *)properties
@@ -186,6 +197,7 @@
*
* Note: the paging parameters (maxItems and skipCount) are not used in the atom pub binding.
* Ie. the whole set is <b>always</b> returned.
+ * completionBlock returns array of associated renditions or nil if unsuccessful
*/
- (void)retrieveRenditions:(NSString *)objectId
withRenditionFilter:(NSString *)renditionFilter
diff --git a/ObjectiveCMIS/Bindings/CMISPropertyDefinition.m b/ObjectiveCMIS/Bindings/CMISPropertyDefinition.m
index 81f2977..607c259 100644
--- a/ObjectiveCMIS/Bindings/CMISPropertyDefinition.m
+++ b/ObjectiveCMIS/Bindings/CMISPropertyDefinition.m
@@ -22,21 +22,4 @@
@implementation CMISPropertyDefinition
-@synthesize id = _id;
-@synthesize localName = _localName;
-@synthesize localNamespace = _localNamespace;
-@synthesize displayName = _displayName;
-@synthesize queryName = _queryName;
-@synthesize description = _description;
-@synthesize propertyType = _propertyType;
-@synthesize cardinality = _cardinality;
-@synthesize updatability = _updatability;
-@synthesize inherited = _inherited;
-@synthesize required = _required;
-@synthesize queryable = _queryable;
-@synthesize orderable = _orderable;
-@synthesize openChoice = _openChoice;
-@synthesize defaultValues = _defaultValues;
-@synthesize choices = _choices;
-
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/CMISQueryResult.h b/ObjectiveCMIS/Bindings/CMISQueryResult.h
index 76c7f48..39432bd 100644
--- a/ObjectiveCMIS/Bindings/CMISQueryResult.h
+++ b/ObjectiveCMIS/Bindings/CMISQueryResult.h
@@ -28,57 +28,54 @@
@interface CMISQueryResult : NSObject
-/**
-* Returns a list of all properties (objects of type CMISPropertyData) in this query result.
-*/
@property(nonatomic, strong, readonly) CMISProperties *properties;
@property(nonatomic, strong, readonly) CMISAllowableActions *allowableActions;
@property(nonatomic, strong, readonly) NSArray *renditions; // Array of CMISRenditions
/**
-* Initializes this query result.
-*/
+ * Initializes this query result.
+ */
- (id)initWithCmisObjectData:(CMISObjectData *)cmisObjectData andWithSession:(CMISSession *)session;
/**
-* Convience method for the initializer.
-*/
+ * Convience method for the initializer.
+ */
+ (CMISQueryResult *)queryResultUsingCmisObjectData:(CMISObjectData *)cmisObjectData andWithSession:(CMISSession *)session;
/**
-* Returns a property by id.
-* <p>
-* Since repositories are not obligated to add property ids to their query
-* result properties, this method might not always work as expected with
-* some repositories. Use {@link #getPropertyByQueryName(String)} instead.
-*/
+ * Returns a property by id.
+ * <p>
+ * Since repositories are not obligated to add property ids to their query
+ * result properties, this method might not always work as expected with
+ * some repositories. Use {@link #getPropertyByQueryName(String)} instead.
+ */
- (CMISPropertyData *)propertyForId:(NSString *)id;
/**
-* Returns a property by query name or alias.
-*/
-- (CMISPropertyData *)properyForQueryName:(NSString *)queryName;
+ * Returns a property by query name or alias.
+ */
+- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName;
/**
-* Returns a property (single) value by id.
-*/
-- (id)properyValueForId:(NSString *)propertyId;
+ * Returns a property (single) value by id.
+ */
+- (id)propertyValueForId:(NSString *)propertyId;
/**
-* Returns a property (single) value by query name or alias.
-*
-* @see #getPropertyByQueryName(String)
-*/
+ * Returns a property (single) value by query name or alias.
+ *
+ * @see #getPropertyByQueryName(String)
+ */
- (id)propertyValueForQueryName:(NSString *)queryName;
/**
-* Returns a property multi-value by id.
-*/
+ * Returns a property multi-value by id.
+ */
- (NSArray *)propertyMultiValueById:(NSString *)id;
/**
-* Returns a property multi-value by query name or alias.
-*/
+ * Returns a property multi-value by query name or alias.
+ */
- (NSArray *)propertyMultiValueByQueryName:(NSString *)queryName;
// TODO: implement following methods found in openCMIS
diff --git a/ObjectiveCMIS/Bindings/CMISQueryResult.m b/ObjectiveCMIS/Bindings/CMISQueryResult.m
index 806e7bc..969fd2e 100644
--- a/ObjectiveCMIS/Bindings/CMISQueryResult.m
+++ b/ObjectiveCMIS/Bindings/CMISQueryResult.m
@@ -35,24 +35,18 @@
@implementation CMISQueryResult
-@synthesize properties = _properties;
-@synthesize allowableActions = _allowableActions;
-@synthesize renditions = _renditions;
- (id)initWithCmisObjectData:(CMISObjectData *)cmisObjectData andWithSession:(CMISSession *)session
{
self = [super init];
- if (self)
- {
+ if (self) {
self.properties = cmisObjectData.properties;
self.allowableActions = cmisObjectData.allowableActions;
- if (cmisObjectData.renditions != nil)
- {
+ if (cmisObjectData.renditions != nil) {
NSMutableArray *renditions = [NSMutableArray array];
- for (CMISRenditionData *renditionData in cmisObjectData.renditions)
- {
+ for (CMISRenditionData *renditionData in cmisObjectData.renditions) {
[renditions addObject:[[CMISRendition alloc] initWithRenditionData:renditionData andObjectId:cmisObjectData.identifier andSession:session]];
}
self.renditions = renditions;
@@ -72,12 +66,12 @@
return [self.properties propertyForId:id];
}
-- (CMISPropertyData *)properyForQueryName:(NSString *)queryName
+- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName
{
return [self.properties propertyForQueryName:queryName];
}
-- (id)properyValueForId:(NSString *)propertyId
+- (id)propertyValueForId:(NSString *)propertyId
{
return [self.properties propertyValueForId:propertyId];
}
diff --git a/ObjectiveCMIS/Bindings/CMISRenditionData.h b/ObjectiveCMIS/Bindings/CMISRenditionData.h
index addec5f..4d5f7fc 100644
--- a/ObjectiveCMIS/Bindings/CMISRenditionData.h
+++ b/ObjectiveCMIS/Bindings/CMISRenditionData.h
@@ -44,11 +44,11 @@
@property (nonatomic, strong) NSNumber *width;
/**
-* If specified, then the rendition can also be accessed as a document object in the CMIS services.
-* If not set, then the rendition can only be accessed via the rendition services. Referential integrity of this ID is repository-specific.
-*
-* TODO: needs to be changed to more generic 'ObjectId'
-*/
+ * If specified, then the rendition can also be accessed as a document object in the CMIS services.
+ * If not set, then the rendition can only be accessed via the rendition services. Referential integrity of this ID is repository-specific.
+ *
+ * TODO: needs to be changed to more generic 'ObjectId'
+ */
@property (nonatomic, strong) NSString *renditionDocumentId;
- (id)initWithRenditionData:(CMISRenditionData *)renditionData;
diff --git a/ObjectiveCMIS/Bindings/CMISRenditionData.m b/ObjectiveCMIS/Bindings/CMISRenditionData.m
index 9ebf4df..c24bbd8 100644
--- a/ObjectiveCMIS/Bindings/CMISRenditionData.m
+++ b/ObjectiveCMIS/Bindings/CMISRenditionData.m
@@ -22,20 +22,11 @@
@implementation CMISRenditionData
-@synthesize streamId = _streamId;
-@synthesize mimeType = _mimeType;
-@synthesize title = _title;
-@synthesize kind = _kind;
-@synthesize length = _length;
-@synthesize height = _height;
-@synthesize width = _width;
-@synthesize renditionDocumentId = _renditionDocumentId;
- (id)initWithRenditionData:(CMISRenditionData *)renditionData
{
self = [super init];
- if (self)
- {
+ if (self) {
self.streamId = renditionData.streamId;
self.mimeType = renditionData.mimeType;
self.title = renditionData.title;
diff --git a/ObjectiveCMIS/Bindings/CMISRepositoryService.h b/ObjectiveCMIS/Bindings/CMISRepositoryService.h
index 40029a1..f20d89a 100644
--- a/ObjectiveCMIS/Bindings/CMISRepositoryService.h
+++ b/ObjectiveCMIS/Bindings/CMISRepositoryService.h
@@ -25,15 +25,21 @@
@protocol CMISRepositoryService <NSObject>
/**
-* Returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
-*/
+ * Returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
+ * completionBlock returns array of repositories or nil if unsuccessful
+ */
- (void)retrieveRepositoriesWithCompletionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
/**
-* Returns the repository info for the repository with the given id
-*/
+ * Returns the repository info for the repository with the given id
+ * completionBlock returns repository or nil if unsuccessful
+ */
- (void)retrieveRepositoryInfoForId:(NSString *)repositoryId completionBlock:(void (^)(CMISRepositoryInfo *repositoryInfo, NSError *error))completionBlock;
+/**
+ * Returns the type definitions
+ * completionBlock returns type definition or nil if unsuccessful
+ */
- (void)retrieveTypeDefinition:(NSString *)typeId completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;
@end
diff --git a/ObjectiveCMIS/Bindings/CMISTypeDefinition.h b/ObjectiveCMIS/Bindings/CMISTypeDefinition.h
index 66086d9..3f526c5 100644
--- a/ObjectiveCMIS/Bindings/CMISTypeDefinition.h
+++ b/ObjectiveCMIS/Bindings/CMISTypeDefinition.h
@@ -41,10 +41,14 @@
@property (nonatomic, assign, getter = isControllablePolicy) BOOL controllablePolicy;
@property (nonatomic, assign, getter = isControllableAcl) BOOL controllableAcl;
-// Mapping of property id <-> CMISPropertyDefinition
+/// Mapping of property id <-> CMISPropertyDefinition
@property (nonatomic, strong, readonly) NSDictionary *propertyDefinitions;
+/// add property definition
- (void)addPropertyDefinition:(CMISPropertyDefinition *)propertyDefinition;
+
+
+/// retrieve property definition for given property Id
- (CMISPropertyDefinition *)propertyDefinitionForId:(NSString *)propertyId;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Bindings/CMISTypeDefinition.m b/ObjectiveCMIS/Bindings/CMISTypeDefinition.m
index 0973de2..8fe5c1a 100644
--- a/ObjectiveCMIS/Bindings/CMISTypeDefinition.m
+++ b/ObjectiveCMIS/Bindings/CMISTypeDefinition.m
@@ -29,23 +29,6 @@
@implementation CMISTypeDefinition
-@synthesize id = _id;
-@synthesize localName = _localName;
-@synthesize localNameSpace = _localNameSpace;
-@synthesize displayName = _displayName;
-@synthesize queryName = _queryName;
-@synthesize description = _description;
-@synthesize baseTypeId = _baseTypeId;
-@synthesize creatable = _creatable;
-@synthesize fileable = _fileable;
-@synthesize queryable = _queryable;
-@synthesize fullTextIndexed = _fullTextIndexed;
-@synthesize includedInSupertypeQuery = _includedInSupertypeQuery;
-@synthesize controllablePolicy = _controllablePolicy;
-@synthesize controllableAcl = _controllableAcl;
-@synthesize propertyDefinitions = _propertyDefinitions;
-@synthesize internalPropertyDefinitions = _internalPropertyDefinitions;
-
- (NSDictionary *)propertyDefinitions
{
return self.internalPropertyDefinitions;
@@ -53,8 +36,7 @@
- (void)addPropertyDefinition:(CMISPropertyDefinition *)propertyDefinition
{
- if (self.internalPropertyDefinitions == nil)
- {
+ if (self.internalPropertyDefinitions == nil) {
self.internalPropertyDefinitions = [[NSMutableDictionary alloc] init];
}
[self.internalPropertyDefinitions setObject:propertyDefinition forKey:propertyDefinition.id];
diff --git a/ObjectiveCMIS/Bindings/CMISVersioningService.h b/ObjectiveCMIS/Bindings/CMISVersioningService.h
index 7bea68e..a1f4fb8 100644
--- a/ObjectiveCMIS/Bindings/CMISVersioningService.h
+++ b/ObjectiveCMIS/Bindings/CMISVersioningService.h
@@ -28,6 +28,15 @@
/**
* Get a the latest Document object in the Version Series.
+ * @param objectId
+ * @param major
+ * @param filter
+ * @param includeRelationships
+ * @param includePolicyIds
+ * @param renditionFilter
+ * @param includeACL
+ * @param includeAllowableActions
+ * @param completionBlock returns object data if found or nil otherwise
*/
- (void)retrieveObjectOfLatestVersion:(NSString *)objectId
major:(BOOL)major
@@ -41,6 +50,10 @@
/*
* Returns the list of all Document Object in the given version series, sorted by creationDate descending (ie youngest first)
+ * @param objectId
+ * @param filter
+ * @param includeAllowableActions
+ * @param completionBlock returns array of all versioned objects or nil otherwise
*/
- (void)retrieveAllVersions:(NSString *)objectId
filter:(NSString *)filter
diff --git a/ObjectiveCMIS/Client/CMISCollection.h b/ObjectiveCMIS/Client/CMISCollection.h
index b8b3965..2cbcd3e 100644
--- a/ObjectiveCMIS/Client/CMISCollection.h
+++ b/ObjectiveCMIS/Client/CMISCollection.h
@@ -18,6 +18,9 @@
@property (nonatomic, strong, readonly)NSArray *items;
+/*
+ initialises CMISCollection with an array
+ */
- (id)initWithItems:(NSArray *)items;
@end
diff --git a/ObjectiveCMIS/Client/CMISCollection.m b/ObjectiveCMIS/Client/CMISCollection.m
index 6a91918..eb98fd1 100644
--- a/ObjectiveCMIS/Client/CMISCollection.m
+++ b/ObjectiveCMIS/Client/CMISCollection.m
@@ -25,12 +25,9 @@
@implementation CMISCollection
-@synthesize items = _items;
-
- (id)initWithItems:(NSArray *)items
{
- if (self = [super init])
- {
+ if (self = [super init]){
self.items = items;
}
diff --git a/ObjectiveCMIS/Client/CMISDocument.h b/ObjectiveCMIS/Client/CMISDocument.h
index 1dd1f29..785c4db 100644
--- a/ObjectiveCMIS/Client/CMISDocument.h
+++ b/ObjectiveCMIS/Client/CMISDocument.h
@@ -36,31 +36,35 @@
@property (nonatomic, strong, readonly) NSString *versionSeriesId;
/**
-* Retrieves a collection of all versions of this document.
-*/
+ * Retrieves a collection of all versions of this document.
+ * The completionBlock returns collection of all documents or nil if unsuccessful
+ */
- (void)retrieveAllVersionsWithCompletionBlock:(void (^)(CMISCollection *allVersionsOfDocument, NSError *error))completionBlock;
/**
-* Retrieves a collection of all versions of this document.
-*/
+ * Retrieves a collection of all versions of this document with paging options.
+ * The completionBlock returns collection of all documents or nil if unsuccessful
+ */
- (void)retrieveAllVersionsWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISCollection *collection, NSError *error))completionBlock;
/**
-* Retrieves the lastest version of this document.
-*/
+ * Retrieves the lastest version of this document.
+ * The completionBlock returns the CMIS document or nil if unsuccessful
+ */
- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
/**
-* Retrieves the lastest version of this document.
-*/
+ * Retrieves the lastest version of this document with paging options.
+ * The completionBlock returns the CMIS document or nil if unsuccessful
+ */
- (void)retrieveObjectOfLatestVersionWithMajorVersion:(BOOL)major
withOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
/**
-* Downloads the content to a local file and returns the filepath.
-* This is a synchronous call and will not return until the file is written to the given path.
-*/
+ * Downloads the content to a local file and returns the filepath.
+ * completionBlock will return NSError nil if successful
+ */
- (CMISRequest*)downloadContentToFile:(NSString *)filePath
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
@@ -68,6 +72,7 @@
/**
* Downloads the content to an outputstream and returns the handle to the http request in order to allow cancellation.
+ * completionBlock will return NSError nil if successful
*/
- (CMISRequest*)downloadContentToOutputStream:(NSOutputStream *)outputStream
completionBlock:(void (^)(NSError *error))completionBlock
@@ -79,6 +84,7 @@
* Optional overwrite flag: If TRUE (default), then the Repository MUST replace the existing content stream for the
* object (if any) with the input contentStream. If FALSE, then the Repository MUST only set the input
* contentStream for the object if the object currently does not have a content-stream.
+ * completionBlock will return NSError nil if successful
*/
- (CMISRequest*)changeContentToContentOfFile:(NSString *)filePath
withOverwriteExisting:(BOOL)overwrite
@@ -91,6 +97,7 @@
* Optional overwrite flag: If TRUE (default), then the Repository MUST replace the existing content stream for the
* object (if any) with the input contentStream. If FALSE, then the Repository MUST only set the input
* contentStream for the object if the object currently does not have a content-stream.
+ * completionBlock will return NSError nil if successful
*/
- (CMISRequest*)changeContentToContentOfInputStream:(NSInputStream *)inputStream
bytesExpected:(unsigned long long)bytesExpected
@@ -101,12 +108,14 @@
/**
* Deletes the content of this document.
+ * completionBlock will return NSError nil if successful
*/
- (void)deleteContentWithCompletionBlock:(void (^)(NSError *error))completionBlock;
/**
-* Deletes the document from the document store.
-*/
+ * Deletes the document from the document store.
+ * completionBlock return true if successful
+ */
- (void)deleteAllVersionsWithCompletionBlock:(void (^)(BOOL documentDeleted, NSError *error))completionBlock;
@end
diff --git a/ObjectiveCMIS/Client/CMISDocument.m b/ObjectiveCMIS/Client/CMISDocument.m
index a9b2822..26a71d7 100644
--- a/ObjectiveCMIS/Client/CMISDocument.m
+++ b/ObjectiveCMIS/Client/CMISDocument.m
@@ -44,21 +44,10 @@
@implementation CMISDocument
-@synthesize contentStreamId = _contentStreamId;
-@synthesize contentStreamFileName = _contentStreamFileName;
-@synthesize contentStreamMediaType = _contentStreamMediaType;
-@synthesize contentStreamLength = _contentStreamLength;
-@synthesize versionLabel = _versionLabel;
-@synthesize latestVersion = _latestVersion;
-@synthesize majorVersion = _majorVersion;
-@synthesize versionSeriesId = _versionSeriesId;
-@synthesize latestMajorVersion = _latestMajorVersion;
-
- (id)initWithObjectData:(CMISObjectData *)objectData withSession:(CMISSession *)session
{
self = [super initWithObjectData:objectData withSession:session];
- if (self)
- {
+ if (self){
self.contentStreamId = [[objectData.properties.propertiesDictionary objectForKey:kCMISProperyContentStreamId] firstValue];
self.contentStreamMediaType = [[objectData.properties.propertiesDictionary objectForKey:kCMISPropertyContentStreamMediaType] firstValue];
self.contentStreamLength = [[[objectData.properties.propertiesDictionary objectForKey:kCMISPropertyContentStreamLength] firstValue] unsignedLongLongValue];
diff --git a/ObjectiveCMIS/Client/CMISFileableObject.h b/ObjectiveCMIS/Client/CMISFileableObject.h
index 55acabc..7f425eb 100644
--- a/ObjectiveCMIS/Client/CMISFileableObject.h
+++ b/ObjectiveCMIS/Client/CMISFileableObject.h
@@ -24,17 +24,17 @@
@interface CMISFileableObject : CMISObject
/**
-* Returns all the parents of this object as an array of CMISFolder objects.
-*
-* Will be nil for root folder and non-fileable objects.
-*/
+ * Returns all the parents of this object as an array of CMISFolder objects.
+ * CompletionBlock will return array or nil if unsuccessful
+ * CompletionBlock will return nil for root folder and non-fileable objects.
+ */
- (void)retrieveParentsWithCompletionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock;
/**
-* Returns all the parents of this object as an array of CMISFolder objects.
-*
-* Will be nil for root folder and non-fileable objects.
-*/
+ * Returns all the parents of this object as an array of CMISFolder objects with paging options
+ * CompletionBlock will return array or nil if unsuccessful
+ * CompletionBlock will return nil for root folder and non-fileable objects.
+ */
- (void)retrieveParentsWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(NSArray *parentFolders, NSError *error))completionBlock;
diff --git a/ObjectiveCMIS/Client/CMISFileableObject.m b/ObjectiveCMIS/Client/CMISFileableObject.m
index 3f63add..60d495d 100644
--- a/ObjectiveCMIS/Client/CMISFileableObject.m
+++ b/ObjectiveCMIS/Client/CMISFileableObject.m
@@ -41,8 +41,7 @@
withIncludeRelativePathSegment:operationContext.includePathSegments
completionBlock:^(NSArray *parentObjectDataArray, NSError *error) {
NSMutableArray *parentFolders = [NSMutableArray array];
- for (CMISObjectData *parentObjectData in parentObjectDataArray)
- {
+ for (CMISObjectData *parentObjectData in parentObjectDataArray){
[parentFolders addObject:[self.session.objectConverter convertObject:parentObjectData]];
}
diff --git a/ObjectiveCMIS/Client/CMISFolder.h b/ObjectiveCMIS/Client/CMISFolder.h
index b613d01..34da69c 100644
--- a/ObjectiveCMIS/Client/CMISFolder.h
+++ b/ObjectiveCMIS/Client/CMISFolder.h
@@ -32,7 +32,7 @@
/**
* Retrieves the children of this folder as a paged result.
*
- * The returned objects will be instances of CMISObject.
+ * The completionBlock will return paged results with instances of CMISObject or nil if unsuccessful.
*/
- (void)retrieveChildrenWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
@@ -43,24 +43,37 @@
/**
* Gets the parent folder object.
+ * The completionBlock will return CMISFolder object or nil if unsuccessful.
*/
- (void)retrieveFolderParentWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
/**
* Retrieves the children of this folder as a paged result using the provided operation context.
*
- * The returned objects will be instances of CMISObject.
+ * The completionBlock will return paged results with instances of CMISObject or nil if unsuccessful.
*/
- (void)retrieveChildrenWithOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+/**
+ * creates a folder with sepcified properties
+ * completionBlock returns object Id of newly created folder or nil if not successful
+ */
- (void)createFolder:(NSDictionary *)properties completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock;
+/**
+ * creates a document with sepcified properties, mime Type
+ * completionBlock returns object Id of newly created document or nil if not successful
+ */
- (void)createDocumentFromFilePath:(NSString *)filePath
withMimeType:(NSString *)mimeType
withProperties:(NSDictionary *)properties
completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+/**
+ * creates a document with sepcified properties, mime Type
+ * completionBlock returns object Id of newly created document or nil if not successful
+ */
- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
withMimeType:(NSString *)mimeType
withProperties:(NSDictionary *)properties
@@ -69,6 +82,10 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+/**
+ * creates a document with sepcified properties, mime Type
+ * completionBlock returns list of failed objects (if any)
+ */
- (void)deleteTreeWithDeleteAllVersions:(BOOL)deleteAllversions
withUnfileObjects:(CMISUnfileObject)unfileObjects
withContinueOnFailure:(BOOL)continueOnFailure
diff --git a/ObjectiveCMIS/Client/CMISFolder.m b/ObjectiveCMIS/Client/CMISFolder.m
index c5c058c..c1591c4 100644
--- a/ObjectiveCMIS/Client/CMISFolder.m
+++ b/ObjectiveCMIS/Client/CMISFolder.m
@@ -34,14 +34,11 @@
@implementation CMISFolder
-@synthesize path = _path;
-@synthesize children = _children;
- (id)initWithObjectData:(CMISObjectData *)objectData withSession:(CMISSession *)session
{
self = [super initWithObjectData:objectData withSession:session];
- if (self)
- {
+ if (self){
self.path = [[objectData.properties propertyForId:kCMISPropertyPath] firstValue];
}
return self;
@@ -163,16 +160,12 @@
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
{
[self.session.objectConverter convertProperties:properties forObjectTypeId:kCMISPropertyObjectTypeIdValueDocument completionBlock:^(CMISProperties *convertedProperties, NSError *error){
- if (nil == convertedProperties)
- {
+ if (nil == convertedProperties){
log(@"Could not convert properties: %@", error.description);
- if (completionBlock)
- {
+ if (completionBlock) {
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
}
- }
- else
- {
+ } else {
[self.binding.objectService createDocumentFromInputStream:inputStream
withMimeType:mimeType
withProperties:convertedProperties
diff --git a/ObjectiveCMIS/Client/CMISObject.h b/ObjectiveCMIS/Client/CMISObject.h
index 6d45f72..f762499 100644
--- a/ObjectiveCMIS/Client/CMISObject.h
+++ b/ObjectiveCMIS/Client/CMISObject.h
@@ -44,22 +44,19 @@
@property (nonatomic, strong, readonly) CMISProperties *properties;
+/**
+ * initialise CMISObject with data and session
+ */
- (id)initWithObjectData:(CMISObjectData *)objectData withSession:(CMISSession *)session;
/**
* Updates the properties that are provided.
- *
- * @param properties The properties to update. The key should be the property id.
- * The value can be an instance of CMISPropertyData, or a regular string.
- * If it is a string, a conversion to the CMISPropertyData will be done for you,
- * but keep in mind that this can trigger another remote call to the server to fetch the type info.
- *
- * @return the updated object (a repository might have created a new version of the object)
-*/
+ * completionBlock returns the updated CMISObject instance or nil if unsuccessful
+ */
- (void)updateProperties:(NSDictionary *)properties completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
- * Returns the extensions for the given level as an array of CMISExtensionElement
+ * Returns the extensions for the given level as an array
*/
- (NSArray *)extensionsForExtensionLevel:(CMISExtensionLevel)extensionLevel;
diff --git a/ObjectiveCMIS/Client/CMISObject.m b/ObjectiveCMIS/Client/CMISObject.m
index 0540c6e..828c7e4 100644
--- a/ObjectiveCMIS/Client/CMISObject.m
+++ b/ObjectiveCMIS/Client/CMISObject.m
@@ -52,26 +52,10 @@
@implementation CMISObject
-@synthesize session = _session;
-@synthesize binding = _binding;
-@synthesize identifier = _identifier;
-@synthesize name = _name;
-@synthesize createdBy = _createdBy;
-@synthesize creationDate = _creationDate;
-@synthesize lastModifiedBy = _lastModifiedBy;
-@synthesize lastModificationDate = _lastModificationDate;
-@synthesize objectType = _objectType;
-@synthesize changeToken = _changeToken;
-@synthesize properties = _properties;
-@synthesize allowableActions = _allowableActions;
-@synthesize renditions = _renditions;
-@synthesize extensionsDict = _extensionsDict;
-
- (id)initWithObjectData:(CMISObjectData *)objectData withSession:(CMISSession *)session
{
self = [super initWithString:objectData.identifier];
- if (self)
- {
+ if (self) {
self.session = session;
self.binding = session.binding;
@@ -93,11 +77,9 @@
[self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInt:CMISExtensionLevelAllowableActions]];
// Renditions must be converted here, because they need access to the session
- if (objectData.renditions != nil)
- {
+ if (objectData.renditions != nil) {
NSMutableArray *renditions = [NSMutableArray array];
- for (CMISRenditionData *renditionData in objectData.renditions)
- {
+ for (CMISRenditionData *renditionData in objectData.renditions) {
[renditions addObject:[[CMISRendition alloc] initWithRenditionData:renditionData andObjectId:self.identifier andSession:session]];
}
self.renditions = renditions;
@@ -115,16 +97,14 @@
- (void)updateProperties:(NSDictionary *)properties completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
{
// Validate properties param
- if (!properties || properties.count == 0)
- {
+ if (!properties || properties.count == 0) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Properties cannot be nil or empty"]);
return;
}
// Convert properties to an understandable format for the service
[self.session.objectConverter convertProperties:properties forObjectTypeId:self.objectType completionBlock:^(CMISProperties *convertedProperties, NSError *error) {
- if (convertedProperties)
- {
+ if (convertedProperties) {
CMISStringInOutParameter *objectIdInOutParam = [CMISStringInOutParameter inOutParameterUsingInParameter:self.identifier];
CMISStringInOutParameter *changeTokenInOutParam = [CMISStringInOutParameter inOutParameterUsingInParameter:self.changeToken];
[self.binding.objectService
@@ -137,15 +117,11 @@
completionBlock:^(CMISObject *object, NSError *error) {
completionBlock(object, error);
}];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
}
}];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeRuntime]);
}
}];
diff --git a/ObjectiveCMIS/Client/CMISObjectId.h b/ObjectiveCMIS/Client/CMISObjectId.h
index 02d9dd3..d36e32b 100644
--- a/ObjectiveCMIS/Client/CMISObjectId.h
+++ b/ObjectiveCMIS/Client/CMISObjectId.h
@@ -24,6 +24,8 @@
@property (nonatomic, strong, readonly) NSString *identifier;
+/**
+ */
- (id)initWithString:(NSString *)string;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Client/CMISObjectId.m b/ObjectiveCMIS/Client/CMISObjectId.m
index 7f98a58..6c6b03c 100644
--- a/ObjectiveCMIS/Client/CMISObjectId.m
+++ b/ObjectiveCMIS/Client/CMISObjectId.m
@@ -26,13 +26,11 @@
@implementation CMISObjectId
-@synthesize identifier = _identifier;
- (id)initWithString:(NSString *)string
{
self = [super init];
- if (self)
- {
+ if (self) {
self.identifier = string;
}
diff --git a/ObjectiveCMIS/Client/CMISOperationContext.h b/ObjectiveCMIS/Client/CMISOperationContext.h
index a10caf4..e5b1bf8 100644
--- a/ObjectiveCMIS/Client/CMISOperationContext.h
+++ b/ObjectiveCMIS/Client/CMISOperationContext.h
@@ -34,6 +34,11 @@
@property (nonatomic, assign) NSInteger maxItemsPerPage;
@property (nonatomic, assign) NSInteger skipCount;
+/**
+ * creates a default operationContext instance. The defaults are
+ - 100 items per page
+ - start at first 100 items
+ */
+ (CMISOperationContext *)defaultOperationContext;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Client/CMISOperationContext.m b/ObjectiveCMIS/Client/CMISOperationContext.m
index c449da3..cf6d8d4 100644
--- a/ObjectiveCMIS/Client/CMISOperationContext.m
+++ b/ObjectiveCMIS/Client/CMISOperationContext.m
@@ -22,17 +22,6 @@
@implementation CMISOperationContext
-@synthesize filterString = _filterString;
-@synthesize includeAllowableActions = _includeAllowableActions;
-@synthesize includeACLs = _includeACLs;
-@synthesize includeRelationShips = _includeRelationShips;
-@synthesize includePolicies = _includePolicies;
-@synthesize renditionFilterString = _renditionFilterString;
-@synthesize maxItemsPerPage = _maxItemsPerPage;
-@synthesize skipCount = _skipCount;
-@synthesize orderBy = _orderBy;
-@synthesize includePathSegments = _includePathSegments;
-
+ (CMISOperationContext *)defaultOperationContext
{
CMISOperationContext *defaultContext = [[CMISOperationContext alloc] init];
diff --git a/ObjectiveCMIS/Client/CMISPagedResult.h b/ObjectiveCMIS/Client/CMISPagedResult.h
index a498314..4f188c2 100644
--- a/ObjectiveCMIS/Client/CMISPagedResult.h
+++ b/ObjectiveCMIS/Client/CMISPagedResult.h
@@ -44,11 +44,23 @@
@property (readonly) BOOL hasMoreItems;
@property (readonly) NSInteger numItems;
+/**
+ * completionBlock returns paged results or nil if unsuccessful
+ */
+ (void)pagedResultUsingFetchBlock:(CMISFetchNextPageBlock)fetchNextPageBlock
andLimitToMaxItems:(NSInteger)maxItems andStartFromSkipCount:(NSInteger)skipCount
completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+/**
+ * fetches the next page
+ * completionBlock returns paged result or nil if unsuccessful
+ */
- (void)fetchNextPageWithCompletionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
+
+/**
+ * enumerates through the items in a page
+ * completionBlock returns NSError nil if successful
+ */
- (void)enumerateItemsUsingBlock:(void (^)(CMISObject *object, BOOL *stop))enumerationBlock
completionBlock:(void (^)(NSError *error))completionBlock;
diff --git a/ObjectiveCMIS/Client/CMISPagedResult.m b/ObjectiveCMIS/Client/CMISPagedResult.m
index 623b42f..a882cc3 100644
--- a/ObjectiveCMIS/Client/CMISPagedResult.m
+++ b/ObjectiveCMIS/Client/CMISPagedResult.m
@@ -25,9 +25,6 @@
*/
@implementation CMISFetchNextPageBlockResult
-@synthesize resultArray = _resultArray;
-@synthesize hasMoreItems = _hasMoreItems;
-@synthesize numItems = _numItems;
@end
@@ -51,12 +48,6 @@
*/
@implementation CMISPagedResult
-@synthesize resultArray = _resultArray;
-@synthesize hasMoreItems = _hasMoreItems;
-@synthesize numItems = _numItems;
-@synthesize fetchNextPageBlock = _fetchNextPageBlock;
-@synthesize maxItems = _maxItems;
-@synthesize skipCount = _skipCount;
/** Internal init */
@@ -66,8 +57,7 @@
andMaxItems:(NSInteger)maxItems andSkipCount:(NSInteger)skipCount;
{
self = [super init];
- if (self)
- {
+ if (self) {
self.resultArray = resultArray;
self.fetchNextPageBlock = fetchNextPageBlock;
self.hasMoreItems = hasMoreItems;
diff --git a/ObjectiveCMIS/Client/CMISRendition.h b/ObjectiveCMIS/Client/CMISRendition.h
index fcfc575..7bfe919 100644
--- a/ObjectiveCMIS/Client/CMISRendition.h
+++ b/ObjectiveCMIS/Client/CMISRendition.h
@@ -27,17 +27,36 @@
@interface CMISRendition : CMISRenditionData
+/**
+ initialiser
+ */
- (id)initWithRenditionData:(CMISRenditionData *)renditionData andObjectId:(NSString *)objectId andSession:(CMISSession *)session;
+/**
+ * retrieves the rendition, e.g. thumbnail of a document
+ * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
+ */
- (void)retrieveRenditionDocumentWithCompletionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+/**
+ * retrieves the rendition, e.g. thumbnail of a document
+ * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
+ */
- (void)retrieveRenditionDocumentWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock;
+/**
+ * downloads the rendition of a document e.g. thumbnail of a document to a file
+ * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
+ */
- (void)downloadRenditionContentToFile:(NSString *)filePath
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
+/**
+ * downloads the rendition of a document e.g. thumbnail of a document to a file
+ * completionBlock returns the rendition object as CMIS document or nil if unsuccessful
+ */
- (void)downloadRenditionContentToOutputStream:(NSOutputStream *)outputStream
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
diff --git a/ObjectiveCMIS/Client/CMISRendition.m b/ObjectiveCMIS/Client/CMISRendition.m
index 8908429..615851a 100644
--- a/ObjectiveCMIS/Client/CMISRendition.m
+++ b/ObjectiveCMIS/Client/CMISRendition.m
@@ -31,14 +31,11 @@
@implementation CMISRendition
-@synthesize session = _session;
-@synthesize objectId = _objectId;
- (id)initWithRenditionData:(CMISRenditionData *)renditionData andObjectId:(NSString *)objectId andSession:(CMISSession *)session
{
self = [super initWithRenditionData:renditionData];
- if (self)
- {
+ if (self) {
self.objectId = objectId;
self.session = session;
}
@@ -53,16 +50,14 @@
- (void)retrieveRenditionDocumentWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISDocument *document, NSError *error))completionBlock
{
- if (self.renditionDocumentId == nil)
- {
+ if (self.renditionDocumentId == nil) {
log(@"Cannot retrieve rendition document: no renditionDocumentId was returned by the server.");
completionBlock(nil, nil);
return;
}
[self.session retrieveObject:self.renditionDocumentId withOperationContext:operationContext completionBlock:^(CMISObject *renditionDocument, NSError *error) {
- if (renditionDocument != nil && !([[renditionDocument class] isKindOfClass:[CMISDocument class]]))
- {
+ if (renditionDocument != nil && !([[renditionDocument class] isKindOfClass:[CMISDocument class]])) {
completionBlock(nil, nil);
return;
}
@@ -75,8 +70,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
{
- if (self.objectId == nil || self.streamId == nil)
- {
+ if (self.objectId == nil || self.streamId == nil) {
log(@"Object id or stream id is nil. Both are needed when fetching the content of a rendition");
return;
}
@@ -92,8 +86,7 @@
completionBlock:(void (^)(NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
{
- if (self.objectId == nil || self.streamId == nil)
- {
+ if (self.objectId == nil || self.streamId == nil) {
log(@"Object id or stream id is nil. Both are needed when fetching the content of a rendition");
return;
}
diff --git a/ObjectiveCMIS/Client/CMISRequest.h b/ObjectiveCMIS/Client/CMISRequest.h
index fd00347..6eaf16b 100644
--- a/ObjectiveCMIS/Client/CMISRequest.h
+++ b/ObjectiveCMIS/Client/CMISRequest.h
@@ -26,6 +26,9 @@
@property (nonatomic, weak) id httpRequest;
@property (nonatomic, readonly, getter = isCancelled) BOOL cancelled;
+/**
+ cancel a network request
+ */
- (void)cancel;
@end
diff --git a/ObjectiveCMIS/Client/CMISRequest.m b/ObjectiveCMIS/Client/CMISRequest.m
index 3c862ad..3b26c50 100644
--- a/ObjectiveCMIS/Client/CMISRequest.m
+++ b/ObjectiveCMIS/Client/CMISRequest.m
@@ -28,8 +28,6 @@
@implementation CMISRequest
-@synthesize httpRequest = _httpRequest;
-@synthesize cancelled = _cancelled;
- (void)cancel
{
@@ -42,8 +40,7 @@
{
_httpRequest = httpRequest;
- if (self.isCancelled && [httpRequest respondsToSelector:@selector(cancel)])
- {
+ if (self.isCancelled && [httpRequest respondsToSelector:@selector(cancel)]) {
[httpRequest cancel];
}
}
diff --git a/ObjectiveCMIS/Client/CMISSession.h b/ObjectiveCMIS/Client/CMISSession.h
index 827127e..5b7eb5b 100644
--- a/ObjectiveCMIS/Client/CMISSession.h
+++ b/ObjectiveCMIS/Client/CMISSession.h
@@ -48,10 +48,16 @@
// *** setup ***
// returns an array of CMISRepositoryInfo objects representing the repositories available at the endpoint.
+/**
+ * completionBlock returns a list of repositories or nil if unsuccessful
+ */
+ (void)arrayOfRepositories:(CMISSessionParameters *)sessionParameters
completionBlock:(void (^)(NSArray *repositories, NSError *error))completionBlock;
+/**
+ * completionBlock returns a CMIS session or nil if unsuccessful
+ */
+ (void)connectWithSessionParameters:(CMISSessionParameters *)sessionParameters
completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock;
@@ -59,37 +65,43 @@
/**
* Retrieves the root folder for the repository.
+ * completionBlock returns the root folder of the repo or nil if unsuccessful
*/
- (void)retrieveRootFolderWithCompletionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
/**
* Retrieves the root folder for the repository using the provided operation context.
+ * completionBlock returns a folder of the repo or nil if unsuccessful
*/
- (void)retrieveFolderWithOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISFolder *folder, NSError *error))completionBlock;
/**
- * Retrieves the object with the given identifier.
+ * Retrieves the object with the given identifier.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObject:(NSString *)objectId
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
* Retrieves the object with the given identifier, using the provided operation context.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObject:(NSString *)objectId
withOperationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
- * Retrieves the object for the given path.
- */
+ * Retrieves the object for the given path.
+ * completionBlock returns the CMIS object or nil if unsuccessful
+ */
- (void)retrieveObjectByPath:(NSString *)path
completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock;
/**
* Retrieves the object for the given path, using the provided operation context.
+ * completionBlock returns the CMIS object or nil if unsuccessful
*/
- (void)retrieveObjectByPath:(NSString *)path
withOperationContext:(CMISOperationContext *)operationContext
@@ -97,13 +109,13 @@
/**
* Retrieves the definition for the given type.
+ * completionBlock returns the CMIS type definition or nil if unsuccessful
*/
- (void)retrieveTypeDefinition:(NSString *)typeId
completionBlock:(void (^)(CMISTypeDefinition *typeDefinition, NSError *error))completionBlock;
/**
* Retrieves all objects matching the given cmis query.
- *
- * @return An array of CMISQueryResult objects.
+ * completionBlock returns the search results as a paged results object or nil if unsuccessful.
*/
- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock;
@@ -111,8 +123,7 @@
/**
* Retrieves all objects matching the given cmis query, as CMISQueryResult objects.
* and using the parameters provided in the operation context.
- *
- * @return An array of CMISQueryResult objects.
+ * completionBlock returns the search results as a paged results object or nil if unsuccessful.
*/
- (void)query:(NSString *)statement searchAllVersions:(BOOL)searchAllVersion
operationContext:(CMISOperationContext *)operationContext
@@ -121,6 +132,7 @@
/**
* Queries for a specific type of objects.
* Returns a paged result set, containing CMISObject instances.
+ * completionBlock returns the search results as a paged results object or nil if unsuccessful.
*/
- (void)queryObjectsWithTypeid:(NSString *)typeId
withWhereClause:(NSString *)whereClause
@@ -131,6 +143,7 @@
/**
* Creates a folder in the provided folder.
+ * completionBlock returns the object Id of the newly created folder or nil if unsuccessful
*/
- (void)createFolder:(NSDictionary *)properties
inFolder:(NSString *)folderObjectId
@@ -139,6 +152,7 @@
/**
* Downloads the content of object with the provided object id to the given path.
+ * completionBlock NSError will be nil if successful
*/
- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
toFile:(NSString *)filePath
@@ -147,6 +161,7 @@
/**
* Downloads the content of object with the provided object id to the given stream.
+ * completionBlock NSError will be nil if successful
*/
- (CMISRequest*)downloadContentOfCMISObject:(NSString *)objectId
toOutputStream:(NSOutputStream*)outputStream
@@ -155,6 +170,7 @@
/**
* Creates a cmis document using the content from the file path.
+ * completionBlock returns object Id of newly created object or nil if unsuccessful
*/
- (void)createDocumentFromFilePath:(NSString *)filePath
withMimeType:(NSString *)mimeType
@@ -165,6 +181,7 @@
/**
* Creates a cmis document using the content from the given stream.
+ * completionBlock returns object Id of newly created object or nil if unsuccessful
*/
- (void)createDocumentFromInputStream:(NSInputStream *)inputStream
withMimeType:(NSString *)mimeType
diff --git a/ObjectiveCMIS/Client/CMISSession.m b/ObjectiveCMIS/Client/CMISSession.m
index 79eb8e4..450153c 100644
--- a/ObjectiveCMIS/Client/CMISSession.m
+++ b/ObjectiveCMIS/Client/CMISSession.m
@@ -49,12 +49,6 @@
@implementation CMISSession
-@synthesize authenticated = _authenticated;
-@synthesize binding = _binding;
-@synthesize repositoryInfo = _repositoryInfo;
-@synthesize sessionParameters = _sessionParameters;
-@synthesize objectConverter = _objectConverter;
-
#pragma mark -
#pragma mark Setup
@@ -72,12 +66,9 @@
completionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock
{
CMISSession *session = [[CMISSession alloc] initWithSessionParameters:sessionParameters];
- if (session)
- {
+ if (session) {
[session authenticateWithCompletionBlock:completionBlock];
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Not enough session parameters to connect"]);
}
@@ -88,18 +79,15 @@
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters
{
self = [super init];
- if (self)
- {
+ if (self) {
self.sessionParameters = sessionParameters;
self.authenticated = NO;
// setup authentication provider if not present
- if (self.sessionParameters.authenticationProvider == nil)
- {
+ if (self.sessionParameters.authenticationProvider == nil) {
NSString *username = self.sessionParameters.username;
NSString *password = self.sessionParameters.password;
- if (username == nil || password == nil)
- {
+ if (username == nil || password == nil) {
log(@"No username or password provided for standard authentication provider");
return nil;
}
@@ -108,8 +96,7 @@
andPassword:password];
}
- if (self.sessionParameters.networkProvider == nil)
- {
+ if (self.sessionParameters.networkProvider == nil) {
self.sessionParameters.networkProvider = [[CMISDefaultNetworkProvider alloc] init];
}
@@ -118,14 +105,11 @@
self.binding = [bindingFactory bindingWithParameters:sessionParameters];
id objectConverterClassValue = [self.sessionParameters objectForKey:kCMISSessionParameterObjectConverterClassName];
- if (objectConverterClassValue != nil && [objectConverterClassValue isKindOfClass:[NSString class]])
- {
+ if (objectConverterClassValue != nil && [objectConverterClassValue isKindOfClass:[NSString class]]) {
NSString *objectConverterClassName = (NSString *)objectConverterClassValue;
log(@"Using a custom object converter class: %@", objectConverterClassName);
self.objectConverter = [[NSClassFromString(objectConverterClassName) alloc] initWithSession:self];
- }
- else // default
- {
+ } else { //default
self.objectConverter = [[CMISObjectConverter alloc] initWithSession:self];
}
@@ -142,8 +126,7 @@
// TODO: validate session parameters, extract the checks below?
// check repository id is present
- if (self.sessionParameters.repositoryId == nil)
- {
+ if (self.sessionParameters.repositoryId == nil) {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Must provide repository id"];
log(@"Error: %@", error.description);
@@ -163,15 +146,11 @@
// get repository info
[self.binding.repositoryService retrieveRepositoryInfoForId:self.sessionParameters.repositoryId completionBlock:^(CMISRepositoryInfo *repositoryInfo, NSError *error) {
self.repositoryInfo = repositoryInfo;
- if (self.repositoryInfo == nil)
- {
- if (error)
- {
+ if (self.repositoryInfo == nil) {
+ if (error) {
log(@"Error because repositoryInfo is nil: %@", error.description);
completionBlock(nil, [CMISErrors cmisError:error withCMISErrorCode:kCMISErrorCodeInvalidArgument]);
- }
- else
- {
+ } else {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:@"Could not fetch repository information"]);
}
@@ -210,8 +189,7 @@
- (void)retrieveObject:(NSString *)objectId withOperationContext:(CMISOperationContext *)operationContext completionBlock:(void (^)(CMISObject *object, NSError *error))completionBlock
{
- if (objectId == nil)
- {
+ if (objectId == nil) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument withDetailedDescription:@"Must provide object id"]);
return;
}
@@ -278,8 +256,7 @@
operationContext:(CMISOperationContext *)operationContext
completionBlock:(void (^)(CMISPagedResult *pagedResult, NSError *error))completionBlock
{
- CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock)
- {
+ CMISFetchNextPageBlock fetchNextPageBlock = ^(int skipCount, int maxItems, CMISFetchNextPageBlockCompletionBlock pageBlockCompletionBlock){
// Fetch results through discovery service
[self.binding.discoveryService query:statement
searchAllVersions:searchAllVersion
@@ -299,8 +276,7 @@
NSMutableArray *resultArray = [[NSMutableArray alloc] init];
result.resultArray = resultArray;
- for (CMISObjectData *objectData in objectList.objects)
- {
+ for (CMISObjectData *objectData in objectList.objects) {
[resultArray addObject:[CMISQueryResult queryResultUsingCmisObjectData:objectData andWithSession:self]];
}
pageBlockCompletionBlock(result, nil);
@@ -337,14 +313,12 @@
[statement appendFormat:@" FROM %@", typeDefinition.queryName];
// Where
- if (whereClause != nil)
- {
+ if (whereClause != nil) {
[statement appendFormat:@" WHERE %@", whereClause];
}
// Order by
- if (operationContext.orderBy != nil)
- {
+ if (operationContext.orderBy != nil) {
[statement appendFormat:@" ORDER BY %@", operationContext.orderBy];
}
diff --git a/ObjectiveCMIS/Common/CMISAllowableActions.h b/ObjectiveCMIS/Common/CMISAllowableActions.h
index d4c9382..7fee53d 100644
--- a/ObjectiveCMIS/Common/CMISAllowableActions.h
+++ b/ObjectiveCMIS/Common/CMISAllowableActions.h
@@ -28,12 +28,20 @@
// Designated Initializer
- (id)init;
-// Use this init method when initializing with a raw NSDictionary parsed from an AtomPub Response
+
+/// Use this init method when initializing with a raw NSDictionary parsed from an AtomPub Response
+/**
+ */
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict;
+
+/**
+ initialises with allowable actions dictionary and optional extension array
+ */
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray;
-// Returns an NSSet of NSNumber of objects. The NSNumber objects map to the CMISActionType enum
+/// Returns an NSSet of NSNumber of objects. The NSNumber objects map to the CMISActionType enum
- (NSSet *)allowableActionTypesSet;
-// Set the allowable actions with a raw NSDictionary parsed from an AtomPub Response
+
+/// Set the allowable actions with a raw NSDictionary parsed from an AtomPub Response
- (void)setAllowableActionsWithDictionary:(NSDictionary *)allowableActionsDict;
@end
diff --git a/ObjectiveCMIS/Common/CMISAllowableActions.m b/ObjectiveCMIS/Common/CMISAllowableActions.m
index b01a22f..0b61aa6 100644
--- a/ObjectiveCMIS/Common/CMISAllowableActions.m
+++ b/ObjectiveCMIS/Common/CMISAllowableActions.m
@@ -30,7 +30,6 @@
@implementation CMISAllowableActions
-@synthesize allowableActionsSet = _allowableActionsSet;
- (id)init
{
@@ -42,8 +41,7 @@
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict
{
self = [self init];
- if (self)
- {
+ if (self) {
[self setAllowableActionsWithDictionary:allowableActionsDict];
}
return self;
@@ -52,8 +50,7 @@
- (id)initWithAllowableActionsDictionary:(NSDictionary *)allowableActionsDict extensionElementArray:(NSArray *)extensionElementArray
{
self = [self initWithAllowableActionsDictionary:allowableActionsDict];
- if (self)
- {
+ if (self) {
self.extensions = extensionElementArray;
}
return self;
@@ -64,8 +61,7 @@
NSArray *actionsArray = [[NSArray alloc] initWithObjects:CMISAllowableActionsArray];
NSMutableSet *allowableActionTypesSet = [NSMutableSet set];
- for (NSString *actionStrValue in self.allowableActionsSet)
- {
+ for (NSString *actionStrValue in self.allowableActionsSet) {
// TODO: Check that the idx is valid in the defined enum
NSInteger idx = [actionsArray indexOfObject:actionStrValue];
diff --git a/ObjectiveCMIS/Common/CMISAuthenticationProvider.h b/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
index e574fbd..a8ce9be 100644
--- a/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
+++ b/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
@@ -31,10 +31,24 @@
*/
@property(nonatomic, strong, readonly) NSDictionary *httpHeadersToApply;
+/**
+ * updates the provider with NSHTTPURLResponse
+ */
- (void)updateWithHttpURLResponse:(NSHTTPURLResponse*)httpUrlResponse;
+/**
+ * checks if provider can authenticate against provided protection space
+ */
- (BOOL)canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
+
+/**
+ * callback when authentication challenge was cancelled
+ */
- (void)didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
+
+/**
+ * callback when authentication challenge was received
+ */
- (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
@end
diff --git a/ObjectiveCMIS/Common/CMISEnums.m b/ObjectiveCMIS/Common/CMISEnums.m
index f2cd234..b3e51b0 100644
--- a/ObjectiveCMIS/Common/CMISEnums.m
+++ b/ObjectiveCMIS/Common/CMISEnums.m
@@ -24,8 +24,7 @@
+ (NSString *)stringForIncludeRelationShip:(CMISIncludeRelationship)includeRelationship
{
NSString *includeRelationShipString = nil;
- switch (includeRelationship)
- {
+ switch (includeRelationship) {
case (CMISIncludeRelationshipNone):
includeRelationShipString = @"none";
break;
@@ -48,8 +47,7 @@
+ (NSString *)stringForUnfileObject:(CMISUnfileObject)unfileObject;
{
NSString *unfileObjectString = nil;
- switch (unfileObject)
- {
+ switch (unfileObject) {
case CMISUnfile:
unfileObjectString = @"unfile";
break;
diff --git a/ObjectiveCMIS/Common/CMISExtensionData.m b/ObjectiveCMIS/Common/CMISExtensionData.m
index 36dc5f2..8a30899 100644
--- a/ObjectiveCMIS/Common/CMISExtensionData.m
+++ b/ObjectiveCMIS/Common/CMISExtensionData.m
@@ -21,6 +21,5 @@
@implementation CMISExtensionData
-@synthesize extensions = _extensions;
@end
diff --git a/ObjectiveCMIS/Common/CMISExtensionElement.h b/ObjectiveCMIS/Common/CMISExtensionElement.h
index f198bfe..5c8d18f 100644
--- a/ObjectiveCMIS/Common/CMISExtensionElement.h
+++ b/ObjectiveCMIS/Common/CMISExtensionElement.h
@@ -35,6 +35,7 @@
/// Node Initializer
- (id)initNodeWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict children:(NSArray *)children;
+
/// Leaf Initializer
- (id)initLeafWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict value:(NSString *)value;
diff --git a/ObjectiveCMIS/Common/CMISExtensionElement.m b/ObjectiveCMIS/Common/CMISExtensionElement.m
index bb4699f..c4e2ae7 100644
--- a/ObjectiveCMIS/Common/CMISExtensionElement.m
+++ b/ObjectiveCMIS/Common/CMISExtensionElement.m
@@ -34,20 +34,13 @@
@implementation CMISExtensionElement
-@synthesize name = _name;
-@synthesize namespaceUri = _namespaceUri;
-@synthesize value = _value;
-@synthesize attributes = _attributes;
-@synthesize children = _children;
-
#pragma mark -
#pragma mark Initializers
- (id)initWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri
{
self = [super init];
- if (self)
- {
+ if (self) {
self.name = name;
self.namespaceUri = namespaceUri;
}
@@ -57,8 +50,7 @@
- (id)initNodeWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict children:(NSArray *)children
{
self = [self initWithName:name namespaceUri:namespaceUri];
- if (self)
- {
+ if (self) {
self.value = nil;
self.attributes = attributesDict;
self.children = children;
@@ -69,8 +61,7 @@
- (id)initLeafWithName:(NSString *)name namespaceUri:(NSString *)namespaceUri attributes:(NSDictionary *)attributesDict value:(NSString *)value
{
self = [self initWithName:name namespaceUri:namespaceUri];
- if (self)
- {
+ if (self) {
self.value = value;
self.attributes = attributesDict;
self.children = nil;
diff --git a/ObjectiveCMIS/Common/CMISNetworkProvider.h b/ObjectiveCMIS/Common/CMISNetworkProvider.h
index dce9813..65ef9b2 100644
--- a/ObjectiveCMIS/Common/CMISNetworkProvider.h
+++ b/ObjectiveCMIS/Common/CMISNetworkProvider.h
@@ -25,6 +25,23 @@
@protocol CMISNetworkProvider <NSObject>
+/**
+ * CMISNetworkProvider is a protocol used by the CMIS library to invoke network requests.
+ * In case a custom network provider is to be used, this protocol must be implemented and an instance of the
+ * custom class provided in the CMISSessionParameters when creating a CMIS Session.
+ * CMISSessionParameters provides a networkProvider property for that purpose.
+ * All methods in this protocol must be implemented
+ */
+
+/**
+ * A general invoke method, typically used for GET, DELETE HTTP methods
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param body the data for the upload (maybe nil)
+ * @param headers any additional headers to be used in the request (maybe nil)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invoke:(NSURL *)url
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -32,6 +49,15 @@
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Invoke method used for uploads, i.e. POST/PUT requests
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param inputStream the stream pointing to the source to be uploaded. Must be an instance or extension of NSInputStream
+ * @param headers any additional headers to be used in the request (maybe nil)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invoke:(NSURL *)url
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -40,6 +66,18 @@
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Invoke method used for uploads, i.e. POST/PUT requests
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param inputStream the stream pointing to the source to be uploaded. Must be an instance or extension of NSInputStream
+ * @param headers any additional headers to be used in the request (maybe nil)
+ * @param bytesExpected the size of the content to be uploaded
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param progressBlock
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
+ */
- (void)invoke:(NSURL *)url withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
inputStream:(NSInputStream *)inputStream
@@ -49,6 +87,17 @@
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock
requestObject:(CMISRequest *)requestObject;
+/**
+ * Invoke method used for downloads,
+ * @param url the RESTful API URL to be used
+ * @param httpRequestMethod
+ * @param session
+ * @param outputStream the stream pointing to the destination. Must be an instance or extension of NSOutputStream
+ * @param bytesExpected the size of the content to be downloaded
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ * @param progressBlock
+ * @param requestObject a handle to the CMISRequest allowing this HTTP request to be cancelled
+ */
- (void)invoke:(NSURL *)url
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
withSession:(CMISBindingSession *)session
@@ -60,23 +109,51 @@
+/**
+ * Convenience GET invoke method
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokeGET:(NSURL *)url
withSession:(CMISBindingSession *)session
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience POST invoke method. Use for creating new content
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param body the data to be posted
+ * @param additionalHeaders any additional headers to be used in the request (optional)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokePOST:(NSURL *)url
withSession:(CMISBindingSession *)session
body:(NSData *)body
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience PUT invoke method. Use for updating existing content
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param body the data to be uploaded
+ * @param additionalHeaders any additional headers to be used in the request (optional)
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokePUT:(NSURL *)url
withSession:(CMISBindingSession *)session
body:(NSData *)body
headers:(NSDictionary *)additionalHeaders
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * Convenience DELETE invoke method
+ * @param url the RESTful API URL to be used
+ * @param session
+ * @param completionBlock returns an instance of the HTTPResponse if successful or nil otherwise
+ */
- (void)invokeDELETE:(NSURL *)url
withSession:(CMISBindingSession *)session
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
diff --git a/ObjectiveCMIS/Common/CMISObjectData.m b/ObjectiveCMIS/Common/CMISObjectData.m
index bac959f..461f27a 100644
--- a/ObjectiveCMIS/Common/CMISObjectData.m
+++ b/ObjectiveCMIS/Common/CMISObjectData.m
@@ -22,12 +22,5 @@
@implementation CMISObjectData
-@synthesize identifier = _identifier;
-@synthesize baseType = _baseType;
-@synthesize properties = _properties;
-@synthesize linkRelations = _linkRelations;
-@synthesize contentUrl = _contentUrl;
-@synthesize allowableActions = _allowableActions;
-@synthesize renditions = _renditions;
@end
diff --git a/ObjectiveCMIS/Common/CMISProperties.h b/ObjectiveCMIS/Common/CMISProperties.h
index 3a88488..1562881 100644
--- a/ObjectiveCMIS/Common/CMISProperties.h
+++ b/ObjectiveCMIS/Common/CMISProperties.h
@@ -42,30 +42,29 @@
- (CMISPropertyData *)propertyForId:(NSString *)id;
/**
-* Returns a property by query name or alias.
-*/
+ * Returns a property by query name or alias.
+ */
- (CMISPropertyData *)propertyForQueryName:(NSString *)queryName;
/**
-* Returns a property (single) value by id.
-*/
+ * Returns a property (single) value by id.
+ */
- (id)propertyValueForId:(NSString *)propertyId;
/**
-* Returns a property (single) value by query name or alias.
-*
-* @see #getPropertyByQueryName(String)
-*/
+ * Returns a property (single) value by query name or alias.
+ * @see #getPropertyByQueryName(String)
+ */
- (id)propertyValueForQueryName:(NSString *)queryName;
/**
-* Returns a property multi-value by id.
-*/
+ * Returns a property multi-value by id.
+ */
- (NSArray *)propertyMultiValueById:(NSString *)id;
/**
-* Returns a property multi-value by query name or alias.
-*/
+ * Returns a property multi-value by query name or alias.
+ */
- (NSArray *)propertyMultiValueByQueryName:(NSString *)queryName;
@end
diff --git a/ObjectiveCMIS/Common/CMISProperties.m b/ObjectiveCMIS/Common/CMISProperties.m
index 934a35c..998641a 100644
--- a/ObjectiveCMIS/Common/CMISProperties.m
+++ b/ObjectiveCMIS/Common/CMISProperties.m
@@ -26,24 +26,17 @@
@implementation CMISProperties
-@synthesize internalPropertiesByIdDict = _internalPropertiesByIdDict;
-@synthesize internalPropertiesByQueryNameDict = _internalPropertiesByQueryNameDict;
-@synthesize propertiesDictionary = _propertiesDictionary;
-@synthesize propertyList = _propertyList;
- (void)addProperty:(CMISPropertyData *)propertyData
{
- if (self.internalPropertiesByIdDict == nil)
- {
+ if (self.internalPropertiesByIdDict == nil) {
self.internalPropertiesByIdDict = [NSMutableDictionary dictionary];
}
[self.internalPropertiesByIdDict setObject:propertyData forKey:propertyData.identifier];
- if (propertyData.queryName != nil)
- {
- if (self.internalPropertiesByQueryNameDict == nil)
- {
+ if (propertyData.queryName != nil) {
+ if (self.internalPropertiesByQueryNameDict == nil) {
self.internalPropertiesByQueryNameDict = [NSMutableDictionary dictionary];
}
[self.internalPropertiesByQueryNameDict setObject:propertyData forKey:propertyData.queryName];
diff --git a/ObjectiveCMIS/Common/CMISPropertyData.h b/ObjectiveCMIS/Common/CMISPropertyData.h
index e6814e4..eed9391 100644
--- a/ObjectiveCMIS/Common/CMISPropertyData.h
+++ b/ObjectiveCMIS/Common/CMISPropertyData.h
@@ -54,31 +54,40 @@
/** Convenience method for retrieving the decimal value. Returns nil if property is not of decimal type */
- (NSNumber *)propertyDecimalValue;
-/** Creation of a multi-value property */
+/** Creation of a multi-value property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withArrayValue:(NSArray *)value type:(CMISPropertyType)type;
-/** Creation of a string property */
+/** Creation of a string property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withStringValue:(NSString *)value;
-/** Creation of an integer property */
+/** Creation of an integer property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withIntegerValue:(NSInteger)value;
-/** Creation of a decimal property */
+/** Creation of a decimal property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withDecimalValue:(NSNumber *)value;
-/** Creation of an id property */
+/** Creation of an id property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withIdValue:(NSString *)value;
-/** Creation of a datetime property */
+/** Creation of a datetime property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withDateTimeValue:(NSDate *)value;
-/** Creation of a boolean property */
+/** Creation of a boolean property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withBoolValue:(BOOL)value;
-/** Creation of a uri property */
+/** Creation of a uri property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withUriValue:(NSURL *)value;
-/** Creation of a uri property */
+/** Creation of a uri property
+ */
+ (CMISPropertyData *)createPropertyForId:(NSString *)id withHtmlValue:(NSString *)value;
@end
diff --git a/ObjectiveCMIS/Common/CMISPropertyData.m b/ObjectiveCMIS/Common/CMISPropertyData.m
index 3441827..ddff33b 100644
--- a/ObjectiveCMIS/Common/CMISPropertyData.m
+++ b/ObjectiveCMIS/Common/CMISPropertyData.m
@@ -27,19 +27,12 @@
@implementation CMISPropertyData
-@synthesize identifier = _identifier;
-@synthesize localName = _localName;
-@synthesize displayName = _displayName;
-@synthesize queryName = _queryName;
-@synthesize values = _values;
-@synthesize type = _type;
- (id)firstValue
{
id value = nil;
- if (self.values != nil && [self.values count] > 0)
- {
+ if (self.values != nil && [self.values count] > 0) {
value = [self.values objectAtIndex:0];
}
@@ -55,8 +48,7 @@
#pragma mark Value retrieval convenience methods
- (NSString *)propertyStringValue
{
- if (self.type == CMISPropertyTypeString)
- {
+ if (self.type == CMISPropertyTypeString) {
return [self firstValue];
}
return nil;
@@ -64,8 +56,7 @@
- (NSNumber *)propertyIntegerValue
{
- if (self.type == CMISPropertyTypeInteger)
- {
+ if (self.type == CMISPropertyTypeInteger) {
return [self firstValue];
}
return nil;
@@ -73,8 +64,7 @@
- (NSString *)propertyIdValue
{
- if (self.type == CMISPropertyTypeId)
- {
+ if (self.type == CMISPropertyTypeId) {
return [self firstValue];
}
return nil;
@@ -82,8 +72,7 @@
- (NSDate *)propertyDateTimeValue
{
- if (self.type == CMISPropertyTypeDateTime)
- {
+ if (self.type == CMISPropertyTypeDateTime) {
return [self firstValue];
}
return nil;
@@ -91,8 +80,7 @@
- (NSNumber *)propertyBooleanValue
{
- if (self.type == CMISPropertyTypeBoolean)
- {
+ if (self.type == CMISPropertyTypeBoolean) {
return [self firstValue];
}
return nil;
@@ -100,8 +88,7 @@
- (NSNumber *)propertyDecimalValue
{
- if (self.type == CMISPropertyTypeDecimal)
- {
+ if (self.type == CMISPropertyTypeDecimal) {
return [self firstValue];
}
return nil;
diff --git a/ObjectiveCMIS/Common/CMISRepositoryInfo.h b/ObjectiveCMIS/Common/CMISRepositoryInfo.h
index 6a63a27..7f1fe1c 100644
--- a/ObjectiveCMIS/Common/CMISRepositoryInfo.h
+++ b/ObjectiveCMIS/Common/CMISRepositoryInfo.h
@@ -33,9 +33,10 @@
@property (nonatomic, strong) NSString *vendorName;
// TODO the repositoryCapabilities property is currently not types.
-// CMISRepositoryCapabilities needs to be created and replace the raw NSDictionary object
-// that is currently being set from the CMISRepositoryInfoParser
-// ** Use keypaths to get values until the property is properly typed **
+/** CMISRepositoryCapabilities needs to be created and replace the raw NSDictionary object
+ * that is currently being set from the CMISRepositoryInfoParser
+ * Use keypaths to get values until the property is properly typed **
+ */
@property (nonatomic, strong) id repositoryCapabilities;
@end
diff --git a/ObjectiveCMIS/Common/CMISRepositoryInfo.m b/ObjectiveCMIS/Common/CMISRepositoryInfo.m
index f540abe..f995db2 100644
--- a/ObjectiveCMIS/Common/CMISRepositoryInfo.m
+++ b/ObjectiveCMIS/Common/CMISRepositoryInfo.m
@@ -21,15 +21,6 @@
@implementation CMISRepositoryInfo
-@synthesize identifier = _identifier;
-@synthesize name = _name;
-@synthesize desc = _desc;
-@synthesize rootFolderId = _rootFolderId;
-@synthesize cmisVersionSupported = _cmisVersionSupported;
-@synthesize productName = _productName;
-@synthesize productVersion = _productVersion;
-@synthesize vendorName = _vendorName;
-@synthesize repositoryCapabilities = _repositoryCapabilities;
- (NSString *)description
{
diff --git a/ObjectiveCMIS/Common/CMISSessionParameters.h b/ObjectiveCMIS/Common/CMISSessionParameters.h
index 904856d..7271387 100644
--- a/ObjectiveCMIS/Common/CMISSessionParameters.h
+++ b/ObjectiveCMIS/Common/CMISSessionParameters.h
@@ -60,15 +60,21 @@
// Network I/O
@property (nonatomic, strong) id<CMISNetworkProvider> networkProvider;
-
+/** init with binding type
+ */
- (id)initWithBindingType:(CMISBindingType)bindingType;
-// Object storage methods
+/// Object storage methods
- (NSArray *)allKeys;
+
- (id)objectForKey:(id)key;
+
- (id)objectForKey:(id)key withDefaultValue:(id)defaultValue;
+
- (void)setObject:(id)object forKey:(id)key;
+
- (void)addEntriesFromDictionary:(NSDictionary *)dictionary;
+
- (void)removeKey:(id)key;
@end
diff --git a/ObjectiveCMIS/Common/CMISSessionParameters.m b/ObjectiveCMIS/Common/CMISSessionParameters.m
index a61adf6..934b236 100644
--- a/ObjectiveCMIS/Common/CMISSessionParameters.m
+++ b/ObjectiveCMIS/Common/CMISSessionParameters.m
@@ -32,14 +32,6 @@
@implementation CMISSessionParameters
-@synthesize username = _username;
-@synthesize password = _password;
-@synthesize repositoryId = _repositoryId;
-@synthesize bindingType = _bindingType;
-@synthesize atomPubUrl = _atomPubUrl;
-@synthesize authenticationProvider = _authenticationProvider;
-@synthesize sessionData = _sessionData;
-@synthesize networkProvider = _networkProvider;
- (id)init
{
@@ -49,8 +41,7 @@
- (id)initWithBindingType:(CMISBindingType)bindingType
{
self = [super init];
- if (self)
- {
+ if (self) {
self.sessionData = [[NSMutableDictionary alloc] init];
self.bindingType = bindingType;
}
diff --git a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h
index 46e05fc..fc3e776 100644
--- a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h
+++ b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.h
@@ -24,14 +24,15 @@
@property (nonatomic, strong) NSURLCredential *credential;
-/**
- * Initialize with username and password that will be added as authorization header
+/** Initialize with username and password that will be added as authorization header
+ * @param username
+ * @param password
*/
- (id)initWithUsername:(NSString *)username andPassword:(NSString *)password;
-/**
- * Initialize with a credential object that will be provided when a corresponding challenge is received from the server.
+/** Initialize with a credential object that will be provided when a corresponding challenge is received from the server.
* Both client certificate and username / password credentials are supported
+ * @param credential
*/
- (id)initWithCredential:(NSURLCredential *)credential;
diff --git a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
index a0be279..abadf4e 100644
--- a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
+++ b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
@@ -27,15 +27,11 @@
@implementation CMISStandardAuthenticationProvider
-@synthesize username = _username;
-@synthesize password = _password;
-@synthesize credential = _credential;
- (id)initWithUsername:(NSString *)username andPassword:(NSString *)password
{
self = [super init];
- if (self)
- {
+ if (self) {
self.username = username;
self.password = password;
}
diff --git a/ObjectiveCMIS/Utils/CMISBase64Encoder.h b/ObjectiveCMIS/Utils/CMISBase64Encoder.h
index 86cb0c1..31acadc 100644
--- a/ObjectiveCMIS/Utils/CMISBase64Encoder.h
+++ b/ObjectiveCMIS/Utils/CMISBase64Encoder.h
@@ -21,16 +21,22 @@
@interface CMISBase64Encoder : NSObject
+/// encodes data into base 64 and returns the result as NSString
+ (NSString *)stringByEncodingText:(NSData *)plainText;
+/// returns base64 encoded data for given input data
+ (NSData *)dataByEncodingText:(NSData *)plainText;
+/// base64 encodes the content of a file
+ (NSString *)encodeContentOfFile:(NSString *)sourceFilePath;
+/// base64 encodes data from an input stream
+ (NSString *)encodeContentFromInputStream:(NSInputStream*)inputStream;
+/// base64 encodes data from a source file and appends the encoded result to the given destination file
+ (void)encodeContentOfFile:(NSString *)sourceFilePath andAppendToFile:(NSString *)destinationFilePath;
+/// base64 encodes data from an input stream and appends the encoded data to a given destination file
+ (void)encodeContentFromInputStream:(NSInputStream*)inputStream andAppendToFile:(NSString *)destinationFilePath;
@end
diff --git a/ObjectiveCMIS/Utils/CMISBase64Encoder.m b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
index 280d8b6..89ed248 100644
--- a/ObjectiveCMIS/Utils/CMISBase64Encoder.m
+++ b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
@@ -41,8 +41,7 @@
NSInteger j = 0;
int remain;
- for (i = 0; i < [plainText length]; i += 3)
- {
+ for (i = 0; i < [plainText length]; i += 3) {
remain = [plainText length] - i;
outputBuffer[j++] = alphabet[(inputBuffer[i] & 0xFC) >> 2];
@@ -69,8 +68,7 @@
NSMutableString *result = [[NSMutableString alloc] init];
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:sourceFilePath];
- if (fileHandle)
- {
+ if (fileHandle) {
// Get the total file length
[fileHandle seekToEndOfFile];
unsigned long long fileLength = [fileHandle offsetInFile];
@@ -79,10 +77,8 @@
unsigned long long currentOffset = 0ULL;
// Read the data and append it to the file
- while (currentOffset < fileLength)
- {
- @autoreleasepool
- {
+ while (currentOffset < fileLength) {
+ @autoreleasepool {
[fileHandle seekToFileOffset:currentOffset];
NSData *chunkOfData = [fileHandle readDataOfLength:32768];
[result appendString:[self stringByEncodingText:chunkOfData]];
@@ -92,9 +88,7 @@
// Release the file handle
[fileHandle closeFile];
- }
- else
- {
+ } else {
log(@"Could not create a file handle for %@", sourceFilePath);
}
@@ -124,8 +118,7 @@
+ (void)encodeContentOfFile:(NSString *)sourceFilePath andAppendToFile:(NSString *)destinationFilePath
{
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:sourceFilePath];
- if (fileHandle)
- {
+ if (fileHandle) {
// Get the total file length
[fileHandle seekToEndOfFile];
unsigned long long fileLength = [fileHandle offsetInFile];
@@ -134,10 +127,8 @@
unsigned long long currentOffset = 0ULL;
// Read the data and append it to the file
- while (currentOffset < fileLength)
- {
- @autoreleasepool
- {
+ while (currentOffset < fileLength) {
+ @autoreleasepool {
[fileHandle seekToFileOffset:currentOffset];
NSData *chunkOfData = [fileHandle readDataOfLength:524288]; // 512 kb
[FileUtil appendToFileAtPath:destinationFilePath data:[self dataByEncodingText:chunkOfData]];
@@ -147,9 +138,7 @@
// Release the file handle
[fileHandle closeFile];
- }
- else
- {
+ } else {
log(@"Could not create a file handle for %@", sourceFilePath);
}
}
diff --git a/ObjectiveCMIS/Utils/CMISDateUtil.h b/ObjectiveCMIS/Utils/CMISDateUtil.h
index 7b7b0ee..4437638 100644
--- a/ObjectiveCMIS/Utils/CMISDateUtil.h
+++ b/ObjectiveCMIS/Utils/CMISDateUtil.h
@@ -25,7 +25,9 @@
@interface CMISDateUtil : NSObject
+/// converts a NSDate object into an ISO compliant date string
+ (NSString*)stringFromDate:(NSDate*)date;
+/// parses an ISO compliant string and returns the date
+ (NSDate *)dateFromString:(NSString *)string;
diff --git a/ObjectiveCMIS/Utils/CMISDateUtil.m b/ObjectiveCMIS/Utils/CMISDateUtil.m
index 90376a2..7dab9b7 100644
--- a/ObjectiveCMIS/Utils/CMISDateUtil.m
+++ b/ObjectiveCMIS/Utils/CMISDateUtil.m
@@ -29,8 +29,7 @@
{
static dispatch_once_t predicate = 0;
__strong static NSDateFormatter *dateFormatter = nil;
- dispatch_once(&predicate, ^
- {
+ dispatch_once(&predicate, ^ {
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [NSLocale systemLocale];
dateFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; // ISO8601 calendar not available
@@ -43,13 +42,15 @@
}
-+ (NSString*)stringFromDate:(NSDate*)date {
++ (NSString*)stringFromDate:(NSDate*)date
+{
NSString *string = [[CMISDateUtil CMISDateFormatter] stringFromDate:date];
return string;
}
-+ (NSDate *)dateFromString:(NSString *)string {
++ (NSDate *)dateFromString:(NSString *)string
+{
if (string == nil) {
return nil;
}
diff --git a/ObjectiveCMIS/Utils/CMISFileUtil.h b/ObjectiveCMIS/Utils/CMISFileUtil.h
index eb0f151..e822eba 100644
--- a/ObjectiveCMIS/Utils/CMISFileUtil.h
+++ b/ObjectiveCMIS/Utils/CMISFileUtil.h
@@ -21,9 +21,9 @@
@interface FileUtil : NSObject
-
+/// appends data to a file with given path
+ (void)appendToFileAtPath:(NSString *)filePath data:(NSData *)data;
-
+/// returns the size of a file at path filePath
+ (unsigned long long)fileSizeForFileAtPath:(NSString *)filePath error:(NSError * *)outError;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Utils/CMISFileUtil.m b/ObjectiveCMIS/Utils/CMISFileUtil.m
index 5b338ab..91ba8c2 100644
--- a/ObjectiveCMIS/Utils/CMISFileUtil.m
+++ b/ObjectiveCMIS/Utils/CMISFileUtil.m
@@ -26,8 +26,7 @@
{
NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
- if (fileHandle)
- {
+ if (fileHandle) {
[fileHandle seekToEndOfFile];
[fileHandle writeData:data];
}
diff --git a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
index 16c6a73..924146a 100644
--- a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
+++ b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
@@ -30,6 +30,9 @@
@property (nonatomic, readonly) unsigned long long bytesDownloaded;
+/** starts a URL request for download. Data are written to the provided output stream
+ * completionBlock returns a CMISHttpResponse object or nil if unsuccessful
+ */
+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest*)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
outputStream:(NSOutputStream*)outputStream
@@ -37,7 +40,7 @@
authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
-
+/// designated initialiser. Do not use directly, instead call the startRequest class method above
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long bytesTotal))progressBlock;
diff --git a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
index 1b30736..3128a12 100644
--- a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
@@ -30,10 +30,6 @@
@implementation CMISHttpDownloadRequest
-@synthesize outputStream = _outputStream;
-@synthesize progressBlock = _progressBlock;
-@synthesize bytesDownloaded = _bytesDownloaded;
-@synthesize bytesExpected = _bytesExpected;
+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
diff --git a/ObjectiveCMIS/Utils/CMISHttpRequest.h b/ObjectiveCMIS/Utils/CMISHttpRequest.h
index ca48a09..553bc5d 100644
--- a/ObjectiveCMIS/Utils/CMISHttpRequest.h
+++ b/ObjectiveCMIS/Utils/CMISHttpRequest.h
@@ -34,6 +34,13 @@
@property (nonatomic, strong) id<CMISAuthenticationProvider> authenticationProvider;
@property (nonatomic, copy) void (^completionBlock)(CMISHttpResponse *httpResponse, NSError *error);
+/**
+ * starts a URL request for given HTTP method
+ * @param requestBody (optional)
+ * @param additionalHeaders (optional)
+ * @param authenticationProvider (required)
+ * completionBlock returns a CMISHTTPResponse object or nil if unsuccessful
+ */
+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
requestBody:(NSData*)requestBody
@@ -41,11 +48,17 @@
authenticationProvider:(id<CMISAuthenticationProvider>)authenticationProvider
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/**
+ * designated initialiser. Do not use this initialiser directly. Instead use the
+ * class method startRequest:withHttpMethod:requestBody:headers:authenticationProvider:completionBlock
+ */
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
+/// starts the URL request
- (BOOL)startRequest:(NSMutableURLRequest*)urlRequest;
+/// cancel method. This may be called from a CMISRequest object
- (void)cancel;
@end
diff --git a/ObjectiveCMIS/Utils/CMISHttpRequest.m b/ObjectiveCMIS/Utils/CMISHttpRequest.m
index 1117464..5fd28e1 100644
--- a/ObjectiveCMIS/Utils/CMISHttpRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpRequest.m
@@ -40,14 +40,6 @@
@implementation CMISHttpRequest
-@synthesize requestMethod = _requestMethod;
-@synthesize requestBody = _requestBody;
-@synthesize responseBody = _responseBody;
-@synthesize additionalHeaders = _additionalHeaders;
-@synthesize response = _response;
-@synthesize authenticationProvider = _authenticationProvider;
-@synthesize completionBlock = _completionBlock;
-@synthesize connection = _connection;
+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
@@ -200,8 +192,7 @@
if ( (httpRequestMethod == HTTP_GET && response.statusCode != 200)
|| (httpRequestMethod == HTTP_POST && response.statusCode != 201)
|| (httpRequestMethod == HTTP_DELETE && response.statusCode != 204)
- || (httpRequestMethod == HTTP_PUT && ((response.statusCode < 200 || response.statusCode > 299))))
- {
+ || (httpRequestMethod == HTTP_PUT && ((response.statusCode < 200 || response.statusCode > 299)))) {
log(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
if (error) {
@@ -211,8 +202,7 @@
errorMessage = response.statusCodeMessage; // fall back to HTTP error message
}
- switch (response.statusCode)
- {
+ switch (response.statusCode) {
case 400:
if ([exception isEqualToString:kCMISExceptionFilterNotValid]) {
*error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeFilterNotValid
diff --git a/ObjectiveCMIS/Utils/CMISHttpResponse.h b/ObjectiveCMIS/Utils/CMISHttpResponse.h
index 8d2622f..40d1f56 100644
--- a/ObjectiveCMIS/Utils/CMISHttpResponse.h
+++ b/ObjectiveCMIS/Utils/CMISHttpResponse.h
@@ -25,7 +25,10 @@
@property (nonatomic, strong) NSString *statusCodeMessage;
@property (nonatomic, strong, readonly) NSData *data;
+/// wrapper for returned NSHTTPURLResponse and retrieved data
+ (CMISHttpResponse *)responseUsingURLHTTPResponse:(NSHTTPURLResponse *)HTTPURLResponse andData:(NSData *)data;
+
+/// returns a CMISHttpResponse object with HTTP status code, message headers and any response data
+ (CMISHttpResponse *)responseWithStatusCode:(int)statusCode
statusMessage:(NSString *)message
headers:(NSDictionary *)headers
diff --git a/ObjectiveCMIS/Utils/CMISHttpResponse.m b/ObjectiveCMIS/Utils/CMISHttpResponse.m
index ae0f940..fa337f8 100644
--- a/ObjectiveCMIS/Utils/CMISHttpResponse.m
+++ b/ObjectiveCMIS/Utils/CMISHttpResponse.m
@@ -29,10 +29,6 @@
@implementation CMISHttpResponse
-@synthesize statusCode = _statusCode;
-@synthesize data = _data;
-@synthesize statusCodeMessage = _statusCodeMessage;
-@synthesize responseString = _responseString;
+ (CMISHttpResponse *)responseUsingURLHTTPResponse:(NSHTTPURLResponse *)httpUrlResponse andData:(NSData *)data
{
@@ -65,7 +61,8 @@
}
-- (NSString*)exception {
+- (NSString*)exception
+{
NSString *responseString = self.responseString;
if (responseString) {
NSRange begin = [responseString rangeOfString:@"<!--exception-->"];
@@ -83,7 +80,8 @@
}
-- (NSString*)errorMessage {
+- (NSString*)errorMessage
+{
NSString *responseString = self.responseString;
if (responseString) {
NSRange begin = [responseString rangeOfString:@"<!--message-->"];
diff --git a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
index e56b9ef..a76412f 100644
--- a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
+++ b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
@@ -25,6 +25,11 @@
@property (nonatomic, assign) unsigned long long bytesExpected; // optional; if not set, expected content length from HTTP header is used
@property (nonatomic, readonly) unsigned long long bytesUploaded;
+/**
+ * starts a URL request with a provided input stream. The inputStream will be passed on to the NSMutableURLRequest by using its
+ * setHTTPBodyStream method
+ * completionBlock returns CMISHttpResponse instance or nil if unsuccessful
+ */
+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
inputStream:(NSInputStream*)inputStream
@@ -34,6 +39,7 @@
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
+/// designated initialiser. Do not call this method directly. Use the class method startRequest:withHttpMethod:inputStream:headers:bytesExpected:authenticationProvider:completionBlock:progressBlock instead
- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
diff --git a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
index 4e9dff3..0336298 100644
--- a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
@@ -29,10 +29,6 @@
@implementation CMISHttpUploadRequest
-@synthesize inputStream = _inputStream;
-@synthesize progressBlock = _progressBlock;
-@synthesize bytesExpected = _bytesExpected;
-@synthesize bytesUploaded = _bytesUploaded;
+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
withHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
diff --git a/ObjectiveCMIS/Utils/CMISObjectConverter.m b/ObjectiveCMIS/Utils/CMISObjectConverter.m
index 333cdb9..4bb8635 100644
--- a/ObjectiveCMIS/Utils/CMISObjectConverter.m
+++ b/ObjectiveCMIS/Utils/CMISObjectConverter.m
@@ -34,13 +34,11 @@
@implementation CMISObjectConverter
-@synthesize session = _session;
- (id)initWithSession:(CMISSession *)session
{
self = [super init];
- if (self)
- {
+ if (self) {
self.session = session;
}
@@ -51,12 +49,9 @@
{
CMISObject *object = nil;
- if (objectData.baseType == CMISBaseTypeDocument)
- {
+ if (objectData.baseType == CMISBaseTypeDocument) {
object = [[CMISDocument alloc] initWithObjectData:objectData withSession:self.session];
- }
- else if (objectData.baseType == CMISBaseTypeFolder)
- {
+ } else if (objectData.baseType == CMISBaseTypeFolder) {
object = [[CMISFolder alloc] initWithObjectData:objectData withSession:self.session];
}
@@ -67,8 +62,7 @@
{
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:[objects count]];
- for (CMISObjectData *object in objects)
- {
+ for (CMISObjectData *object in objects) {
[items addObject:[self convertObject:object]];
}
@@ -95,17 +89,13 @@
for (NSString *propertyId in properties) {
id propertyValue = [properties objectForKey:propertyId];
// If the value is already a CMISPropertyData, we don't need to do anything
- if ([propertyValue isKindOfClass:[CMISPropertyData class]])
- {
+ if ([propertyValue isKindOfClass:[CMISPropertyData class]]) {
[convertedProperties addProperty:(CMISPropertyData *)propertyValue];
- }
- else
- {
+ } else {
// Convert to CMISPropertyData based on the string
CMISPropertyDefinition *propertyDefinition = [typeDefinition propertyDefinitionForId:propertyId];
- if (propertyDefinition == nil)
- {
+ if (propertyDefinition == nil) {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:[NSString stringWithFormat:@"Invalid property '%@' for this object type", propertyId]];
completionBlock(nil, error);
@@ -115,10 +105,8 @@
Class expectedType = nil;
BOOL validType = YES;
- switch (propertyDefinition.propertyType)
- {
- case(CMISPropertyTypeString):
- {
+ switch (propertyDefinition.propertyType) {
+ case(CMISPropertyTypeString): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withStringValue:propertyValue]];
@@ -137,8 +125,7 @@
}
break;
}
- case(CMISPropertyTypeBoolean):
- {
+ case(CMISPropertyTypeBoolean): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
BOOL boolValue = ((NSNumber *) propertyValue).boolValue;
@@ -158,8 +145,7 @@
}
break;
}
- case(CMISPropertyTypeInteger):
- {
+ case(CMISPropertyTypeInteger): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
NSInteger intValue = ((NSNumber *) propertyValue).integerValue;
@@ -179,8 +165,7 @@
}
break;
}
- case(CMISPropertyTypeDecimal):
- {
+ case(CMISPropertyTypeDecimal): {
expectedType = [NSNumber class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withDecimalValue:propertyValue]];
@@ -199,8 +184,7 @@
}
break;
}
- case(CMISPropertyTypeId):
- {
+ case(CMISPropertyTypeId): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withIdValue:propertyValue]];
@@ -219,8 +203,7 @@
}
break;
}
- case(CMISPropertyTypeDateTime):
- {
+ case(CMISPropertyTypeDateTime): {
if ([propertyValue isKindOfClass:[NSString class]]) {
propertyValue = [CMISDateUtil dateFromString:propertyValue];
}
@@ -245,8 +228,7 @@
}
break;
}
- case(CMISPropertyTypeUri):
- {
+ case(CMISPropertyTypeUri): {
if ([propertyValue isKindOfClass:[NSString class]]) {
propertyValue = [NSURL URLWithString:propertyValue];
}
@@ -271,8 +253,7 @@
}
break;
}
- case(CMISPropertyTypeHtml):
- {
+ case(CMISPropertyTypeHtml): {
expectedType = [NSString class];
if ([propertyValue isKindOfClass:expectedType]) {
[convertedProperties addProperty:[CMISPropertyData createPropertyForId:propertyId withHtmlValue:propertyValue]];
@@ -291,8 +272,7 @@
}
break;
}
- default:
- {
+ default: {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
withDetailedDescription:[NSString stringWithFormat:@"Unsupported: cannot convert property type %d", propertyDefinition.propertyType]];
completionBlock(nil, error);
@@ -319,8 +299,7 @@
{
// Validate params
- if (!properties)
- {
+ if (!properties) {
completionBlock(nil, nil);
return;
}
diff --git a/ObjectiveCMIS/Utils/CMISStringInOutParameter.m b/ObjectiveCMIS/Utils/CMISStringInOutParameter.m
index ace8a12..ea040e9 100644
--- a/ObjectiveCMIS/Utils/CMISStringInOutParameter.m
+++ b/ObjectiveCMIS/Utils/CMISStringInOutParameter.m
@@ -22,9 +22,6 @@
@implementation CMISStringInOutParameter
-@synthesize inParameter = _inParameter;
-@synthesize outParameter = _outParameter;
-
+ (CMISStringInOutParameter *)inOutParameterUsingInParameter:(NSString *)inParameter
{
CMISStringInOutParameter *result = [[CMISStringInOutParameter alloc] init];
diff --git a/ObjectiveCMIS/Utils/CMISURLUtil.h b/ObjectiveCMIS/Utils/CMISURLUtil.h
index c811e7a..e304b9f 100644
--- a/ObjectiveCMIS/Utils/CMISURLUtil.h
+++ b/ObjectiveCMIS/Utils/CMISURLUtil.h
@@ -21,9 +21,9 @@
@interface CMISURLUtil : NSObject
-
+/// utility method to obtain a URL string
+ (NSString *)urlStringByAppendingParameter:(NSString *)parameterName withValue:(NSString *)parameterValue toUrlString:(NSString *)urlString;
-
+/// utility method to obtain a URL string
+ (NSURL *)urlStringByAppendingParameter:(NSString *)parameterName withValue:(NSString *)parameterValue toUrl:(NSURL *)url;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Utils/CMISURLUtil.m b/ObjectiveCMIS/Utils/CMISURLUtil.m
index f19aafe..4d51ff3 100644
--- a/ObjectiveCMIS/Utils/CMISURLUtil.m
+++ b/ObjectiveCMIS/Utils/CMISURLUtil.m
@@ -25,20 +25,16 @@
+ (NSString *)urlStringByAppendingParameter:(NSString *)parameterName withValue:(NSString *)parameterValue toUrlString:(NSString *)urlString
{
- if (parameterName == nil || parameterValue == nil)
- {
+ if (parameterName == nil || parameterValue == nil) {
return urlString;
}
NSMutableString *result = [NSMutableString stringWithString:urlString];
// Append '?' if not yet in url, else append ampersand
- if ([result rangeOfString:@"?"].location == NSNotFound)
- {
+ if ([result rangeOfString:@"?"].location == NSNotFound) {
[result appendString:@"?"];
- }
- else
- {
+ } else {
[result appendString:@"&"];
}
diff --git a/ObjectiveCMISTests/CMISBaseTest.m b/ObjectiveCMISTests/CMISBaseTest.m
index 20e6bd4..b8fd98b 100644
--- a/ObjectiveCMISTests/CMISBaseTest.m
+++ b/ObjectiveCMISTests/CMISBaseTest.m
@@ -25,11 +25,6 @@
@implementation CMISBaseTest
-@synthesize parameters = _parameters;
-@synthesize session = _session;
-@synthesize rootFolder = _rootFolder;
-@synthesize testCompleted = _testCompleted;
-
- (void) runTest:(CMISTestBlock)testBlock
{
@@ -50,8 +45,7 @@
NSArray *environmentArray = [environmentsDict objectForKey:@"environments"];
STAssertNotNil(environmentArray, @"environmentArray is nil!");
- for (NSDictionary *envDict in environmentArray)
- {
+ for (NSDictionary *envDict in environmentArray) {
NSString *url = [envDict valueForKey:@"url"];
NSString *repositoryId = [envDict valueForKey:@"repositoryId"];
NSString *username = [envDict valueForKey:@"username"];
@@ -80,30 +74,23 @@
self.parameters.repositoryId = repositoryId;
// Extra cmis params could be provided as method parameter
- if (extraSessionParameters != nil)
- {
- for (id extraSessionParamKey in extraSessionParameters)
- {
+ if (extraSessionParameters != nil) {
+ for (id extraSessionParamKey in extraSessionParameters) {
[self.parameters setObject:[extraSessionParameters objectForKey:extraSessionParamKey] forKey:extraSessionParamKey];
}
}
// Or, extra cmis parameters could be provided by overriding a base method
NSDictionary *customParameters = [self customCmisParameters];
- if (customParameters)
- {
- for (id customParamKey in customParameters)
- {
+ if (customParameters) {
+ for (id customParamKey in customParameters) {
[self.parameters setObject:[customParameters objectForKey:customParamKey] forKey:customParamKey];
}
}
[CMISSession connectWithSessionParameters:self.parameters completionBlock:^(CMISSession *session, NSError *error){
- if (nil == session)
- {
+ if (nil == session) {
- }
- else
- {
+ } else {
self.session = session;
STAssertTrue(self.session.isAuthenticated, @"Session should be authenticated");
[self.session retrieveRootFolderWithCompletionBlock:^(CMISFolder *rootFolder, NSError *error) {
@@ -182,8 +169,7 @@
- (void)waitForCompletion:(NSTimeInterval)timeoutSecs
{
NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:timeoutSecs];
- do
- {
+ do {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeoutDate];
} while (!self.testCompleted && [timeoutDate timeIntervalSinceNow] > 0);
diff --git a/ObjectiveCMISTests/ObjectiveCMISTests+Environment.m b/ObjectiveCMISTests/ObjectiveCMISTests+Environment.m
index e7550da..8e8eace 100644
--- a/ObjectiveCMISTests/ObjectiveCMISTests+Environment.m
+++ b/ObjectiveCMISTests/ObjectiveCMISTests+Environment.m
@@ -32,13 +32,11 @@
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *envValue = [bundle objectForInfoDictionaryKey:envKey];
- if ((nil == envValue) || ([envValue length] == 0))
- {
+ if ((nil == envValue) || ([envValue length] == 0)) {
return defaultValue;
}
- if ([defaultValue hasSuffix:@"/service/api/cmis"])
- {
+ if ([defaultValue hasSuffix:@"/service/api/cmis"]) {
// envValue = @"http://127.0.0.1:8080/alfresco/cmisatom";
}
diff --git a/ObjectiveCMISTests/ObjectiveCMISTests.m b/ObjectiveCMISTests/ObjectiveCMISTests.m
index 2779c04..7d9d21b 100644
--- a/ObjectiveCMISTests/ObjectiveCMISTests.m
+++ b/ObjectiveCMISTests/ObjectiveCMISTests.m
@@ -52,19 +52,16 @@
@implementation ObjectiveCMISTests
-@synthesize request = _request;
- (void)testRepositories
{
- [self runTest:^
- {
+ [self runTest:^ {
[CMISSession arrayOfRepositories:self.parameters completionBlock:^(NSArray *repos, NSError *error) {
STAssertNil(error, @"Error when calling arrayOfRepositories : %@", [error description]);
STAssertNotNil(repos, @"repos object should not be nil");
STAssertTrue(repos.count > 0, @"There should be at least one repository");
- for (CMISRepositoryInfo *repoInfo in repos)
- {
+ for (CMISRepositoryInfo *repoInfo in repos) {
NSLog(@"Repo id: %@", repoInfo.identifier);
}
self.testCompleted = YES;
@@ -74,8 +71,7 @@
- (void)testAuthenticateWithInvalidCredentials
{
- [self runTest:^
- {
+ [self runTest:^ {
CMISSessionParameters *bogusParams = [[CMISSessionParameters alloc] initWithBindingType:CMISBindingTypeAtomPub];
bogusParams.atomPubUrl = self.parameters.atomPubUrl;
bogusParams.repositoryId = self.parameters.repositoryId;
@@ -84,8 +80,7 @@
[CMISSession connectWithSessionParameters:bogusParams completionBlock:^(CMISSession *session, NSError *error){
STAssertNil(session, @"we should not get back a valid session");
- if (nil == session)
- {
+ if (nil == session) {
log(@"*** testAuthenticateWithInvalidCredentials: error domain is %@, error code is %d and error description is %@",[error domain], [error code], [error description]);
NSError *underlyingError = [[error userInfo] valueForKey:NSUnderlyingErrorKey];
if (underlyingError) {
@@ -99,8 +94,7 @@
- (void)testGetRootFolder
{
- [self runTest:^
- {
+ [self runTest:^ {
// make sure the repository info is available immediately after authentication
CMISRepositoryInfo *repoInfo = self.session.repositoryInfo;
STAssertNotNil(repoInfo, @"repoInfo object should not be nil");
@@ -146,8 +140,7 @@
- (void)testRetrieveFolderChildrenUsingPaging
{
- [self runTest:^
- {
+ [self runTest:^ {
// Fetch 2 children at a time
CMISOperationContext *operationContext = [CMISOperationContext defaultOperationContext];
operationContext.skipCount = 0;
@@ -163,8 +156,7 @@
// Save object ids for checking the next pages
NSMutableArray *objectIds = [NSMutableArray array];
- for (CMISObject *object in pagedResult.resultArray)
- {
+ for (CMISObject *object in pagedResult.resultArray) {
[objectIds addObject:object.identifier];
}
@@ -176,8 +168,7 @@
STAssertTrue(secondPageResult.resultArray.count == 2, @"Expected 2 children in the page, but got %d", secondPageResult.resultArray.count);
// Verify if no double object ids were found
- for (CMISObject *object in secondPageResult.resultArray)
- {
+ for (CMISObject *object in secondPageResult.resultArray) {
STAssertTrue(![objectIds containsObject:object.identifier], @"Object was already returned in a previous page. This is a serious impl bug!");
[objectIds addObject:object.identifier];
}
@@ -207,8 +198,7 @@
- (void)testDocumentProperties
{
- [self runTest:^
- {
+ [self runTest:^ {
// Get some random document
[self retrieveVersionedTestDocumentWithCompletionBlock:^(CMISDocument *document) {
@@ -242,8 +232,7 @@
- (void)testRetrieveAllowableActions
{
- [self runTest:^
- {
+ [self runTest:^ {
[self uploadTestFileWithCompletionBlock:^(CMISDocument *document) {
STAssertNotNil(document.allowableActions, @"Allowable actions should not be nil");
STAssertTrue(document.allowableActions.allowableActionsSet.count > 0, @"Expected at least one allowable action");
@@ -258,8 +247,7 @@
- (void)testFileDownload
{
- [self runTest:^
- {
+ [self runTest:^ {
[self.session retrieveObjectByPath:@"/ios-test" completionBlock:^(CMISObject *object, NSError *error) {
CMISFolder *testFolder = (CMISFolder *)object;
STAssertNil(error, @"Error while retrieving folder: %@", [error description]);
@@ -276,10 +264,8 @@
STAssertTrue([children count] >= 3, @"There should be at least 3 children");
CMISDocument *randomDoc = nil;
- for (CMISObject *object in children)
- {
- if ([object class] == [CMISDocument class])
- {
+ for (CMISObject *object in children) {
+ if ([object class] == [CMISDocument class]) {
randomDoc = (CMISDocument *)object;
}
}
@@ -315,8 +301,7 @@
- (void)testCancelDownload
{
- [self runTest:^
- {
+ [self runTest:^ {
[self.session retrieveObjectByPath:@"/ios-test/activiti-modeler.png" completionBlock:^(CMISObject *object, NSError *error) {
CMISDocument *document = (CMISDocument *)object;
STAssertNil(error, @"Error while retrieving object: %@", [error description]);
@@ -324,8 +309,7 @@
// Writing content of CMIS document to local file
NSString *filePath = [NSString stringWithFormat:@"%@/testfile", NSTemporaryDirectory()];
self.request = [document downloadContentToFile:filePath
- completionBlock:^(NSError *error)
- {
+ completionBlock:^(NSError *error) {
STAssertNotNil(error, @"Could not cancel download");
STAssertTrue(error.code == kCMISErrorCodeCancelled, @"Unexpected error: %@", [error description]);
// Assert File exists and check file length
@@ -353,8 +337,7 @@
- (void)testCreateAndDeleteDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// Check if test file exists
NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"test_file.txt" ofType:nil];
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:filePath],
@@ -370,8 +353,7 @@
[self.rootFolder createDocumentFromFilePath:filePath
withMimeType:@"text/plain"
withProperties:documentProperties
- completionBlock:^ (NSString *objectId, NSError *error)
- {
+ completionBlock:^ (NSString *objectId, NSError *error) {
if (objectId) {
STAssertNotNil(objectId, @"Object id received should be non-nil");
@@ -405,8 +387,7 @@
- (void)testUploadFileThroughSession
{
- [self runTest:^
- {
+ [self runTest:^ {
// Set properties on test file
NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"test_file.txt" ofType:nil];
@@ -422,8 +403,7 @@
withMimeType:@"text/plain"
withProperties:documentProperties
inFolder:self.rootFolder.identifier
- completionBlock: ^ (NSString *newObjectId, NSError *error)
- {
+ completionBlock: ^ (NSString *newObjectId, NSError *error) {
if (newObjectId) {
objectId = newObjectId;
@@ -455,8 +435,7 @@
- (void)testCreateBigDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// Check if test file exists
NSString *fileToUploadPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"cmis-spec-v1.0.pdf" ofType:nil];
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:fileToUploadPath],
@@ -473,8 +452,7 @@
[self.rootFolder createDocumentFromFilePath:fileToUploadPath
withMimeType:@"application/pdf"
withProperties:documentProperties
- completionBlock:^(NSString *newObjectId, NSError *error)
- {
+ completionBlock:^(NSString *newObjectId, NSError *error) {
if (newObjectId) {
NSLog(@"File upload completed");
@@ -539,8 +517,7 @@
- (void)testCreateAndDeleteFolder
{
- [self runTest:^
- {
+ [self runTest:^ {
// Create a test folder
NSMutableDictionary *properties = [NSMutableDictionary dictionary];
NSString *folderName = [NSString stringWithFormat:@"test-folder-%@", [self stringFromCurrentDate]];
@@ -567,8 +544,7 @@
- (void)testRetrieveAllVersionsOfDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// First find the document which we know that has some versions
[self retrieveVersionedTestDocumentWithCompletionBlock:^(CMISDocument *document) {
// Get all the versions of the document
@@ -578,12 +554,10 @@
// Print out the version labels and verify them, while also verifying that they are ordered by creation date, descending
NSDate *previousModifiedDate = document.lastModificationDate;
- for (CMISDocument *versionOfDocument in allVersionsOfDocument.items)
- {
+ for (CMISDocument *versionOfDocument in allVersionsOfDocument.items) {
NSLog(@"%@ - version %@", versionOfDocument.name, versionOfDocument.versionLabel);
- if (!versionOfDocument.isLatestVersion) // latest version is the one we got originally
- {
+ if (!versionOfDocument.isLatestVersion) {// latest version is the one we got originally
STAssertTrue([document.name isEqualToString:versionOfDocument.name], @"Other version of same document does not have the same name");
STAssertFalse([document.versionLabel isEqualToString:versionOfDocument.versionLabel], @"Other version of same document should have different version label");
STAssertTrue([previousModifiedDate compare:versionOfDocument.lastModificationDate] == NSOrderedDescending,
@@ -605,8 +579,7 @@
-(void)testRetrieveLatestVersionOfDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// First find the document which we know that has some versions
[self retrieveVersionedTestDocumentWithCompletionBlock:^(CMISDocument *document) {
// Check if the document retrieved is the latest version
@@ -661,8 +634,7 @@
- (void)testQueryThroughDiscoveryService
{
- [self runTest:^
- {
+ [self runTest:^ {
id<CMISDiscoveryService> discoveryService = self.session.binding.discoveryService;
STAssertNotNil(discoveryService, @"Discovery service should not be nil");
@@ -683,8 +655,7 @@
STAssertTrue(objectList.objects.count == 3, @"Expected 3 items to be returned, but was %d", objectList.objects.count);
- for (CMISObjectData *objectData in objectList.objects)
- {
+ for (CMISObjectData *objectData in objectList.objects) {
STAssertTrue(objectData.properties.propertiesDictionary.count > 10, @"Expecting properties to be passed when querying");
}
@@ -711,8 +682,7 @@
- (void)testQueryThroughSession
{
- [self runTest:^
- {
+ [self runTest:^ {
// Query all properties
[self.session query:@"SELECT * FROM cmis:document WHERE cmis:name LIKE '%quote%'" searchAllVersions:NO completionBlock:^(CMISPagedResult *result, NSError *error) {
STAssertNil(error, @"Got an error while executing query: %@", [error description]);
@@ -761,8 +731,7 @@
- (void)testQueryWithPaging
{
- [self runTest:^
- {
+ [self runTest:^ {
// Fetch first page
CMISOperationContext *context = [[CMISOperationContext alloc] init];
context.maxItemsPerPage = 5;
@@ -773,8 +742,7 @@
// Save all the ids to check them later
NSMutableArray *idsOfFirstPage = [NSMutableArray array];
- for (CMISQueryResult *queryresult in firstPageResult.resultArray)
- {
+ for (CMISQueryResult *queryresult in firstPageResult.resultArray) {
[idsOfFirstPage addObject:[queryresult propertyForId:kCMISPropertyObjectId]];
}
@@ -783,8 +751,7 @@
STAssertNil(error, @"Got an error while executing query: %@", [error description]);
STAssertTrue(secondPageResults.resultArray.count == 5, @"Expected 5 results, but got %d back", secondPageResults.resultArray.count);
- for (CMISQueryResult *queryResult in secondPageResults.resultArray)
- {
+ for (CMISQueryResult *queryResult in secondPageResults.resultArray) {
STAssertFalse([idsOfFirstPage containsObject:[queryResult propertyForId:kCMISPropertyObjectId]], @"Found same object in first and second page");
}
@@ -805,8 +772,7 @@
- (void)testQueryObjects
{
- [self runTest:^
- {
+ [self runTest:^ {
// Fetch first page
CMISOperationContext *context = [[CMISOperationContext alloc] init];
context.maxItemsPerPage = 2;
@@ -820,8 +786,7 @@
// Save all the ids to check them later
NSMutableArray *idsOfFirstPage = [NSMutableArray array];
- for (CMISDocument *document in firstPageResult.resultArray)
- {
+ for (CMISDocument *document in firstPageResult.resultArray) {
[idsOfFirstPage addObject:document.identifier];
}
@@ -843,8 +808,7 @@
- (void)testRetrieveParents
{
- [self runTest:^
- {
+ [self runTest:^ {
// First, do a query for our test document
NSString *queryStmt = @"SELECT * FROM cmis:document WHERE cmis:name = 'thumbsup-ios-test-retrieve-parents.gif'";
[self.session query:queryStmt searchAllVersions:NO completionBlock:^(CMISPagedResult *results, NSError *error) {
@@ -900,8 +864,7 @@
- (void)testRetrieveNonExistingObject
{
- [self runTest:^
- {
+ [self runTest:^ {
// test with non existing object id
[self.session retrieveObject:@"bogus" completionBlock:^(CMISObject *object, NSError *error) {
CMISDocument *document = (CMISDocument *)object;
@@ -923,8 +886,7 @@
- (void)testRetrieveObjectByPath
{
- [self runTest:^
- {
+ [self runTest:^ {
// Use a document that has spaces in them (should be correctly encoded)
NSString *path = [NSString stringWithFormat:@"%@ios-test/activiti logo big.png", self.rootFolder.path];
[self.session retrieveObjectByPath:path completionBlock:^(CMISObject *object, NSError *error) {
@@ -951,8 +913,7 @@
// And verify of the content is correct
- (void)testChangeContentOfDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// Upload test file
[self uploadTestFileWithCompletionBlock:^(CMISDocument *originalDocument) {
// Change content of test file using overwrite
@@ -1009,8 +970,7 @@
- (void)testDeleteContentOfDocument
{
- [self runTest:^
- {
+ [self runTest:^ {
// Upload test file
[self uploadTestFileWithCompletionBlock:^(CMISDocument *originalDocument) {
// Delete its content
@@ -1034,8 +994,7 @@
- (void)testRetrieveTypeDefinition
{
- [self runTest:^
- {
+ [self runTest:^ {
[self.session.binding.repositoryService retrieveTypeDefinition:@"cmis:document" completionBlock:^(CMISTypeDefinition *typeDefinition, NSError *error) {
STAssertNil(error, @"Got error while retrieving type definition: %@", [error description]);
@@ -1070,8 +1029,7 @@
- (void)testUpdateDocumentPropertiesThroughObjectService
{
- [self runTest:^
- {
+ [self runTest:^ {
id<CMISObjectService> objectService = self.session.binding.objectService;
// Create test document
@@ -1104,8 +1062,7 @@
- (void)testUpdateFolderPropertiesThroughObjectService
{
- [self runTest:^
- {
+ [self runTest:^ {
// Create a temporary test folder
NSMutableDictionary *properties = [NSMutableDictionary dictionary];
NSString *folderName = [NSString stringWithFormat:@"temp_test_folder_%@", [self stringFromCurrentDate]];
@@ -1145,8 +1102,7 @@
- (void)testUpdatePropertiesThroughCmisObject
{
- [self runTest:^
- {
+ [self runTest:^ {
// Create test document
[self uploadTestFileWithCompletionBlock:^(CMISDocument *document) {
// Prepare properties
@@ -1179,12 +1135,9 @@
STAssertTrue(extElement.attributes.count == expectedAttrCount, @"Expected %d attributes, but found %d", expectedAttrCount, extElement.attributes.count);
STAssertTrue(extElement.children.count == expectedChildCount, @"Expected %d children elements but found %d", expectedChildCount, extElement.children.count);
- if (extElement.children.count > 0)
- {
+ if (extElement.children.count > 0) {
STAssertNil(extElement.value, @"Extension Element value must by nil but value contained '%@'", extElement.value);
- }
- else if (hasValue)
- {
+ } else if (hasValue) {
STAssertTrue(extElement.value.length > 0, @"Expected extension element value to be non-empty");
}
}
@@ -1194,8 +1147,7 @@
{
// Testing FolderChildren, executed at end
- void (^testFolderChildrenXml)(NSString *, BOOL) = ^(NSString * filename, BOOL isOpenCmisImpl)
- {
+ void (^testFolderChildrenXml)(NSString *, BOOL) = ^(NSString * filename, BOOL isOpenCmisImpl) {
NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:filename ofType:@"xml"];
NSData *atomData = [[NSData alloc] initWithContentsOfFile:filePath];
STAssertNotNil(atomData, @"FolderChildren.xml is missing from the test target!");
@@ -1207,8 +1159,7 @@
NSArray *entries = feedParser.entries;
STAssertTrue(entries.count == 2, @"Expected 2 parsed entry objects, but found %d", entries.count);
- for (CMISObjectData *objectData in entries)
- {
+ for (CMISObjectData *objectData in entries) {
// Check that there are no extension elements on the Object and allowable actions objects
STAssertTrue(objectData.extensions.count == 0, @"Expected 0 extension elements, but found %d", objectData.extensions.count);
STAssertTrue(objectData.allowableActions.extensions.count == 0, @"Expected 0 extension elements, but found %d", objectData.allowableActions.extensions.count);
@@ -1224,36 +1175,28 @@
childrenCount:expectedAspectsExtChildrenCt hasValue:NO];
int aspectChildCt = 0;
- for (CMISExtensionElement *aspectChild in extElement.children)
- {
- switch (aspectChildCt ++)
- {
+ for (CMISExtensionElement *aspectChild in extElement.children) {
+ switch (aspectChildCt ++) {
case 0:
case 1:
case 2:
- case 3:
- {
+ case 3: {
// appliedAspects
[self checkExtensionElement:aspectChild withName:@"appliedAspects" namespaceUri:@"http://www.alfresco.org" attributeCount:0 childrenCount:0 hasValue:YES];
break;
}
- case 4:
- {
+ case 4: {
STAssertFalse(isOpenCmisImpl, @"Unexpected extension element encountered!");
// alf:properties
[self checkExtensionElement:aspectChild withName:@"properties" namespaceUri:@"http://www.alfresco.org" attributeCount:0 childrenCount:3 hasValue:NO];
- for (CMISExtensionElement *aspectPropExt in aspectChild.children)
- {
- if (aspectPropExt.children)
- {
+ for (CMISExtensionElement *aspectPropExt in aspectChild.children) {
+ if (aspectPropExt.children) {
[self checkExtensionElement:aspectPropExt withName:@"propertyString" namespaceUri:kCMISNamespaceCmis attributeCount:3 childrenCount:1 hasValue:NO];
CMISExtensionElement *valueExt = aspectPropExt.children.lastObject;
[self checkExtensionElement:valueExt withName:@"value" namespaceUri:kCMISNamespaceCmis attributeCount:0 childrenCount:0 hasValue:YES];
- }
- else
- {
+ } else {
[self checkExtensionElement:aspectPropExt withName:@"propertyString" namespaceUri:kCMISNamespaceCmis attributeCount:3 childrenCount:0 hasValue:NO];
}
@@ -1286,8 +1229,7 @@
static NSString *exampleUri = @"http://www.example.com";
// Local Blocks
- void (^testSimpleRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement)
- {
+ void (^testSimpleRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement) {
[self checkExtensionElement:rootExtElement withName:@"testExtSimpleRoot" namespaceUri:exampleUri attributeCount:0 childrenCount:1 hasValue:NO];
CMISExtensionElement *simpleChildExtElement = rootExtElement.children.lastObject;
@@ -1295,8 +1237,7 @@
STAssertTrue([simpleChildExtElement.value isEqualToString:@"simpleChildValue"], @"Expected value 'simpleChildValue' but was '%@'", simpleChildExtElement.value);
};
- void (^testComplexRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement)
- {
+ void (^testComplexRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement) {
[self checkExtensionElement:rootExtElement withName:@"testExtRoot" namespaceUri:exampleUri attributeCount:0 childrenCount:5 hasValue:NO];
// Children Depth=1
[self checkExtensionElement:[rootExtElement.children objectAtIndex:0] withName:@"testExtChildLevel1A" namespaceUri:exampleUri attributeCount:0 childrenCount:0 hasValue:YES];
@@ -1325,8 +1266,7 @@
NSArray *entries = feedParser.entries;
STAssertTrue(entries.count == 2, @"Expected 2 parsed entry objects, but found %d", entries.count);
- for (CMISObjectData *objectData in entries)
- {
+ for (CMISObjectData *objectData in entries) {
STAssertTrue(objectData.extensions.count == 2, @"Expected 2 extension elements, but found %d", objectData.extensions.count);
testSimpleRootExtensionElement([objectData.extensions objectAtIndex:0]);
testComplexRootExtensionElement([objectData.extensions objectAtIndex:1]);
@@ -1348,8 +1288,7 @@
static NSString *exampleUri = @"http://www.example.com";
// Local Blocks
- void (^testSimpleRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement)
- {
+ void (^testSimpleRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement) {
[self checkExtensionElement:rootExtElement withName:@"testExtSimpleRoot" namespaceUri:exampleUri attributeCount:0 childrenCount:1 hasValue:NO];
CMISExtensionElement *simpleChildExtElement = rootExtElement.children.lastObject;
@@ -1357,8 +1296,7 @@
STAssertTrue([simpleChildExtElement.value isEqualToString:@"simpleChildValue"], @"Expected value 'simpleChildValue' but was '%@'", simpleChildExtElement.value);
};
- void (^testComplexRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement)
- {
+ void (^testComplexRootExtensionElement)(CMISExtensionElement *) = ^(CMISExtensionElement *rootExtElement) {
[self checkExtensionElement:rootExtElement withName:@"testExtRoot" namespaceUri:exampleUri attributeCount:0 childrenCount:5 hasValue:NO];
// Children Depth=1
[self checkExtensionElement:[rootExtElement.children objectAtIndex:0] withName:@"testExtChildLevel1A" namespaceUri:exampleUri attributeCount:0 childrenCount:0 hasValue:YES];
@@ -1435,8 +1373,7 @@
- (void)testPropertiesConversion
{
- [self runTest:^
- {
+ [self runTest:^ {
NSDate *testDate = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitflags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
@@ -1520,8 +1457,7 @@
- (void)testOperationContextForRetrievingObject
{
- [self runTest:^
- {
+ [self runTest:^ {
// Create some test document
[self uploadTestFileWithCompletionBlock:^(CMISDocument *testDocument) {
// Use YES for retrieving the allowable actions
@@ -1554,8 +1490,7 @@
- (void)testGetRenditionsThroughCmisObject
{
- [self runTest:^
- {
+ [self runTest:^ {
// Fetch test document
NSString *path = [NSString stringWithFormat:@"%@ios-test/test-word-doc.docx", self.rootFolder.path];
CMISOperationContext *operationContext = [CMISOperationContext defaultOperationContext];
@@ -1568,10 +1503,8 @@
NSArray *renditions = document.renditions;
STAssertTrue(renditions.count > 0, @"Expected at least one rendition");
CMISRendition *thumbnailRendition = nil;
- for (CMISRendition *rendition in renditions)
- {
- if ([rendition.kind isEqualToString:@"cmis:thumbnail"])
- {
+ for (CMISRendition *rendition in renditions) {
+ if ([rendition.kind isEqualToString:@"cmis:thumbnail"]) {
thumbnailRendition = rendition;
}
}
@@ -1607,8 +1540,7 @@
- (void)testGetRenditionsThroughObjectService
{
- [self runTest:^
- {
+ [self runTest:^ {
// Fetch test document
NSString *path = [NSString stringWithFormat:@"%@ios-test/test-word-doc.docx", self.rootFolder.path];
CMISOperationContext *operationContext = [CMISOperationContext defaultOperationContext];
@@ -1627,10 +1559,8 @@
STAssertNil(error, @"Error while retrieving renditions: %@", [error description]);
STAssertTrue(renditions.count > 0, @"Expected at least one rendition");
CMISRenditionData *thumbnailRendition = nil;
- for (CMISRenditionData *rendition in renditions)
- {
- if ([rendition.kind isEqualToString:@"cmis:thumbnail"])
- {
+ for (CMISRenditionData *rendition in renditions) {
+ if ([rendition.kind isEqualToString:@"cmis:thumbnail"]) {
thumbnailRendition = rendition;
}
}