From aa103917e382725dbad9f0d27099775dd8f5f591 Mon Sep 17 00:00:00 2001 From: Joram Barrez Date: Tue, 2 Apr 2024 14:38:03 +0200 Subject: [PATCH] Extra logging --- ...tChangePlanItemInstanceStateOperation.java | 4 ++- .../ActivatePlanItemInstanceOperation.java | 6 +++-- .../entity/CaseInstanceEntityImpl.java | 5 +++- .../MultiInstanceActivityBehavior.java | 27 ++++++++++++++++--- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AbstractChangePlanItemInstanceStateOperation.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AbstractChangePlanItemInstanceStateOperation.java index 501ee43e9b5..2616ea28d2b 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AbstractChangePlanItemInstanceStateOperation.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/AbstractChangePlanItemInstanceStateOperation.java @@ -118,7 +118,9 @@ public String toString() { stringBuilder.append(planItem); } - stringBuilder.append(" (PlanItemInstance id: "); + stringBuilder.append(" (CaseInstance id: "); + stringBuilder.append(planItemInstanceEntity.getCaseInstanceId()); + stringBuilder.append(", PlanItemInstance id: "); stringBuilder.append(planItemInstanceEntity.getId()); stringBuilder.append("), "); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/ActivatePlanItemInstanceOperation.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/ActivatePlanItemInstanceOperation.java index 471eebdfe5b..1587febf1a5 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/ActivatePlanItemInstanceOperation.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/agenda/operation/ActivatePlanItemInstanceOperation.java @@ -87,9 +87,11 @@ public String toString() { stringBuilder.append("[Activate PlanItem] "); stringBuilder.append(planItem); - stringBuilder.append(" (PlanItemInstance id: "); + stringBuilder.append(" (CaseInstance id: "); + stringBuilder.append(planItemInstanceEntity.getCaseInstanceId()); + stringBuilder.append(", PlanItemInstance id: "); stringBuilder.append(planItemInstanceEntity.getId()); - stringBuilder.append(")"); + stringBuilder.append("), "); if (entryCriterionId != null) { stringBuilder.append(" via entry criterion ").append(entryCriterionId); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java index 67282a5741e..b6b3e508296 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/CaseInstanceEntityImpl.java @@ -489,7 +489,10 @@ public void setCaseDefinitionDeploymentId(String caseDefinitionDeploymentId) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("CaseInstance[id=").append(id) - .append(", caseDefinitionId=").append(caseDefinitionId); + .append(", caseDefinitionId=").append(caseDefinitionId) + .append(", caseDefinitionKey=").append(caseDefinitionKey) + .append(", parentId=").append(parentId) + .append(", name=").append(name); if (StringUtils.isNotEmpty(tenantId)) { sb.append(", tenantId=").append(tenantId); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java index 8a570056157..12447b2a043 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java @@ -505,12 +505,33 @@ protected Collection resolveAndValidateCollection(DelegateExecution execution) { } } else { - throw new FlowableIllegalArgumentException("Couldn't resolve collection expression, variable reference or string"); - + throw new FlowableIllegalArgumentException(buildUnresolvedCollectionExceptionMessage()); } } } - + + protected String buildUnresolvedCollectionExceptionMessage() { + StringBuilder exceptionStringBuilder = new StringBuilder("Couldn't resolve collection expression"); + if (collectionExpression != null) { + exceptionStringBuilder.append(" ("); + exceptionStringBuilder.append(collectionExpression.getExpressionText()); + exceptionStringBuilder.append(")"); + } + exceptionStringBuilder.append(", variable reference"); + if (collectionVariable != null) { + exceptionStringBuilder.append(" ("); + exceptionStringBuilder.append(collectionVariable); + exceptionStringBuilder.append(")"); + } + exceptionStringBuilder.append(" or string"); + if (collectionString != null) { + exceptionStringBuilder.append(" ("); + exceptionStringBuilder.append(collectionString); + exceptionStringBuilder.append(")"); + } + return exceptionStringBuilder.toString(); + } + @SuppressWarnings({ "unchecked", "rawtypes" }) protected Collection iterableToCollection(Iterable iterable) { List result = new ArrayList();