def add_project_reference(self, project_uuid, project: MetadataEntity = None): if project: project.object_id = project_uuid project.is_linking_reference = True project.is_reference = True else: project = MetadataEntity(domain_type=_PROJECT_TYPE, concrete_type=_PROJECT_TYPE, object_id=project_uuid, is_linking_reference=True) self.add_submittable(project)
def add_submittable(self, metadata: MetadataEntity): # TODO no test to check case sensitivity domain_type = metadata.domain_type.lower() type_map = self._submittable_registry.get(domain_type) if not type_map: type_map = {} self._submittable_registry[domain_type] = type_map if domain_type.lower() == _PROJECT_TYPE: if not type_map.get(_PROJECT_ID): metadata.object_id = _PROJECT_ID else: raise MultipleProjectsFound() type_map[metadata.object_id] = metadata
def apply(self, metadata: MetadataEntity, cell_data): value = self.converter.convert(cell_data) metadata.object_id = metadata.object_id or value if not metadata.is_module: metadata.define_content(self.applied_field, value)
def apply(self, metadata: MetadataEntity, cell_data): value = self.converter.convert(cell_data) metadata.is_reference = True metadata.object_id = value
def apply(self, metadata: MetadataEntity, cell_data): value = self.converter.convert(cell_data) metadata.object_id = value metadata.define_content(self.applied_field, value)
def add_module(self, metadata: MetadataEntity): if metadata.domain_type.lower() == 'project': metadata.object_id = self.project_id self._module_list.append(metadata)