Skip to content
Snippets Groups Projects
Commit 32bd3e03 authored by cramakri's avatar cramakri
Browse files

Made initializing an entity from a raw entity more robust

SVN: 27271
parent f2497e91
No related merge requests found
......@@ -89,15 +89,18 @@
- (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity
{
// These will always be non-nil
self.permId = rawEntity.permId;
self.refcon = rawEntity.refcon;
self.category = rawEntity.category;
self.summaryHeader = rawEntity.summaryHeader;
self.summary = rawEntity.summary;
self.childrenPermIdsJson = rawEntity.children;
// self.identifier = rawEntity.identifier;
// self.imageUrl = rawEntity.imageUrl;
// self.propertiesJson = rawEntity.properties;
// Need to check if these values were transmitted with the raw entity
if (rawEntity.category) self.category = rawEntity.category;
if (rawEntity.summaryHeader) self.summaryHeader = rawEntity.summaryHeader;
if (rawEntity.summary) self.summary = rawEntity.summary;
if (rawEntity.children) self.childrenPermIdsJson = rawEntity.children;
if (rawEntity.identifier) self.identifier = rawEntity.identifier;
if (rawEntity.imageUrl) self.imageUrl = rawEntity.imageUrl;
if (rawEntity.properties) self.propertiesJson = rawEntity.properties;
}
@end
......@@ -211,7 +211,10 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain";
- (NSString *)stringContentValueAtName:(NSString *)name
{
// Look up the index in the map
NSUInteger index = [[_fieldMap objectForKey: name] unsignedIntegerValue];
NSNumber *indexHolder = [_fieldMap objectForKey: name];
// This value was not provided
if (!indexHolder) return nil;
NSUInteger index = [indexHolder unsignedIntegerValue];
return [[_content objectAtIndex: index] objectForKey: @"value"];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment