def make_records_from_translator(database, translator, profile=None, parameters=None): """Makes records for the given translator. Accepts an optional profile to override the default profile, and a parameters dictionary to override parameters that are expected from the template that may or may not be provided by the translator. """ translator = processor_utils.get_fully_qualified_paths(database, translator, profile=profile) template = template_processor.get_template_by_name(translator['structure'], translator['template']) return template
def get_all_records_for_template(database, template): """Returns all the records for the given template. """ if type(template) in [dict, OrderedDict]: collection = template['collection'] else: template = template_processor.get_template_by_name(template) collection = template['collection'] return record_dao.get_all_records(database, collection)
def make_records_from_filesystem(translator): """This method gathers and adds filesystem records to the structure for the translator. It adds relevant information to each record that it returns, based on association and ability information from the template and structure. It returns the added records. """ translator = processor_utils.get_fully_qualified_paths(database, translator, profile=profile) records = get_records_from_filesystem(translator) template = template_processor.get_template_by_name(translator['structure'], translator['template']) record_maker = record_model.make_record_closure(template, translator, general_utils.get_timestamp()) records = list(map(record_maker, records)) return records
def make_records_from_filesystem(translator): """This method gathers and adds filesystem records to the structure for the translator. It adds relevant information to each record that it returns, based on association and ability information from the template and structure. It returns the added records. """ translator = processor_utils.get_fully_qualified_paths(database, translator, profile=profile) records = get_records_from_filesystem(translator) template = template_processor.get_template_by_name(translator['structure'], translator['template']) record_maker = record_model.make_record_closure(template, translator, utils.get_timestamp()) records = map(record_maker, records) return records