def prototype_elements(self): left_association = DatasetCollectionElement( element=HistoryDatasetAssociation(), element_identifier=FORWARD_IDENTIFIER, ) right_association = DatasetCollectionElement( element=HistoryDatasetAssociation(), element_identifier=REVERSE_IDENTIFIER, ) yield left_association yield right_association
def generate_elements(self, elements): forward_dataset = elements.get(FORWARD_IDENTIFIER) reverse_dataset = elements.get(REVERSE_IDENTIFIER) if forward_dataset: left_association = DatasetCollectionElement( element=forward_dataset, element_identifier=FORWARD_IDENTIFIER, ) yield left_association if reverse_dataset: right_association = DatasetCollectionElement( element=reverse_dataset, element_identifier=REVERSE_IDENTIFIER, ) yield right_association
def generate_elements(self, elements): forward_dataset = elements.get(FORWARD_IDENTIFIER, None) reverse_dataset = elements.get(REVERSE_IDENTIFIER, None) if not forward_dataset or not reverse_dataset: self._validation_failed(INVALID_IDENTIFIERS_MESSAGE) left_association = DatasetCollectionElement( element=forward_dataset, element_identifier=FORWARD_IDENTIFIER, ) right_association = DatasetCollectionElement( element=reverse_dataset, element_identifier=REVERSE_IDENTIFIER, ) yield left_association yield right_association
def build_collection(self, elements): forward_dataset = elements.get(FORWARD_IDENTIFIER, None) reverse_dataset = elements.get(REVERSE_IDENTIFIER, None) if not forward_dataset or not reverse_dataset: self._validation_failed(INVALID_IDENTIFIERS_MESSAGE) left_association = DatasetCollectionElement( element=forward_dataset, element_identifier=FORWARD_IDENTIFIER, ) right_association = DatasetCollectionElement( element=reverse_dataset, element_identifier=REVERSE_IDENTIFIER, ) return self._new_collection_for_elements( [left_association, right_association])
def generate_elements( self, elements ): for identifier, element in elements.iteritems(): association = DatasetCollectionElement( element=element, element_identifier=identifier, ) yield association
def build_collection(self, elements): associations = [] for identifier, element in elements.iteritems(): association = DatasetCollectionElement( element=element, element_identifier=identifier, ) associations.append(association) return self._new_collection_for_elements(associations)