[jbpm-commits] JBoss JBPM SVN: r4808 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/task/events and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed May 13 16:23:37 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-05-13 16:23:37 -0400 (Wed, 13 May 2009)
New Revision: 4808
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignTaskAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksParticipationAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantPanel.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReloadAllTaskListsAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/AssignEvent.java
Removed:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantTree.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
Log:
Fix JBPM-2253, JBPM-2234: Task re-assignment & duplicate task list entries
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignTaskAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignTaskAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignTaskAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.task.events.AssignEvent;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class AssignTaskAction extends AbstractRESTAction
+{
+
+ public final static String ID = AssignTaskAction.class.getName();
+
+ public AssignTaskAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ AssignEvent payload = (AssignEvent)event;
+ return appContext.getUrlBuilder().getTaskAssignURL(payload.getTask().getId(), payload.getIdRef());
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.POST;
+ }
+
+ public void handleSuccessfulResponse(
+ final Controller controller, final Object event, Response response)
+ {
+ // refresh all task list
+ controller.handleEvent(
+ new Event(ReloadAllTaskListsAction.ID, null)
+ );
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -138,7 +138,7 @@
public void onClick(Widget sender) {
// force loading
controller.handleEvent(
- new Event(LoadTasksAction.ID, getAssignedIdentity())
+ new Event(LoadTasksAction.ID, appContext.getAuthentication().getUsername())
);
}
}
@@ -180,7 +180,7 @@
if(selection!=null)
{
TaskIdentityEvent payload = new TaskIdentityEvent(
- getAssignedIdentity(), selection
+ null, selection
);
controller.handleEvent(
@@ -221,7 +221,7 @@
windowPanel.addWindowCloseListener(new WindowCloseListener() {
public void onWindowClosed() {
controller.handleEvent(
- new Event(LoadTasksAction.ID, getAssignedIdentity())
+ new Event(LoadTasksAction.ID, appContext.getAuthentication().getUsername())
);
windowPanel = null;
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -62,10 +62,8 @@
public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
- TaskIdentityEvent claimEvent = (TaskIdentityEvent)event;
-
controller.handleEvent(
- new Event(LoadTasksAction.ID, claimEvent.getIdentity())
+ new Event(ReloadAllTaskListsAction.ID, null)
);
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -36,7 +36,6 @@
* Loads a task list for a particular identity.
*
* @see org.jboss.bpm.console.client.task.AssignedTasksView
- * @see org.jboss.bpm.console.client.task.OpenTasksView
*
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -71,11 +70,9 @@
String identity = (String)event;
List<TaskRef> tasks = DTOParser.parseTaskReferenceList(response.getText());
- OpenTasksView openTasks = (OpenTasksView)controller.getView(OpenTasksView.ID);
- AssignedTasksView personalTasks = (AssignedTasksView)controller.getView(AssignedTasksView.ID);
+ AssignedTasksView view = (AssignedTasksView)controller.getView(AssignedTasksView.ID);
- ConsoleLog.info("Loaded " + tasks.size() + " tasks");
- openTasks.update(identity, tasks);
- personalTasks.update(identity, tasks);
+ ConsoleLog.info("Loaded " + tasks.size() + " tasks");
+ view.update(identity, tasks);
}
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksParticipationAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksParticipationAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksParticipationAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.TaskRef;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+
+import java.util.List;
+
+/**
+ * Load a task list where user participates
+ *
+ * @see OpenTasksView
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class LoadTasksParticipationAction extends AbstractRESTAction
+{
+ public final static String ID = LoadTasksParticipationAction.class.getName();
+
+ public LoadTasksParticipationAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ String identity = (String)event;
+ return appContext.getUrlBuilder().getParticipationTaskListURL(identity);
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(
+ final Controller controller, final Object event, Response response)
+ {
+ String identity = (String)event;
+
+ List<TaskRef> tasks = DTOParser.parseTaskReferenceList(response.getText());
+ OpenTasksView view = (OpenTasksView)controller.getView(OpenTasksView.ID);
+
+ ConsoleLog.info("Loaded " + tasks.size() + " tasks");
+ view.update(identity, tasks);
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -23,7 +23,6 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.*;
-import com.google.gwt.user.client.ui.HTML;
import com.mvc4g.client.Event;
import org.gwt.mosaic.ui.client.*;
import org.gwt.mosaic.ui.client.ListBox;
@@ -33,9 +32,9 @@
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
import org.jboss.bpm.console.client.task.events.DetailViewEvent;
+import org.jboss.bpm.console.client.ApplicationContext;
import java.util.List;
-import java.util.Date;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -47,10 +46,13 @@
private TaskDetailView detailsView;
- public OpenTasksView(TaskDetailView detailView)
+ private ApplicationContext appContext;
+
+ public OpenTasksView(ApplicationContext appContext, TaskDetailView detailView)
{
super();
-
+ this.appContext = appContext;
+
ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
setTitle("Open Tasks");
setIcon(icons.taskIcon());
@@ -133,7 +135,7 @@
public void onClick(Widget sender) {
// force loading
controller.handleEvent(
- new Event(LoadTasksAction.ID, getAssignedIdentity())
+ new Event(LoadTasksParticipationAction.ID, getAssignedIdentity())
);
}
}
@@ -153,7 +155,7 @@
controller.handleEvent(
new Event(
ClaimTaskAction.ID,
- new TaskIdentityEvent(getAssignedIdentity(), selection)
+ new TaskIdentityEvent(appContext.getAuthentication().getUsername(), selection)
)
);
}
Copied: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantPanel.java (from rev 4798, projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantTree.java)
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantPanel.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantPanel.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+
+import com.google.gwt.user.client.ui.*;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.model.ParticipantRef;
+import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.task.events.AssignEvent;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+class ParticipantPanel extends LayoutPanel implements ViewInterface
+{
+
+ public final static String ID = ParticipantPanel.class.getName();
+
+ public final static String PARTICIPANTS = "Participants";
+ public final static String GROUPS = "Groups";
+ public final static String USERS = "Users";
+
+ private Controller controller;
+
+ private Tree tree;
+ private Button assignmentBtn;
+ private String selection = null;
+ private TaskRef currentTask;
+
+ public ParticipantPanel()
+ {
+ super(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
+ setPadding(5);
+
+ // particpants
+ ScrollLayoutPanel treePanel = new ScrollLayoutPanel();
+ tree = new Tree();
+ treePanel.add(tree);
+ this.add(treePanel, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ tree.addTreeListener(
+ new TreeListener()
+ {
+ public void onTreeItemSelected(TreeItem treeItem)
+ {
+ String name = treeItem.getText();
+ if(
+ !name.equals(PARTICIPANTS)
+ &! name.equals(GROUPS)
+ &! name.equals(USERS)
+ )
+ {
+ selection = name;
+ assignmentBtn.setEnabled(true);
+ }
+ else
+ {
+ selection = null;
+ assignmentBtn.setEnabled(false);
+ }
+ }
+
+ public void onTreeItemStateChanged(TreeItem treeItem)
+ {
+
+ }
+ }
+ );
+
+ // operations
+ assignmentBtn = new Button(
+ "Assign",
+ new ClickListener() {
+
+ public void onClick(Widget widget)
+ {
+ if(selection!=null)
+ {
+ controller.handleEvent(
+ new Event(AssignTaskAction.ID, new AssignEvent(selection, currentTask))
+ );
+ }
+ }
+ }
+ );
+
+ assignmentBtn.setEnabled(false);
+ add(assignmentBtn);
+ }
+
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(TaskRef task)
+ {
+ currentTask = task;
+
+ TreeItem root = tree.addItem(PARTICIPANTS);
+
+ // groups
+ TreeItem groups = root.addItem(GROUPS);
+ for(ParticipantRef gref : task.getParticipantGroups())
+ {
+ groups.addItem(gref.getIdRef());
+ }
+
+ // users
+ TreeItem users = root.addItem(USERS);
+ for(ParticipantRef uref : task.getParticipantUsers())
+ {
+ users.addItem(uref.getIdRef());
+ }
+
+ this.invalidate();
+ }
+
+ public void clear()
+ {
+ tree.clear();
+ currentTask = null;
+ }
+}
\ No newline at end of file
Deleted: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantTree.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantTree.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ParticipantTree.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client.task;
-
-import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeItem;
-import com.google.gwt.user.client.ui.TreeListener;
-import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.model.ParticipantRef;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-class ParticipantTree extends Tree
-{
-
- public final static String PARTICIPANTS = "Participants";
- public final static String GROUPS = "Groups";
- public final static String USERS = "Users";
-
- public ParticipantTree()
- {
- super();
- this.addTreeListener(
- new TreeListener()
- {
- public void onTreeItemSelected(TreeItem treeItem)
- {
- String name = treeItem.getText();
- if(
- !name.equals(PARTICIPANTS)
- &! name.equals(GROUPS)
- &! name.equals(USERS)
- )
- {
- System.out.println("Selected " + name);
- }
- }
-
- public void onTreeItemStateChanged(TreeItem treeItem)
- {
-
- }
- }
- );
- }
-
- public void update(TaskRef task)
- {
- TreeItem root = this.addItem(PARTICIPANTS);
-
- // groups
- TreeItem groups = root.addItem(GROUPS);
- for(ParticipantRef gref : task.getParticipantGroups())
- {
- groups.addItem(gref.getIdRef());
- }
-
- // users
- TreeItem users = root.addItem(USERS);
- for(ParticipantRef uref : task.getParticipantUsers())
- {
- users.addItem(uref.getIdRef());
- }
- }
-
- public void clear()
- {
- super.clear();
- }
-}
\ No newline at end of file
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -59,11 +59,9 @@
public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
- TaskIdentityEvent tie = (TaskIdentityEvent)event;
-
// force refresh reload
controller.handleEvent(
- new Event(LoadTasksAction.ID, tie.getIdentity())
+ new Event(ReloadAllTaskListsAction.ID, null)
);
}
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReloadAllTaskListsAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReloadAllTaskListsAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/ReloadAllTaskListsAction.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.jboss.bpm.console.client.ApplicationContext;
+
+/**
+ * Reloads all task lists after assignment or completion of a task.
+
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ReloadAllTaskListsAction implements ActionInterface
+{
+
+ public final static String ID = ReloadAllTaskListsAction.class.getName();
+
+ private ApplicationContext appContext;
+
+ public ReloadAllTaskListsAction(ApplicationContext appContext)
+ {
+ this.appContext = appContext;
+ }
+
+ public void execute(Controller controller, Object object)
+ {
+ // assigned tasks
+ String currentUser = appContext.getAuthentication().getUsername();
+ controller.handleEvent(
+ new Event(LoadTasksAction.ID, currentUser)
+ );
+
+ // open tasks
+ controller.handleEvent(
+ new Event(LoadTasksParticipationAction.ID, currentUser)
+ );
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -22,93 +22,104 @@
package org.jboss.bpm.console.client.task;
import com.google.gwt.user.client.ui.ChangeListener;
-import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.TreeItem;
import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
import org.gwt.mosaic.ui.client.Caption;
import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
import org.gwt.mosaic.ui.client.DeckLayoutPanel;
-import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
import org.gwt.mosaic.ui.client.layout.BoxLayout;
import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.jboss.bpm.console.client.common.PropertyGrid;
import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.model.ParticipantRef;
+import org.jboss.bpm.console.client.LazyPanel;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class TaskDetailView extends CaptionLayoutPanel implements ViewInterface
+public class TaskDetailView extends CaptionLayoutPanel
+ implements ViewInterface, LazyPanel
{
public final static String ID = TaskDetailView.class.getName();
-
+
private Controller controller;
private TaskRef currentTask = null;
private PropertyGrid grid;
- private ParticipantTree participantTree;
-
+ private ParticipantPanel participantPanel;
+
private boolean openView;
+ private boolean initialzed;
+
public TaskDetailView(boolean openView)
{
// render
super("Task details");
this.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
-
+
super.setStyleName("bpm-detail-panel");
this.openView = openView;
-
- grid = new PropertyGrid(
- new String[] {"ID:", "Name:", "Description:"}
- );
- if(openView)
+ }
+
+ public boolean isInitialized()
+ {
+ return initialzed;
+ }
+
+ public void initialize()
+ {
+ if(!this.initialzed)
{
- // properties
- final DeckLayoutPanel deck = new DeckLayoutPanel();
- deck.add(grid);
- // participants
- ScrollLayoutPanel participants = new ScrollLayoutPanel();
- participantTree = new ParticipantTree();
- participants.add(participantTree);
+ grid = new PropertyGrid(
+ new String[] {"ID:", "Name:", "Assignee:", "Description:"}
+ );
- // selection
- final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
- dropBox.addItem("Properties");
- dropBox.addItem("Participants");
- dropBox.addChangeListener(new ChangeListener() {
- public void onChange(Widget sender) {
- deck.showWidget(dropBox.getSelectedIndex());
- deck.layout();
- }
- });
+ if(openView)
+ {
+ // properties
+ final DeckLayoutPanel deck = new DeckLayoutPanel();
+ deck.add(grid);
- deck.add(participants);
+ // participants
+ participantPanel = new ParticipantPanel();
+ participantPanel.setController(controller);
- this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT);
- this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+ // selection
+ final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
+ dropBox.addItem("Properties");
+ dropBox.addItem("Participants");
+ dropBox.addChangeListener(new ChangeListener() {
+ public void onChange(Widget sender) {
+ deck.showWidget(dropBox.getSelectedIndex());
+ deck.layout();
+ }
+ });
- deck.showWidget(dropBox.getSelectedIndex());
- }
- else
- {
- this.add(grid);
- }
+ deck.add(participantPanel);
+ this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT);
+ this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+ deck.showWidget(dropBox.getSelectedIndex());
+ }
+ else
+ {
+ this.add(grid);
+ }
+
+ this.initialzed = true;
+ }
}
public void setController(Controller controller)
{
- this.controller = controller;
+ this.controller = controller;
}
public void update(TaskRef task)
@@ -118,13 +129,14 @@
String[] values = new String[] {
String.valueOf(task.getId()),
task.getName(),
+ task.getAssignee(),
description
};
grid.update(values);
- if(openView && participantTree!=null)
- participantTree.update(task);
+ if(openView && participantPanel !=null)
+ participantPanel.update(task);
}
public void clear()
@@ -132,8 +144,8 @@
currentTask = null;
grid.clear();
- if(openView && participantTree!=null) // event handling is broken. The change listener fires too early
- participantTree.clear();
+ if(openView && participantPanel !=null) // event handling is broken. The change listener fires too early
+ participantPanel.clear();
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -81,26 +81,33 @@
this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
TaskDetailView openDetailView = new TaskDetailView(true);
- TaskDetailView assingnedDetailView = new TaskDetailView(false);
- controller.addView("OpenDetailView", openDetailView);
- controller.addView("AssignedDetailView", assingnedDetailView);
+ TaskDetailView assignedDetailView = new TaskDetailView(false);
// create and register views
- registerView(OpenTasksView.ID, new OpenTasksView(openDetailView));
- registerView(AssignedTasksView.ID, new AssignedTasksView(appContext, assingnedDetailView));
+ controller.addView("OpenDetailView", openDetailView);
+ controller.addView("AssignedDetailView", assignedDetailView);
+ openDetailView.initialize();
+ assignedDetailView.initialize();
+
+ registerView(OpenTasksView.ID, new OpenTasksView(appContext, openDetailView));
+ registerView(AssignedTasksView.ID, new AssignedTasksView(appContext, assignedDetailView));
+
// create and register actions
registerAction(LoadTasksAction.ID, new LoadTasksAction(appContext));
+ registerAction(LoadTasksParticipationAction.ID, new LoadTasksParticipationAction(appContext));
registerAction(ClaimTaskAction.ID, new ClaimTaskAction(appContext));
registerAction(ReleaseTaskAction.ID, new ReleaseTaskAction(appContext));
registerAction(UpdateDetailsAction.ID, new UpdateDetailsAction());
+ registerAction(AssignTaskAction.ID, new AssignTaskAction(appContext));
+ registerAction(ReloadAllTaskListsAction.ID, new ReloadAllTaskListsAction(appContext));
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
// force loading
super.controller.handleEvent(
- new Event(LoadTasksAction.ID, appContext.getAuthentication().getUsername())
+ new Event(ReloadAllTaskListsAction.ID, null)
);
appContext.refreshView();
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/AssignEvent.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/AssignEvent.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/AssignEvent.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.task.events;
+
+import org.jboss.bpm.console.client.model.TaskRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public final class AssignEvent
+{
+ private String idRef;
+ private TaskRef task;
+
+ public AssignEvent(String idRef, TaskRef task)
+ {
+ this.idRef = idRef;
+ this.task = task;
+ }
+
+ public String getIdRef()
+ {
+ return idRef;
+ }
+
+ public TaskRef getTask()
+ {
+ return task;
+ }
+}
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -110,9 +110,9 @@
return getConsoleServerUrl() + "/rs/tasks/" + URL.encode(idRef);
}
- public String getParticipationTaskListURL(String idRef, String participation)
+ public String getParticipationTaskListURL(String idRef)
{
- return getConsoleServerUrl() + "/rs/tasks/" + URL.encode(idRef) +"/participation/"+URL.encode(participation);
+ return getConsoleServerUrl() + "/rs/tasks/" + URL.encode(idRef) +"/participation";
}
public String getTaskReleaseURL(long id)
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -35,6 +35,7 @@
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import java.util.List;
+import java.util.ArrayList;
import java.net.URL;
/**
@@ -87,13 +88,29 @@
String idRef
)
{
- List<TaskRef> refs = getTaskManagement().getTasksForIdentity(idRef);
+ List<TaskRef> assignedTasks = getTaskManagement().getAssignedTasks(idRef);
+ return processTaskListResponse(assignedTasks);
+ }
+ @GET
+ @Path("{idRef}/participation")
+ @Produces("application/json")
+ public Response getTasksForIdRefParticipation(
+ @PathParam("idRef")
+ String idRef
+ )
+ {
+ List<TaskRef> taskParticipation = getTaskManagement().getUnassignedTasks(idRef, null);
+ return processTaskListResponse(taskParticipation);
+ }
+
+ private Response processTaskListResponse(List<TaskRef> taskList)
+ {
// decorate task form URL if plugin available
TaskDispatcherPlugin formPlugin = getTaskDispatcherPlugin();
if(formPlugin!=null)
{
- for(TaskRef task : refs)
+ for(TaskRef task : taskList)
{
URL taskFormURL = formPlugin.getDispatchUrl(task.getId());
if(taskFormURL!=null)
@@ -102,23 +119,8 @@
}
}
}
-
- TaskRefWrapper wrapper = new TaskRefWrapper(refs);
- return createJsonResponse(wrapper);
- }
- @GET
- @Path("{idRef}/participation/{type}")
- @Produces("application/json")
- public Response getTasksForIdRefAndParticipation(
- @PathParam("idRef")
- String idRef,
- @PathParam("type")
- String participationType
- )
- {
- TaskRefWrapper wrapper =
- new TaskRefWrapper(getTaskManagement().getTasksForIdentity(idRef, participationType));
+ TaskRefWrapper wrapper = new TaskRefWrapper(taskList);
return createJsonResponse(wrapper);
}
Modified: projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2009-05-13 15:15:51 UTC (rev 4807)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2009-05-13 20:23:37 UTC (rev 4808)
@@ -30,18 +30,39 @@
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public interface TaskManagement
-{
+{
+ /**
+ * fetch a single task
+ */
TaskRef getTaskById(long taskId);
+ /**
+ * assign user to task
+ */
void assignTask(long taskId, String idRef);
+ /**
+ * unset a task assignment
+ */
void releaseTask(long taskId);
+ /**
+ * complete a task
+ */
void completeTask(long taskId, Map data);
- void completeTask(long taskId, String outcome, Map data);
+ /**
+ * complete a task with a given outcome (trigger)
+ */
+ void completeTask(long taskId, String outcome, Map data);
- List<TaskRef> getTasksForIdentity(String idRef);
+ /**
+ * get tasks assingned to a user
+ */
+ List<TaskRef> getAssignedTasks(String idRef);
- List<TaskRef> getTasksForIdentity(String idRef, String participationType);
+ /**
+ * get unassigned tasks where a user participates
+ */
+ List<TaskRef> getUnassignedTasks(String idRef, String participationType);
}
More information about the jbpm-commits
mailing list