renamed get_specs -> get_process_models

allowed us to pass in a process_group_id to limit the models to a group
This commit is contained in:
mike cullerton 2022-06-14 17:51:50 -04:00
parent 67403b34a1
commit b665c37f33
1 changed files with 11 additions and 7 deletions

View File

@ -68,10 +68,10 @@ class ProcessModelService(FileSystemService):
def __remove_library_references(self, spec_id): def __remove_library_references(self, spec_id):
"""__remove_library_references.""" """__remove_library_references."""
for spec in self.get_specs(): for process_model in self.get_process_models():
if spec_id in spec.libraries: if spec_id in process_model.libraries:
spec.libraries.remove(spec_id) process_model.libraries.remove(spec_id)
self.update_spec(spec) self.update_spec(process_model)
@property @property
def master_spec(self): def master_spec(self):
@ -111,9 +111,13 @@ class ProcessModelService(FileSystemService):
) )
return self.__scan_spec(sd.path, sd.name, process_group) return self.__scan_spec(sd.path, sd.name, process_group)
def get_specs(self): def get_process_models(self, process_group_id=None):
"""Get_specs.""" """Get process models"""
process_groups = self.get_process_groups() if process_group_id is None:
process_groups = self.get_process_groups()
else:
process_group = self.get_process_group(process_group_id)
process_groups = [process_group,]
process_models = [] process_models = []
for process_group in process_groups: for process_group in process_groups:
process_models.extend(process_group.process_models) process_models.extend(process_group.process_models)