From b7ab87c9a27d81003603bc5ebbea593f08a5a713 Mon Sep 17 00:00:00 2001 From: dataobject Date: Fri, 30 Aug 2019 13:29:55 +0300 Subject: [PATCH] RM953 --- .../runa/wfe/execution/dao/SwimlaneDao.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/wfe-core/src/main/java/ru/runa/wfe/execution/dao/SwimlaneDao.java b/wfe-core/src/main/java/ru/runa/wfe/execution/dao/SwimlaneDao.java index 767bfeb4d3..b5005ae645 100644 --- a/wfe-core/src/main/java/ru/runa/wfe/execution/dao/SwimlaneDao.java +++ b/wfe-core/src/main/java/ru/runa/wfe/execution/dao/SwimlaneDao.java @@ -2,7 +2,10 @@ import java.util.List; import org.springframework.stereotype.Component; +import ru.runa.wfe.commons.Errors; import ru.runa.wfe.commons.dao.GenericDao; +import ru.runa.wfe.commons.error.ProcessError; +import ru.runa.wfe.commons.error.ProcessErrorType; import ru.runa.wfe.execution.ExecutionContext; import ru.runa.wfe.execution.ExecutionStatus; import ru.runa.wfe.execution.Process; @@ -10,6 +13,8 @@ import ru.runa.wfe.execution.Swimlane; import ru.runa.wfe.extension.AssignmentHandler; import ru.runa.wfe.extension.assign.AssignmentException; +import ru.runa.wfe.extension.assign.NoExecutorAssignedException; +import ru.runa.wfe.lang.Node; import ru.runa.wfe.lang.SwimlaneDefinition; /** @@ -49,13 +54,25 @@ public Swimlane findOrCreate(Process process, SwimlaneDefinition swimlaneDefinit public Swimlane findOrCreateInitialized(ExecutionContext executionContext, SwimlaneDefinition swimlaneDefinition, boolean reassign) { Swimlane swimlane = findOrCreate(executionContext.getProcess(), swimlaneDefinition); if (reassign || swimlane.getExecutor() == null) { + Node node = executionContext.getNode(); + ProcessError processError = new ProcessError(ProcessErrorType.assignment, executionContext.getProcess().getId(), node.getNodeId()); try { AssignmentHandler assignmentHandler = swimlaneDefinition.getDelegation().getInstance(); assignmentHandler.assign(executionContext, swimlane); - } catch (AssignmentException e) { - log.warn("Unable to assign in " + swimlane + " due to " + e); + if (swimlane.getExecutor() != null) { + Errors.removeProcessError(processError); + } else { + Errors.addProcessError(processError, node.getName(), new NoExecutorAssignedException()); + } } catch (Exception e) { - log.warn("Unable to assign in " + swimlane, e); + if (Errors.addProcessError(processError, node.getName(), e)) { + if (e instanceof AssignmentException) { + log.warn("Unable to assign in " + swimlane + " due to " + e); + } else { + log.warn("Unable to assign in " + swimlane, e); + } + swimlane.assignExecutor(executionContext, null, true); + } } } return swimlane;