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

CCS-30 SP-488 : Improved management and refreshing of cached data.

SVN: 28314
parent 040adc2c
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
- (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity; - (void)initializeFromRawEntity:(CISDOBIpadRawEntity *)rawEntity;
- (void)updateFromRawEntity:(CISDOBIpadRawEntity *)rawEntity; - (void)updateFromRawEntity:(CISDOBIpadRawEntity *)rawEntity;
//! There can be multiple instances of the same object. CoreData keeps the persistent information consistent, but the locally cached information can become inconsistent. Call this to update the cached information.
- (void)refreshCachedInformation;
@end @end
...@@ -167,4 +167,15 @@ id ObjectFromJsonData(NSString *jsonDataString, NSError **error) ...@@ -167,4 +167,15 @@ id ObjectFromJsonData(NSString *jsonDataString, NSError **error)
} }
} }
- (void)refreshCachedInformation
{
[self willChangeValueForKey: @"childrenPermIds"];
[self setPrimitiveValue: nil forKey: @"childrenPermIds"];
[self didChangeValueForKey: @"childrenPermIds"];
[self willChangeValueForKey: @"properties"];
[self setPrimitiveValue: nil forKey: @"properties"];
[self didChangeValueForKey: @"properties"];
}
@end @end
...@@ -3,6 +3,8 @@ from ch.systemsx.cisd.openbis.generic.shared.basic.dto import MaterialIdentifier ...@@ -3,6 +3,8 @@ from ch.systemsx.cisd.openbis.generic.shared.basic.dto import MaterialIdentifier
from com.fasterxml.jackson.databind import ObjectMapper from com.fasterxml.jackson.databind import ObjectMapper
from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria, SearchSubCriteria from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria, SearchSubCriteria
from datetime import datetime
# #
# BEGIN Infrastructure # BEGIN Infrastructure
# #
...@@ -305,7 +307,7 @@ def sample_to_dict(five_ht_sample, material_by_perm_id, data_sets, sample_type_p ...@@ -305,7 +307,7 @@ def sample_to_dict(five_ht_sample, material_by_perm_id, data_sets, sample_type_p
prop_names = set(["DESC"]) prop_names = set(["DESC"])
property_definitions = sample_type_properties_definitions.get(five_ht_sample.getSampleType(), []) property_definitions = sample_type_properties_definitions.get(five_ht_sample.getSampleType(), [])
properties = properties_for_entity(five_ht_sample, property_definitions, prop_names) properties = properties_for_entity(five_ht_sample, property_definitions, prop_names)
properties.append({'key' : 'TIMESTAMP', 'label' : 'Timestamp', 'value' : datetime.today().strftime('%Y-%m-%d %H:%M:%S')})
sample_dict['PROPERTIES'] = json_encoded_value(properties) sample_dict['PROPERTIES'] = json_encoded_value(properties)
sample_dict['ROOT_LEVEL'] = None sample_dict['ROOT_LEVEL'] = None
# Need to handle the material links as entity links: "TARGET", "COMPOUND" # Need to handle the material links as entity links: "TARGET", "COMPOUND"
......
...@@ -163,6 +163,7 @@ ...@@ -163,6 +163,7 @@
SuccessBlock localSuccess = success; SuccessBlock localSuccess = success;
call.success = ^(id result) { call.success = ^(id result) {
// Update the UI // Update the UI
[_selectedObject refreshCachedInformation];
localSuccess(_selectedObject); localSuccess(_selectedObject);
}; };
[call start]; [call start];
...@@ -172,10 +173,11 @@ ...@@ -172,10 +173,11 @@
- (void)syncSelectedObjectForNavigationOnSuccess:(SuccessBlock)success - (void)syncSelectedObjectForNavigationOnSuccess:(SuccessBlock)success
{ {
// Call the server to get the children. // Call the server to get the children.
CISDOBAsyncCall *call = [self.serviceManager imagesForEntity: _selectedObject]; CISDOBAsyncCall *call = [self.serviceManager drillOnEntity: _selectedObject];
// Assign this to a local var to get the compiler to copy it // Assign this to a local var to get the compiler to copy it
SuccessBlock localSuccess = success; SuccessBlock localSuccess = success;
call.success = ^(id result) { call.success = ^(id result) {
[_selectedObject refreshCachedInformation];
localSuccess(_selectedObject); localSuccess(_selectedObject);
}; };
[call start]; [call start];
...@@ -234,7 +236,7 @@ ...@@ -234,7 +236,7 @@
[self applyStandardSortDescriptorsToFetchRequest: fetchRequest]; [self applyStandardSortDescriptorsToFetchRequest: fetchRequest];
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest: fetchRequest managedObjectContext: self.managedObjectContext sectionNameKeyPath: @"category" cacheName: _parentModel.selectedObject.permId]; NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest: fetchRequest managedObjectContext: self.managedObjectContext sectionNameKeyPath: @"category" cacheName: nil];
aFetchedResultsController.delegate = self; aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController; self.fetchedResultsController = aFetchedResultsController;
......
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