def _add_named_elements(self, type_name, model_nodes, location): """ Add each named element from the specified nodes in WLST and set its attributes. Sub-folders are processed in a generic manner if present. It is assumed that there are no attributes or sub-folders with special processing. :param type_name: the type name of the child nodes :param model_nodes: the child nodes of a model element :param location: the location where elements should be added """ _method_name = '_add_named_elements' if len(model_nodes) == 0: return parent_type, parent_name = self.get_location_type_and_name(location) location = LocationContext(location).append_location(type_name) if not self._check_location(location): return deployer_utils.check_flattened_folder(location, self.alias_helper) existing_names = deployer_utils.get_existing_object_list(location, self.alias_helper) token = self.alias_helper.get_name_token(location) for name in model_nodes: is_add = name not in existing_names log_helper.log_updating_named_folder(type_name, name, parent_type, parent_name, is_add, self._class_name, _method_name) if token is not None: location.add_name_token(token, name) deployer_utils.create_and_cd(location, existing_names, self.alias_helper) child_nodes = dictionary_utils.get_dictionary_element(model_nodes, name) self._set_attributes_and_add_subfolders(location, child_nodes) return
def _add_model_elements(self, type_name, model_nodes, location): """ Add each model element from the specified nodes at the specified location and set its attributes. :param model_nodes: the child nodes of a model element :param location: the location where sub-folders should be added :param type_name: the name of the model folder to add """ _method_name = '_add_model_elements' parent_type, parent_name = self.get_location_type_and_name(location) location = LocationContext(location).append_location(type_name) if not self._check_location(location): return deployer_utils.check_flattened_folder(location, self.alias_helper) existing_subfolder_names = deployer_utils.get_existing_object_list(location, self.alias_helper) mbean_name = deployer_utils.get_mbean_name(location, existing_subfolder_names, self.alias_helper) is_add = mbean_name not in existing_subfolder_names log_helper.log_updating_folder(type_name, parent_type, parent_name, is_add, self._class_name, _method_name) deployer_utils.create_and_cd(location, existing_subfolder_names, self.alias_helper) self._set_attributes_and_add_subfolders(location, model_nodes) return