Remove the "master_spec"

This commit is contained in:
Dan 2022-10-18 15:55:50 -04:00
parent 2fbc6777bd
commit 5e13a23912
6 changed files with 8 additions and 67 deletions

View File

@ -31,7 +31,6 @@ class ProcessModelInfo:
description: str
process_group_id: str = ""
process_group: Any | None = None
is_master_spec: bool | None = False
standalone: bool | None = False
library: bool | None = False
primary_file_name: str | None = None
@ -67,7 +66,6 @@ class ProcessModelInfoSchema(Schema):
id = marshmallow.fields.String(required=True)
display_name = marshmallow.fields.String(required=True)
description = marshmallow.fields.String()
is_master_spec = marshmallow.fields.Boolean(required=True)
standalone = marshmallow.fields.Boolean(required=True)
library = marshmallow.fields.Boolean(required=True)
display_order = marshmallow.fields.Integer(allow_none=True)

View File

@ -22,9 +22,8 @@ class FileSystemService:
"""
LIBRARY_SPECS = "Library Specs"
STAND_ALONE_SPECS = "Stand Alone"
MASTER_SPECIFICATION = "Master Specification"
REFERENCE_FILES = "Reference Files"
SPECIAL_FOLDERS = [LIBRARY_SPECS, MASTER_SPECIFICATION, REFERENCE_FILES]
SPECIAL_FOLDERS = [LIBRARY_SPECS, REFERENCE_FILES]
CAT_JSON_FILE = "process_group.json"
WF_JSON_FILE = "workflow.json"
@ -66,30 +65,13 @@ class FileSystemService:
@staticmethod
def process_group_path_for_spec(spec: ProcessModelInfo) -> str:
"""Category_path_for_spec."""
if spec.is_master_spec:
return os.path.join(FileSystemService.root_path())
elif spec.library:
process_group_path = FileSystemService.process_group_path(
FileSystemService.LIBRARY_SPECS
)
elif spec.standalone:
process_group_path = FileSystemService.process_group_path(
FileSystemService.STAND_ALONE_SPECS
)
else:
process_group_path = FileSystemService.process_group_path(
return FileSystemService.process_group_path(
spec.process_group_id
)
return process_group_path
@staticmethod
def workflow_path(spec: ProcessModelInfo) -> str:
"""Workflow_path."""
if spec.is_master_spec:
return os.path.join(
FileSystemService.root_path(), FileSystemService.MASTER_SPECIFICATION
)
else:
process_group_path = FileSystemService.process_group_path_for_spec(spec)
return os.path.join(process_group_path, spec.id)

View File

@ -63,12 +63,6 @@ class ProcessModelService(FileSystemService):
def save_process_model(self, process_model: ProcessModelInfo) -> None:
"""Save_process_model."""
spec_path = self.workflow_path(process_model)
if (
process_model.is_master_spec
or process_model.library
or process_model.standalone
):
process_model.process_group_id = ""
os.makedirs(spec_path, exist_ok=True)
json_path = os.path.join(spec_path, self.WF_JSON_FILE)
with open(json_path, "w") as wf_json:
@ -90,20 +84,6 @@ class ProcessModelService(FileSystemService):
path = self.workflow_path(process_model)
shutil.rmtree(path)
@property
def master_spec(self) -> Optional[ProcessModelInfo]:
"""Master_spec."""
return self.get_master_spec()
def get_master_spec(self) -> Optional[ProcessModelInfo]:
"""Get_master_spec."""
path = os.path.join(
FileSystemService.root_path(), FileSystemService.MASTER_SPECIFICATION
)
if os.path.exists(path):
return self.__scan_spec(path, FileSystemService.MASTER_SPECIFICATION)
return None
@classmethod
def get_process_model_from_relative_path(
cls, relative_path: str
@ -121,9 +101,6 @@ class ProcessModelService(FileSystemService):
if not os.path.exists(FileSystemService.root_path()):
raise ProcessEntityNotFoundError("process_model_not_found")
master_spec = self.get_master_spec()
if master_spec and master_spec.id == process_model_id:
return master_spec
if group_id is not None:
process_group = self.get_process_group(group_id)
if process_group is not None:
@ -240,14 +217,6 @@ class ProcessModelService(FileSystemService):
process_groups = []
for item in directory_items:
if item.is_dir() and not item.name[0] == ".":
# if item.name == self.REFERENCE_FILES:
# continue
# elif item.name == self.MASTER_SPECIFICATION:
# continue
# elif item.name == self.LIBRARY_SPECS:
# continue
# elif item.name == self.STAND_ALONE_SPECS:
# continue
process_groups.append(self.__scan_process_group(item))
return process_groups
@ -292,7 +261,6 @@ class ProcessModelService(FileSystemService):
) -> ProcessModelInfo:
"""__scan_spec."""
spec_path = os.path.join(path, self.WF_JSON_FILE)
is_master = FileSystemService.MASTER_SPECIFICATION in spec_path
if os.path.exists(spec_path):
with open(spec_path) as wf_json:
@ -314,7 +282,6 @@ class ProcessModelService(FileSystemService):
id=name,
library=False,
standalone=False,
is_master_spec=is_master,
display_name=name,
description="",
display_order=0,

View File

@ -117,7 +117,6 @@ class BaseTest:
process_group_id=process_group.id,
standalone=False,
is_review=False,
is_master_spec=False,
libraries=[],
library=False,
primary_process_id=primary_process_id,

View File

@ -18,7 +18,6 @@ class ExampleDataLoader:
process_model_id: str,
display_name: str = "",
description: str = "",
master_spec: bool = False,
process_group_id: str = "",
display_order: int = 0,
from_tests: bool = False,
@ -38,7 +37,6 @@ class ExampleDataLoader:
description=description,
process_group_id=process_group_id,
display_order=display_order,
is_master_spec=master_spec,
standalone=standalone,
library=library,
is_review=False,

View File

@ -37,7 +37,6 @@ def assure_process_group_exists(process_group_id: Optional[str] = None) -> Proce
def load_test_spec(
process_model_id: str,
master_spec: bool = False,
process_group_id: Optional[str] = None,
library: bool = False,
bpmn_file_name: Optional[str] = None,
@ -48,7 +47,6 @@ def load_test_spec(
process_model_service = ProcessModelService()
if process_group_id is None:
process_group_id = "test_process_group_id"
if not master_spec and not library:
process_group = assure_process_group_exists(process_group_id)
process_group_id = process_group.id
@ -59,7 +57,6 @@ def load_test_spec(
except ProcessEntityNotFoundError:
spec = ExampleDataLoader().create_spec(
process_model_id=process_model_id,
master_spec=master_spec,
from_tests=True,
display_name=process_model_id,
process_group_id=process_group_id,