[docs]@staticmethoddefget_bpmn_file_bytes_from_aas():""" This method gets the BPMN file for SMIA PE from the AAS model. If the AAS model is within an AASX package, it will find inside it. Returns: obj: the content of the BPMN file in the form of bytes. """# First, if the AAS model is an AASX package will be analyzedaas_model_file_name,aas_model_file_extension=path.splitext(SMIAGeneralInfo.CM_AAS_MODEL_FILENAME)ifaas_model_file_extension=='.aasx':# Since the AAS model is an AASX package, the BPMN file can be obtained from inside it# First, it will find all BPMN type filesbpmn_files_within_aasx=SMIAPEModelUtils.get_all_bpmn_files_bytes_within_aasx()iflen(bpmn_files_within_aasx)>1:_logger.warning("More than one BPMN file has been added into the AASX package. It need to be established which is the valid one.")# TODO: it need to think some mechanism to determine which BPMN file is the valid one (e.g. checking# if it is part of an SkillParameter AAS element or with a specific semantic ID): it is not developed yetelse:returnbpmn_files_within_aasx[0]else:# TODO in this case it would be necessary to request the content of the file to the AAS Repository: it is not developed yet_logger.info("The AAS model is not an AASX package.")returnNone
[docs]@staticmethoddefget_all_bpmn_files_bytes_within_aasx():""" This method gets all the files of type BPMN from the AASX package defined as AAS model for the SMIA PE. Returns: list: list of all BPMN files content in bytes. """bpmn_files_bytes=[]withaasx.AASXReader(properties_file_utils.get_aas_model_filepath())asaasx_reader:forpart_name,content_typeinaasx_reader.reader.list_parts():file_name,file_extension=path.splitext(part_name)iffile_extension=='.bpmn':bpmn_files_bytes.append(aasx_reader.reader.open_part(part_name).read())breakelse:_logger.warning("No BPMN file exists within the AASX Package.")returnbpmn_files_bytes