Merge pull request #39 from sartography/feature/call_activity_selection
Feature/call activity selection
This commit is contained in:
commit
c2056071d5
|
@ -703,6 +703,8 @@ class ProcessInstanceProcessor:
|
||||||
|
|
||||||
spec_reference = SpecReferenceCache.query.filter_by(
|
spec_reference = SpecReferenceCache.query.filter_by(
|
||||||
identifier=bpmn_process_identifier
|
identifier=bpmn_process_identifier
|
||||||
|
).filter_by(
|
||||||
|
type='process'
|
||||||
).first()
|
).first()
|
||||||
bpmn_file_full_path = None
|
bpmn_file_full_path = None
|
||||||
if spec_reference is None:
|
if spec_reference is None:
|
||||||
|
@ -1019,7 +1021,7 @@ class ProcessInstanceProcessor:
|
||||||
spiff_logger = logging.getLogger("spiff")
|
spiff_logger = logging.getLogger("spiff")
|
||||||
for handler in spiff_logger.handlers:
|
for handler in spiff_logger.handlers:
|
||||||
if hasattr(handler, "bulk_insert_logs"):
|
if hasattr(handler, "bulk_insert_logs"):
|
||||||
handler.bulk_insert_logs() # type: ignore
|
handler.bulk_insert_logs() # type: ignoreidentifier
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
except WorkflowTaskExecException as we:
|
except WorkflowTaskExecException as we:
|
||||||
|
|
|
@ -162,6 +162,8 @@ class SpecFileService(FileSystemService):
|
||||||
(ref for ref in references if ref.is_primary and ref.is_executable), None
|
(ref for ref in references if ref.is_primary and ref.is_executable), None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SpecFileService.clear_caches_for_file(file_name, process_model_info)
|
||||||
|
|
||||||
for ref in references:
|
for ref in references:
|
||||||
# If no valid primary process is defined, default to the first process in the
|
# If no valid primary process is defined, default to the first process in the
|
||||||
# updated file.
|
# updated file.
|
||||||
|
@ -237,6 +239,14 @@ class SpecFileService(FileSystemService):
|
||||||
SpecFileService.update_message_trigger_cache(ref)
|
SpecFileService.update_message_trigger_cache(ref)
|
||||||
SpecFileService.update_correlation_cache(ref)
|
SpecFileService.update_correlation_cache(ref)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clear_caches_for_file(file_name: str, process_model_info: ProcessModelInfo) -> None:
|
||||||
|
"""Clear all caches related to a file"""
|
||||||
|
db.session.query(SpecReferenceCache).\
|
||||||
|
filter(SpecReferenceCache.file_name == file_name).\
|
||||||
|
filter(SpecReferenceCache.process_model_id == process_model_info.id).delete()
|
||||||
|
# fixme: likely the other caches should be cleared as well, but we don't have a clean way to do so yet.
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clear_caches() -> None:
|
def clear_caches() -> None:
|
||||||
"""Clear_caches."""
|
"""Clear_caches."""
|
||||||
|
@ -256,6 +266,7 @@ class SpecFileService(FileSystemService):
|
||||||
if process_id_lookup is None:
|
if process_id_lookup is None:
|
||||||
process_id_lookup = SpecReferenceCache.from_spec_reference(ref)
|
process_id_lookup = SpecReferenceCache.from_spec_reference(ref)
|
||||||
db.session.add(process_id_lookup)
|
db.session.add(process_id_lookup)
|
||||||
|
db.session.commit()
|
||||||
else:
|
else:
|
||||||
if ref.relative_path != process_id_lookup.relative_path:
|
if ref.relative_path != process_id_lookup.relative_path:
|
||||||
full_bpmn_file_path = SpecFileService.full_path_from_relative_path(
|
full_bpmn_file_path = SpecFileService.full_path_from_relative_path(
|
||||||
|
|
|
@ -119,6 +119,45 @@ class TestSpecFileService(BaseTest):
|
||||||
== self.call_activity_nested_relative_file_path
|
== self.call_activity_nested_relative_file_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_change_the_identifier_cleans_up_cache (
|
||||||
|
self,
|
||||||
|
app: Flask,
|
||||||
|
client: FlaskClient,
|
||||||
|
with_db_and_bpmn_file_cleanup: None,
|
||||||
|
with_super_admin_user: UserModel,
|
||||||
|
) -> None:
|
||||||
|
""" When a BPMN processes identifier is changed in a file, the old id
|
||||||
|
is removed from the cache"""
|
||||||
|
old_identifier = "ye_old_identifier"
|
||||||
|
process_id_lookup = SpecReferenceCache(
|
||||||
|
identifier=old_identifier,
|
||||||
|
relative_path=self.call_activity_nested_relative_file_path,
|
||||||
|
file_name=self.bpmn_file_name,
|
||||||
|
process_model_id=f"{self.process_group_id}/{self.process_model_id}",
|
||||||
|
type='process'
|
||||||
|
)
|
||||||
|
db.session.add(process_id_lookup)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
self.create_group_and_model_with_bpmn(
|
||||||
|
client=client,
|
||||||
|
user=with_super_admin_user,
|
||||||
|
process_group_id=self.process_group_id,
|
||||||
|
process_model_id=self.process_model_id,
|
||||||
|
bpmn_file_name=self.bpmn_file_name,
|
||||||
|
bpmn_file_location=self.process_model_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
bpmn_process_id_lookups = SpecReferenceCache.query.all()
|
||||||
|
assert len(bpmn_process_id_lookups) == 1
|
||||||
|
assert bpmn_process_id_lookups[0].identifier != old_identifier
|
||||||
|
assert bpmn_process_id_lookups[0].identifier == "Level1"
|
||||||
|
assert (
|
||||||
|
bpmn_process_id_lookups[0].relative_path
|
||||||
|
== self.call_activity_nested_relative_file_path
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_load_reference_information(
|
def test_load_reference_information(
|
||||||
self,
|
self,
|
||||||
app: Flask,
|
app: Flask,
|
||||||
|
|
Loading…
Reference in New Issue