def _restoreWithLinkages(self, vfile): """ restore validation results in vfile, reestablish linkages to project objects """ vdata, metadeta = jsonTools.json2obj(vfile, self.project) if vdata is None: io.error('ValidationData._restoreWithLinkages: unable to restore objects from "{0}"\n', vfile) return True #end if for result in vdata: #print 'ValidationData.restore> ', result obj = self.project.getByPid(result[constants.OBJECT_KEY]) if obj is None: io.error('ValidationData._restoreWithLinkages: unable to decode pid "{0} (file {1})"\n', result[constants.OBJECT_KEY], vfile ) return True #end if self.project.validationData.setResult(obj, result.KEY, result) #end for return False
def _restoreWithoutLinkages(self, vfile): """ restore validation results in vfile, do not decode pid's into linkages Add containers to self.data when needed """ # everything is maintained as pid's vdata, metadeta = jsonTools.json2obj(vfile) if vdata is None: io.error('ValidationData._restoreWithoutLinkages: unable to restore objects from "{0}"\n', vfile) return True for result in vdata: # check for the presence of appropriate container objPid = result[constants.OBJECT_KEY] if objPid in self.data: container = self.data[objPid] else: container = ValidationResultsContainer() self.data[objPid] = container #end if container[result.KEY] = result