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

Save children in the persistent entity

SVN: 27158
parent 6fa71126
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
@property (nonatomic, retain) NSString * refcon; @property (nonatomic, retain) NSString * refcon;
@property (nonatomic, retain) NSString * group; @property (nonatomic, retain) NSString * group;
@property (nonatomic, retain) NSString * imageUrl; @property (nonatomic, retain) NSString * imageUrl;
@property (nonatomic, retain) NSString * childrenPermIdsJson;
@property (nonatomic, retain) NSArray * childrenPermIds;
@property (nonatomic, retain) NSString * propertiesJson; @property (nonatomic, retain) NSString * propertiesJson;
@property (readonly) NSArray * properties; @property (readonly) NSArray * properties;
...@@ -46,3 +50,5 @@ ...@@ -46,3 +50,5 @@
- (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity; - (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity;
@end @end
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
@dynamic refcon; @dynamic refcon;
@dynamic group; @dynamic group;
@dynamic imageUrl; @dynamic imageUrl;
@dynamic childrenPermIdsJson;
@dynamic propertiesJson; @dynamic propertiesJson;
- (NSArray *)properties - (NSArray *)properties
...@@ -61,6 +62,25 @@ ...@@ -61,6 +62,25 @@
return properties; return properties;
} }
- (NSArray *)childrenPermIds
{
[self willAccessValueForKey: @"childrenPermIds"];
NSArray *childrenPermIds = [self primitiveValueForKey: @"childrenPermIds"];
[self didAccessValueForKey: @"childrenPermIds"];
if (nil == childrenPermIds) {
NSError *error;
NSArray *childrenPermIds = [NSJSONSerialization JSONObjectWithData: [self.propertiesJson dataUsingEncoding: NSASCIIStringEncoding] options: 0 error: &error];
if (error) {
NSLog(@"Could not deserialize childrenPermIds %@", error);
}
[self setPrimitiveValue: childrenPermIds forKey: @"childrenPermIds"];
}
return childrenPermIds;
}
- (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity - (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity
{ {
self.summaryHeader = rawEntity.summaryHeader; self.summaryHeader = rawEntity.summaryHeader;
...@@ -70,6 +90,7 @@ ...@@ -70,6 +90,7 @@
self.refcon = rawEntity.refcon; self.refcon = rawEntity.refcon;
self.group = rawEntity.group; self.group = rawEntity.group;
self.imageUrl = rawEntity.imageUrl; self.imageUrl = rawEntity.imageUrl;
self.childrenPermIdsJson = rawEntity.children;
self.propertiesJson = rawEntity.properties; self.propertiesJson = rawEntity.properties;
} }
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1810" systemVersion="11G56" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> <model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1810" systemVersion="11G56" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="CISDOBIpadEntity" representedClassName="CISDOBIpadEntity" syncable="YES"> <entity name="CISDOBIpadEntity" representedClassName="CISDOBIpadEntity" syncable="YES">
<attribute name="childrenPermIds" optional="YES" transient="YES" syncable="YES"/>
<attribute name="childrenPermIdsJson" optional="YES" attributeType="String" indexed="YES" syncable="YES"/>
<attribute name="group" optional="YES" attributeType="String" indexed="YES" syncable="YES"/> <attribute name="group" optional="YES" attributeType="String" indexed="YES" syncable="YES"/>
<attribute name="identifier" optional="YES" attributeType="String" indexed="YES" syncable="YES"/> <attribute name="identifier" optional="YES" attributeType="String" indexed="YES" syncable="YES"/>
<attribute name="imageUrl" optional="YES" attributeType="String" syncable="YES"/> <attribute name="imageUrl" optional="YES" attributeType="String" syncable="YES"/>
...@@ -11,7 +13,8 @@ ...@@ -11,7 +13,8 @@
<attribute name="summary" optional="YES" attributeType="String" syncable="YES"/> <attribute name="summary" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="summaryHeader" optional="YES" attributeType="String" syncable="YES"/> <attribute name="summaryHeader" optional="YES" attributeType="String" syncable="YES"/>
</entity> </entity>
<fetchRequest name="PermIdFetch" entity="CISDOBIpadEntity" predicateString="permId in PERM_ID"/>
<elements> <elements>
<element name="CISDOBIpadEntity" positionX="160" positionY="192" width="128" height="180"/> <element name="CISDOBIpadEntity" positionX="160" positionY="192" width="128" height="210"/>
</elements> </elements>
</model> </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