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

Made refcon an id property, not a string

SVN: 27275
parent 5f462c55
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,8 @@
// Non-nil properties
@property (nonatomic, retain) NSString * permId;
@property (nonatomic, retain) NSString * refcon;
@property (nonatomic, retain) NSString * refconJson;
@property (readonly) id refcon;
// Potentially nil properties
@property (nonatomic, retain) NSString * summaryHeader;
......
......@@ -31,7 +31,7 @@
@dynamic summary;
@dynamic identifier;
@dynamic permId;
@dynamic refcon;
@dynamic refconJson;
@dynamic category;
@dynamic imageUrl;
@dynamic childrenPermIdsJson;
......@@ -40,6 +40,24 @@
@synthesize image;
- (id)refcon
{
[self willAccessValueForKey: @"refcon"];
id refcon = [self primitiveValueForKey: @"refcon"];
[self didAccessValueForKey: @"refcon"];
if (nil == refcon) {
NSError *error;
id refcon = [NSJSONSerialization JSONObjectWithData: [self.refconJson dataUsingEncoding: NSASCIIStringEncoding] options: 0 error: &error];
if (error) {
NSLog(@"Could not deserialize refcon %@", error);
}
[self setPrimitiveValue: refcon forKey: @"refcon"];
}
return refcon;
}
- (NSArray *)properties
{
[self willAccessValueForKey: @"properties"];
......@@ -92,7 +110,7 @@
{
// These will always be non-nil
self.permId = rawEntity.permId;
self.refcon = rawEntity.refcon;
self.refconJson = rawEntity.refcon;
// Need to check if these values were transmitted with the raw entity
if (rawEntity.category) self.category = rawEntity.category;
......
......@@ -9,7 +9,8 @@
<attribute name="permId" optional="YES" attributeType="String" indexed="YES" syncable="YES"/>
<attribute name="properties" optional="YES" transient="YES" syncable="YES"/>
<attribute name="propertiesJson" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="refcon" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="refcon" optional="YES" transient="YES" syncable="YES"/>
<attribute name="refconJson" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="rootLevel" optional="YES" attributeType="Boolean" syncable="YES"/>
<attribute name="summary" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="summaryHeader" optional="YES" attributeType="String" syncable="YES"/>
......@@ -17,6 +18,6 @@
<fetchRequest name="EntitiesByPermIds" entity="CISDOBIpadEntity" predicateString="permId IN $PERM_IDS" fetchBatchSize="20"/>
<fetchRequest name="EntityAndChildren" entity="CISDOBIpadEntity" predicateString="SELF == $ENTITY OR permId IN $CHILDREN" fetchBatchSize="20"/>
<elements>
<element name="CISDOBIpadEntity" positionX="0" positionY="0" width="128" height="225"/>
<element name="CISDOBIpadEntity" positionX="0" positionY="0" width="128" height="240"/>
</elements>
</model>
\ No newline at end of file
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