Index: gui/war/src/main/java/org/jboss/bpm/console/client/process/ActivityDiagramView.java =================================================================== --- gui/war/src/main/java/org/jboss/bpm/console/client/process/ActivityDiagramView.java (revision 5133) +++ gui/war/src/main/java/org/jboss/bpm/console/client/process/ActivityDiagramView.java (working copy) @@ -21,16 +21,17 @@ */ package org.jboss.bpm.console.client.process; -import org.jboss.bpm.console.client.model.DiagramNodeInfo; +import java.util.List; + +import org.gwt.mosaic.ui.client.ScrollLayoutPanel; import org.jboss.bpm.console.client.model.ActiveNodeInfo; +import org.jboss.bpm.console.client.model.ProcessDefinitionRef; import org.jboss.bpm.console.client.model.ProcessInstanceRef; -import org.jboss.bpm.console.client.model.ProcessDefinitionRef; import org.jboss.bpm.console.client.process.events.ActivityDiagramResultEvent; -import org.gwt.mosaic.ui.client.layout.LayoutPanel; -import org.gwt.mosaic.ui.client.ScrollLayoutPanel; + import com.google.gwt.user.client.ui.HTML; +import com.mvc4g.client.Controller; import com.mvc4g.client.ViewInterface; -import com.mvc4g.client.Controller; /** * @author Heiko.Braun @@ -61,8 +62,7 @@ public void update(ActivityDiagramResultEvent event) { - ActiveNodeInfo activeNodeInfo = event.getActiveNodeInfo(); - DiagramNodeInfo activeNode = activeNodeInfo.getActiveNode(); + List activeNodeInfos = event.getActiveNodeInfo(); String imageUrl = event.getImageUrl(); // remove contents @@ -81,15 +81,17 @@ "" );*/ + String s = + "
" + + "
" + + ""; + for (ActiveNodeInfo activeNodeInfo: activeNodeInfos) { + s+= "
"; + } + s+= "
" + + "
"; - HTML html = new HTML( - "
" + - "
" + - "" + - "
" + - "
" + - "
" - ); + HTML html = new HTML(s); this.add(html); invalidate(); Index: gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java =================================================================== --- gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java (revision 5133) +++ gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java (working copy) @@ -21,19 +21,25 @@ */ package org.jboss.bpm.console.client.process; +import java.util.ArrayList; +import java.util.List; + +import org.jboss.bpm.console.client.ApplicationContext; import org.jboss.bpm.console.client.common.AbstractRESTAction; -import org.jboss.bpm.console.client.ApplicationContext; +import org.jboss.bpm.console.client.model.ActiveNodeInfo; +import org.jboss.bpm.console.client.model.DiagramNodeInfo; +import org.jboss.bpm.console.client.model.ProcessInstanceRef; import org.jboss.bpm.console.client.process.events.ActivityDiagramResultEvent; +import org.jboss.bpm.console.client.util.ConsoleLog; import org.jboss.bpm.console.client.util.JSONWalk; -import org.jboss.bpm.console.client.util.ConsoleLog; -import org.jboss.bpm.console.client.model.ProcessInstanceRef; -import org.jboss.bpm.console.client.model.DiagramNodeInfo; -import org.jboss.bpm.console.client.model.ActiveNodeInfo; +import org.jboss.bpm.console.client.util.JSONWalk.JSONWrapper; + import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.Response; +import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONObject; +import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONValue; -import com.google.gwt.json.client.JSONParser; import com.mvc4g.client.Controller; /** @@ -76,28 +82,38 @@ //int diagramWidth = JSONWalk.on(root).next("diagramWidth").asInt(); //int diagramHeight = JSONWalk.on(root).next("diagramHeight").asInt(); - JSONObject activeNode = JSONWalk.on(root).next("activeNode").asObject(); - - int x = JSONWalk.on(activeNode).next("x").asInt(); - int y = JSONWalk.on(activeNode).next("y").asInt(); - - int width = JSONWalk.on(activeNode).next("width").asInt(); - int height = JSONWalk.on(activeNode).next("height").asInt(); - String name = JSONWalk.on(activeNode).next("name").asString(); - - ActiveNodeInfo activeNodeInfo = - new ActiveNodeInfo( - -1, -1, - new DiagramNodeInfo(name, x, y, width, height) - ); - - // update view - ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID); - view.update( - new ActivityDiagramResultEvent( - appContext.getUrlBuilder().getProcessImageURL(inst.getDefinitionId()), - activeNodeInfo - ) - ); + if (root instanceof JSONArray) { + JSONArray array = (JSONArray) root; + List activeNodeInfos = new ArrayList(); + for (int i = 0; i < array.size(); i++) { + JSONWalk walk = JSONWalk.on(array.get(i)); + JSONWrapper wrapper = walk.next("activeNode"); + JSONObject activeNode = wrapper.asObject(); + + int x = JSONWalk.on(activeNode).next("x").asInt(); + int y = JSONWalk.on(activeNode).next("y").asInt(); + + int width = JSONWalk.on(activeNode).next("width").asInt(); + int height = JSONWalk.on(activeNode).next("height").asInt(); + String name = JSONWalk.on(activeNode).next("name").asString(); + + activeNodeInfos.add( + new ActiveNodeInfo( + -1, -1, + new DiagramNodeInfo(name, x, y, width, height) + ) + ); + wrapper = walk.next("activeNode"); + } + + // update view + ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID); + view.update( + new ActivityDiagramResultEvent( + appContext.getUrlBuilder().getProcessImageURL(inst.getDefinitionId()), + activeNodeInfos + ) + ); + } } } Index: gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java =================================================================== --- gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java (revision 5133) +++ gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java (working copy) @@ -21,6 +21,8 @@ */ package org.jboss.bpm.console.client.process.events; +import java.util.List; + import org.jboss.bpm.console.client.model.ActiveNodeInfo; /** @@ -29,13 +31,13 @@ public class ActivityDiagramResultEvent { private String imageUrl; - private ActiveNodeInfo activeNodeInfo; + private List activeNodeInfo; public ActivityDiagramResultEvent() { } - public ActivityDiagramResultEvent(String imageUrl, ActiveNodeInfo activeNodeInfo) + public ActivityDiagramResultEvent(String imageUrl, List activeNodeInfo) { this.imageUrl = imageUrl; this.activeNodeInfo = activeNodeInfo; @@ -51,12 +53,12 @@ this.imageUrl = imageUrl; } - public ActiveNodeInfo getActiveNodeInfo() + public List getActiveNodeInfo() { return activeNodeInfo; } - public void setActiveNodeInfo(ActiveNodeInfo activeNodeInfo) + public void setActiveNodeInfo(List activeNodeInfo) { this.activeNodeInfo = activeNodeInfo; } Index: server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java =================================================================== --- server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java (revision 5095) +++ server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java (working copy) @@ -297,7 +297,7 @@ GraphViewerPlugin plugin = getProcessGraphViewPlugin(); if(plugin !=null) { - ActiveNodeInfo info = plugin.getActiveNodeInfo(id); + List info = plugin.getActiveNodeInfo(id); return createJsonResponse(info); } Index: server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java =================================================================== --- server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java (revision 5095) +++ server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java (working copy) @@ -32,7 +32,9 @@ import javax.activation.DataHandler; import javax.activation.DataSource; +import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; +import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.HashMap; @@ -90,6 +92,8 @@ @Path("{taskId}/assign/{ifRef}") @Produces("application/json") public Response assignTask( + @Context + HttpServletRequest request, @PathParam("taskId") long taskId, @PathParam("ifRef") @@ -97,7 +101,7 @@ ) { log.debug("Assign task " + taskId + " to '" + idRef +"'"); - getTaskManagement().assignTask(taskId, idRef); + getTaskManagement().assignTask(taskId, idRef, request.getRemoteUser()); return Response.ok().build(); } @@ -105,12 +109,14 @@ @Path("{taskId}/release") @Produces("application/json") public Response releaseTask( + @Context + HttpServletRequest request, @PathParam("taskId") long taskId ) { log.debug("Release task " + taskId); - getTaskManagement().assignTask(taskId, null); + getTaskManagement().assignTask(taskId, null, request.getRemoteUser()); return Response.ok().build(); } @@ -118,12 +124,14 @@ @Path("{taskId}/close") @Produces("application/json") public Response closeTask( + @Context + HttpServletRequest request, @PathParam("taskId") long taskId ) { log.debug("Close task " + taskId ); - getTaskManagement().completeTask(taskId, null); + getTaskManagement().completeTask(taskId, null, request.getRemoteUser()); return Response.ok().build(); } @@ -131,6 +139,8 @@ @Path("{taskId}/close/{outcome}") @Produces("application/json") public Response closeTaskWithSignal( + @Context + HttpServletRequest request, @PathParam("taskId") long taskId, @QueryParam("outcome") @@ -138,7 +148,7 @@ ) { log.debug("Close task " + taskId + " outcome " + outcome); - getTaskManagement().completeTask(taskId, outcome, null); + getTaskManagement().completeTask(taskId, outcome, null, request.getRemoteUser()); return Response.ok().build(); } @@ -164,6 +174,8 @@ @Produces("text/html") @Consumes("multipart/form-data") public Response closeWithUI( + @Context + HttpServletRequest request, @PathParam("taskId") long taskId, MultipartFormDataInput payload @@ -230,9 +242,9 @@ TaskManagement tm = getTaskManagement(); if(null==outcome) - tm.completeTask(taskId, processVars); + tm.completeTask(taskId, processVars, request.getRemoteUser()); else - tm.completeTask(taskId, outcome, processVars); + tm.completeTask(taskId, outcome, processVars, request.getRemoteUser()); return Response.ok("Successfully processed task UI").build(); Index: server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java =================================================================== --- server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java (revision 5095) +++ server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java (working copy) @@ -39,22 +39,22 @@ /** * assign user to task */ - void assignTask(long taskId, String idRef); + void assignTask(long taskId, String idRef, String userId); /** * unset a task assignment */ - void releaseTask(long taskId); + void releaseTask(long taskId, String userId); /** * complete a task */ - void completeTask(long taskId, Map data); + void completeTask(long taskId, Map data, String userId); /** * complete a task with a given outcome (trigger) */ - void completeTask(long taskId, String outcome, Map data); + void completeTask(long taskId, String outcome, Map data, String userId); /** * get tasks assingned to a user Index: server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java =================================================================== --- server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java (revision 5133) +++ server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java (working copy) @@ -21,6 +21,8 @@ */ package org.jboss.bpm.console.server.plugin; +import java.util.List; + import org.jboss.bpm.console.client.model.ActiveNodeInfo; import org.jboss.bpm.console.client.model.DiagramInfo; @@ -35,5 +37,5 @@ DiagramInfo getDiagramInfo(String processId); - ActiveNodeInfo getActiveNodeInfo(String instanceId); + List getActiveNodeInfo(String instanceId); }