Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Process and task management on the way

git-svn-id: http://ns2.paguo.net/svn/repos/network-journal/trunk@1125 11230f00-c60a-0410-812f-9e7afa6d8178
  • Loading branch information...
commit 7f037385847d08d949aab35281e6f372d2da67fc 1 parent e82a92e
slava authored
View
2  src/main/java/net/paguo/web/wicket/NetworkProblemCreatePage.java
@@ -75,7 +75,7 @@ void saveProblem(NetworkProblem problem){
setResponsePage(NetworkProblemsPage.class);
} catch (ControllerException e) {
log.error(e);
- //TODO: exctract message
+ //TODO: extract message
error("Unexpected error communicated with DB.");
}
}
View
3  src/main/java/net/paguo/web/wicket/bpm/BpmPage.java
@@ -1,8 +1,10 @@
package net.paguo.web.wicket.bpm;
import net.paguo.web.wicket.SecuredWebPage;
+import net.paguo.web.wicket.JournalApplication;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.PageParameters;
+import org.apache.wicket.behavior.HeaderContributor;
import org.springmodules.workflow.jbpm31.JbpmTemplate;
import org.jbpm.JbpmContext;
import org.jbpm.JbpmConfiguration;
@@ -29,6 +31,7 @@ public void setTemplate(JbpmTemplate template) {
public BpmPage(PageParameters parameters){
super();
getContext().setActorId(findSessionUser().getPermissionEntry().getUserName());
+ add(HeaderContributor.forCss(JournalApplication.class, "wstyles.css"));
}
protected JbpmContext getContext() {
View
30 src/main/java/net/paguo/web/wicket/bpm/MyTasksPanel.java
@@ -1,8 +1,18 @@
package net.paguo.web.wicket.bpm;
import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.wicket.Component;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.datetime.markup.html.basic.DateLabel;
+import org.apache.wicket.datetime.PatternDateConverter;
+import org.apache.wicket.datetime.StyleDateConverter;
+import org.apache.wicket.behavior.IBehavior;
import org.springmodules.workflow.jbpm31.JbpmTemplate;
+import org.jbpm.taskmgmt.exe.TaskInstance;
import net.paguo.web.wicket.auth.UserView;
import net.paguo.web.wicket.JournalWebSession;
@@ -17,6 +27,7 @@
@SpringBean(name = "jbpmTemplate")
JbpmTemplate template;
+ private static final long serialVersionUID = 6835957528367707247L;
public JbpmTemplate getTemplate() {
return template;
@@ -31,5 +42,24 @@ public MyTasksPanel(String id) {
final UserView authenticatedUser = JournalWebSession.get().getAuthenticatedUser();
List groupTasks = getTemplate().findPooledTaskInstances(authenticatedUser.getUsername());
+
+ List myTasks = getTemplate().findPooledTaskInstances(authenticatedUser.getUsername());
+
+ add(new TaskListView("groupTasks", groupTasks));
+ add(new TaskListView("myTasks", myTasks));
+ }
+
+ private class TaskListView extends ListView {
+ private static final long serialVersionUID = -6976112108566087589L;
+
+ public TaskListView(String s, List groupTasks) {
+ super(s, groupTasks);
+ }
+
+ protected void populateItem(ListItem item) {
+ TaskInstance instance = (TaskInstance) item.getModelObject();
+ item.add(new Label("name", instance.getName()));
+ item.add(new DateLabel("date", new PropertyModel(instance, "start"), new StyleDateConverter("S", true)));
+ }
}
}
View
1  src/main/java/net/paguo/web/wicket/bpm/ProcessDefinitionsPanel.java
@@ -34,6 +34,5 @@ protected void populateItem(ListItem item) {
item.add(new StartProcessLink("start", def.getId()));
}
});
- add(HeaderContributor.forCss(JournalApplication.class, "wstyles.css"));
}
}
View
34 src/main/java/net/paguo/web/wicket/bpm/RunningProcessesPanel.java
@@ -0,0 +1,34 @@
+package net.paguo.web.wicket.bpm;
+
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.springmodules.workflow.jbpm31.JbpmTemplate;
+import net.paguo.web.wicket.auth.UserView;
+import net.paguo.web.wicket.JournalWebSession;
+
+/**
+ * User: sreentenko
+ * Date: 25.09.2008
+ * Time: 1:55:45
+ */
+public class RunningProcessesPanel extends Panel {
+
+ @SpringBean(name = "jbpmTemplate")
+ JbpmTemplate template;
+ private static final long serialVersionUID = 382747407109569979L;
+
+ public JbpmTemplate getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(JbpmTemplate template) {
+ this.template = template;
+ }
+
+ public RunningProcessesPanel(String id) {
+ super(id);
+ final UserView authenticatedUser = JournalWebSession.get().getAuthenticatedUser();
+
+ getTemplate().findProcessInstances();
+ }
+}
View
3  src/main/java/net/paguo/web/wicket/bpm/TestBpmPage.java
@@ -12,6 +12,7 @@
public TestBpmPage(PageParameters parameters) {
super(parameters);
- add(new ProcessDefinitionsPanel("defs", getContext()));
+ add(new ProcessDefinitionsPanel("defs", getContext()));
+ add(new MyTasksPanel("tasks"));
}
}
View
7 src/main/java/net/paguo/web/wicket/bpm/components/StartProcessLink.java
@@ -5,6 +5,7 @@
import org.springmodules.workflow.jbpm31.JbpmTemplate;
import org.jbpm.JbpmContext;
import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.taskmgmt.exe.SwimlaneInstance;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import net.paguo.web.wicket.bpm.utils.ProcessUtils;
@@ -54,7 +55,11 @@ public void onClick() {
final TaskInstance taskInstance = pi.getTaskMgmtInstance().createStartTaskInstance();
if (taskInstance != null){
- taskInstance.start(authenticatedUser.getUsername());
+ taskInstance.start();
+ final SwimlaneInstance swimlaneInstance = taskInstance.getSwimlaneInstance();
+ final String name = swimlaneInstance.getName();
+ //TODO: find pooled actors by swimlane name (should correspond to a LocalRole)
+ taskInstance.setPooledActors(new String[]{"slava"});
jbpmContext.save(taskInstance);
}else{
pi.getRootToken().signal();
View
17 src/main/resources/net/paguo/web/wicket/bpm/MyTasksPanel.html
@@ -7,6 +7,23 @@
lang="en">
<body>
<wicket:panel>
+ <table class="dataView">
+ <caption>Group tasks</caption>
+ <tr wicket:id="groupTasks">
+ <td><span wicket:id="name"/> </td>
+ <td><span wicket:id="date"/> </td>
+ </tr>
+ </table>
+
+ <br/>
+
+ <table class="dataView">
+ <caption>My tasks</caption>
+ <tr wicket:id="myTasks">
+ <td><span wicket:id="name"/> </td>
+ <td><span wicket:id="date"/> </td>
+ </tr>
+ </table>
</wicket:panel>
</body>
</html>
View
4 src/main/resources/net/paguo/web/wicket/bpm/TestBpmPage.html
@@ -7,7 +7,9 @@
lang="en">
<body>
<wicket:extend>
- <span wicket:id="defs"></span>
+ <span wicket:id="defs">[defs]</span>
+
+ <span wicket:id="tasks">[tasks]</span>
</wicket:extend>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.