def create_new_structure(database, structure, setup=False): """Creates the passed structure, adding it to the dictionary. Optionally allows for setup keys to be included in the stored object (if stored from filesystem or other, for example.) """ if type(database) in [dict, OrderedDict]: database = database['database'] structure_maker = structure_model.make_structure_closure(setup=setup) new_structure = structure_maker(structure) new_structure = structure_dao.add_structure(database, new_structure) return new_structure
def add_structures_from_filesystem(database, profile=None): """Adds all structures in a filesystem. Uses the default profile or gets the profile that is specified by the user. """ profile = profile_processor.get_fully_qualified_profile(database, profile) structure_directory = profile['structures'] structures = get_structures_from_filesystem(structure_directory) structure_tool = structure_model.make_structure_closure(utils.get_timestamp()) structures = map(structure_tool, structures) create_structure_collection(database, structures) structures = get_current_structures(database) return structures
def add_structures_from_filesystem(database, profile=None): """Adds all structures in a filesystem. Uses the default profile or gets the profile that is specified by the user. """ profile = profile_processor.get_fully_qualified_profile(database, profile) structure_directory = profile['structures'] structures = get_structures_from_filesystem(structure_directory) structure_tool = structure_model.make_structure_closure(general_utils.get_timestamp()) structures = list(map(structure_tool, structures)) create_structure_collection(database, structures) structures = get_current_structures(database) return structures