-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 9.10, 10.10
-
Fix Version/s: 9.10-HF34, 10.10-HF10, 11.1, 2021.0
-
Component/s: Workflow
-
Release Notes Summary:Workflow filters evaluation is similar in WebUI or JSF context.
-
Tags:
-
Backlog priority:700
-
Sprint:nxcore 11.1.10, nxGang Sprint 11.1.12
-
Story Points:3
Some variables are missing in the context. This patch could make the filter resolution in WebUI is compatible with JSF UI
xxx:~/9.10-workspace/nuxeo/addons/nuxeo-platform-document-routing$ git diff diff --git i/nuxeo-routing-core/src/main/java/org/nuxeo/ecm/platform/routing/core/io/TaskWriter.java w/nuxeo-routing-core/src/main/java/org/nuxeo/ecm/platform/routing/core/io/TaskWriter.java index 2638af4c..146d002c 100644 --- i/nuxeo-routing-core/src/main/java/org/nuxeo/ecm/platform/routing/core/io/TaskWriter.java +++ w/nuxeo-routing-core/src/main/java/org/nuxeo/ecm/platform/routing/core/io/TaskWriter.java @@ -28,7 +28,9 @@ import static org.nuxeo.ecm.core.io.registry.reflect.Priorities.REFERENCE; import java.io.Closeable; import java.io.IOException; import java.io.OutputStream; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.inject.Inject; @@ -187,7 +189,7 @@ public class TaskWriter extends ExtensibleEntityJsonWriter<Task> { jg.writeArrayFieldStart('taskActions'); for (Button button : node.getTaskButtons()) { if (StringUtils.isBlank(button.getFilter()) || actionManager.checkFilter(button.getFilter(), - createActionContext(wrapper.getSession()))) { + createActionContext(node, wrapper.getSession()))) { jg.writeStartObject(); jg.writeStringField('name', button.getName()); jg.writeStringField('url', ctx.getBaseUrl() + 'api/v1/task/' + item.getDocument().getId() + '/'; @@ -268,10 +270,11 @@ public class TaskWriter extends ExtensibleEntityJsonWriter<Task> { jg.writeStringField('workflowInitiator', workflowInitiator); } - protected static ActionContext createActionContext(CoreSession session) { + protected static ActionContext createActionContext(GraphNode node, CoreSession session) { ActionContext actionContext = new ELActionContext(); - actionContext.setDocumentManager(session); - actionContext.setCurrentPrincipal((NuxeoPrincipal) session.getPrincipal()); + Map<String, Object> workflowContextualInfo = new HashMap<String, Object>(); + workflowContextualInfo.putAll(node.getWorkflowContextualInfo(session, true)); + actionContext.putAllLocalVariables(workflowContextualInfo); return actionContext; }