Skip to content
Snippets Groups Projects
Commit 640f727b authored by imcovangent's avatar imcovangent
Browse files

Added new method add_dc() to CMDOWS class (used in KE-chain projects).

Former-commit-id: 8124861c35228c9c429225dd8432ff1a05e70f7c
parent 22e5aec3
No related branches found
No related tags found
No related merge requests found
......@@ -301,6 +301,32 @@ class CMDOWS(object):
raise IOError('Invalid type for roles provided: {}.'.format(type(roles)))
return
def add_dc(self, uid, id, mode_id, instance_id, version, label):
"""Method to add a designCompetence element to the designCompetences branch."""
# Assert that there is a path to the designCompetences element or add one
parent_element = self.ensure_abs_xpath('/cmdows/executableBlocks/designCompetences')
# Assert that there is no existing element with the uid
try:
self.get_element_of_uid(uid)
raise AssertionError(
'UID {} is already used in the CMDOWS file at {}'.format(uid, self.get_xpath_of_uid(uid)))
except:
pass
# Add the design competence details
dc_element = Element('designCompetence', uID=uid)
dc_element.add('ID', id)
dc_element.add('modeID', mode_id)
dc_element.add('instanceID', instance_id)
dc_element.add('version', version)
dc_element.add('label', label)
parent_element.append(dc_element)
return
def add_dc_general_info(self, dc_uid, description, status=None, creation_date=None, owner_uid=None, creator_uid=None,
operator_uid=None, model_definition=None):
"""Method to add a general info element to a dc branch."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment