Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/rm953' into github
Browse files Browse the repository at this point in the history
  • Loading branch information
dofs197 committed Mar 17, 2020
2 parents 992b887 + b7ab87c commit 13e9f1c
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions wfe-core/src/main/java/ru/runa/wfe/execution/dao/SwimlaneDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

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;
import ru.runa.wfe.execution.QSwimlane;
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;

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 13e9f1c

Please sign in to comment.