Workflow checkpoint.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3399 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-07-25 20:56:42 +00:00
parent 62c0ecf132
commit d8deab68eb
54 changed files with 4718 additions and 3 deletions

View File

@@ -0,0 +1,13 @@
processDefinitionsList=Process Definitions List
searchProcessInstances=Search Process Instances
processDefinitions=Process Definitions
variableName=Variable Name
variableValue=Variable Value
search=Search
id=Id
name=Name
version=Version
instances=Instances
start=Start
end=End
value=Value

View File

@@ -193,7 +193,9 @@
description="My Documents Template Page"
jsp="/jsp/dashboards/dashlets/my-docs.jsp" allow-narrow="true" />
<dashlet id="task-list" label="My Tasklist To-do" description="List of your tasks still to complete"
jsp="/jsp/dashboards/dashlets/tasklist-todo.jsp" allow-narrow="false" />
jsp="/jbpm/task_list.jsp" allow-narrow="true" />
<dashlet id="process-list" label="Workflows" description="List of workflows you may start"
jsp="/jbpm/process_list.jsp" allow-narrow="true" />
<dashlet id="task-list-complete" label="My Tasks Completed" description="List of your completed tasks"
jsp="/jsp/dashboards/dashlets/tasklist-completed.jsp" allow-narrow="false" />
<dashlet id="content-checkedout" label="My Checkedout Content" description="List of the content checked out to you"

View File

@@ -0,0 +1,64 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.List;
import javax.faces.context.FacesContext;
import org.jbpm.scheduler.impl.Scheduler;
public class AdminBean {
String deployUrl;
public void deployProcess() {
}
public void createSchema() {
}
public void dropSchema() {
}
public boolean isSchedulerRunning() {
return getScheduler().isRunning();
}
public List getSchedulerHistoryLogs() {
return getScheduler().getSchedulerHistoryLogs();
}
private Scheduler getScheduler() {
return (Scheduler) FacesContext.getCurrentInstance()
.getExternalContext()
.getApplicationMap()
.get("scheduler");
}
public String getDeployUrl() {
return deployUrl;
}
public void setDeployUrl(String deployUrl) {
this.deployUrl = deployUrl;
}
}

View File

@@ -0,0 +1,22 @@
package org.jbpm.webapp.bean;
import org.alfresco.service.cmr.security.AuthenticationService;
public class AlfrescoUserBean extends UserBean
{
AuthenticationService authService;
public void setAuthenticationService(AuthenticationService authService)
{
this.authService = authService;
}
@Override
public String getUserName()
{
return authService.getCurrentUserName();
}
}

View File

@@ -0,0 +1,42 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import org.jbpm.context.def.VariableAccess;
public class FormParameter {
private String value = null;
private VariableAccess variableAccess = null;
public FormParameter(String value, VariableAccess variableAccess) {
this.value = value;
this.variableAccess = variableAccess;
}
public String getValue() {
return value;
}
public VariableAccess getVariableAccess() {
return variableAccess;
}
}

View File

@@ -0,0 +1,205 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.List;
import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.db.GraphSession;
import org.jbpm.db.TaskMgmtSession;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.def.Task;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class HomeBean {
UserBean userBean;
TaskBean taskBean;
JbpmConfiguration config;
DataModel taskInstances;
DataModel processDefs;
public HomeBean()
{
}
public void setJbpmConfiguration(JbpmConfiguration config)
{
this.config = config;
}
public List getTaskInstances()
{
JbpmContext xjbpmContext = config.getCurrentJbpmContext();
JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext;
try
{
TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
List<TaskInstance> taskInstances = taskMgmtSession.findTaskInstances(userBean.getUserName());
for (TaskInstance taskInstance : taskInstances)
{
taskInstance.getName();
taskInstance.getTaskMgmtInstance().getTaskMgmtDefinition().getProcessDefinition().getName();
}
return taskInstances;
}
finally
{
if (xjbpmContext == null) jbpmContext.close();
}
}
public DataModel getTaskInstancesModel()
{
if (taskInstances == null)
{
taskInstances = new ListDataModel(getTaskInstances());
}
return taskInstances;
}
public List getLatestProcessDefinitions()
{
JbpmContext xjbpmContext = config.getCurrentJbpmContext();
JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext;
try
{
GraphSession graphSession = jbpmContext.getGraphSession();
List<ProcessDefinition> procDefs = graphSession.findLatestProcessDefinitions();
for (ProcessDefinition procDef : procDefs)
{
procDef.getName();
Task startTask = procDef.getTaskMgmtDefinition().getStartTask();
if (startTask != null)
{
startTask.getName();
}
}
return procDefs;
}
finally
{
if (xjbpmContext == null) jbpmContext.close();
}
}
public DataModel getLatestProcessDefinitionsModel()
{
if (processDefs == null)
{
processDefs = new ListDataModel(getLatestProcessDefinitions());
}
return processDefs;
}
/**
* selects a task.
*/
public String selectTaskInstance()
{
JbpmContext xjbpmContext = config.getCurrentJbpmContext();
JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext;
try
{
// Get the task instance id from request parameter
TaskInstance selectedTask = (TaskInstance)taskInstances.getRowData();
long taskInstanceId = selectedTask.getId();
TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId);
taskBean.initialize(taskInstance);
return "task";
}
finally
{
taskInstances = null;
processDefs = null;
if (xjbpmContext == null ) jbpmContext.close();
}
}
/**
* prepares a task form for starting a new process instance.
*/
public String startProcessInstance()
{
JbpmContext xjbpmContext = config.getCurrentJbpmContext();
JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext;
try
{
jbpmContext.setActorId(AuthenticationUtil.getCurrentUserName());
// Get the task instance id from request parameter
ProcessDefinition selectedProc = (ProcessDefinition)processDefs.getRowData();
long processDefinitionId = selectedProc.getId();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
// create a new process instance to run
ProcessInstance processInstance = new ProcessInstance(processDefinition);
// create a new taskinstance for the start task
Task startTask = processInstance.getTaskMgmtInstance().getTaskMgmtDefinition().getStartTask();
if (startTask != null)
{
TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
taskBean.initialize(taskInstance);
}
// Save the process instance along with the task instance
jbpmContext.save(processInstance);
// Fill the task backing bean with useful information
return (startTask == null) ? "home" : "task";
}
finally
{
if (xjbpmContext == null) jbpmContext.close();
taskInstances = null;
processDefs = null;
}
}
public UserBean getUserBean() {
return userBean;
}
public void setUserBean(UserBean userBean) {
this.userBean = userBean;
}
public TaskBean getTaskBean() {
return taskBean;
}
public void setTaskBean(TaskBean taskBean) {
this.taskBean = taskBean;
}
}

View File

@@ -0,0 +1,61 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
public class JsfHelper {
public static long getId(String parameterName) {
long value = -1;
String valueText = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(parameterName);
try {
Long id = new Long(valueText);
value = id.longValue();
} catch (NumberFormatException e) {
throw new RuntimeException("couldn't parse '"+parameterName+"'='"+valueText+"' as a long");
}
return value;
}
public static void addMessage(String msg) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(msg));
}
public static void setSessionAttribute(String key, Object value) {
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key, value);
}
public static Object getSessionAttribute(String key) {
return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(key);
}
public static void removeSessionAttribute(String key) {
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(key);
}
public static String getParameter(String name) {
return (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name);
}
// private static final Log log = LogFactory.getLog(JsfHelper.class);
}

View File

@@ -0,0 +1,228 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
/**
* Monitoring Bean Implementation.
*
* @author David Loiseau
*/
public class MonitoringBean {
long processInstanceId;
String message;
String variableName;
String variableValue;
String variableNameOperator;
String variableValueOperator;
ArrayList processInstances;
public String showProcessDefinitions() {
return "processDefinitions";
}
public List getProcessDefinitions() {
ArrayList processDefinitionsList = new ArrayList();
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
List processDefinitions = jbpmContext.getGraphSession().findAllProcessDefinitions();
if (processDefinitions.isEmpty() == false) {
ListIterator listProcessDefinitions = processDefinitions.listIterator();
while (listProcessDefinitions.hasNext() ) {
ProcessDefinition processDefinition = (ProcessDefinition)listProcessDefinitions.next();
int instancesCount = 0;
try {
Connection connection = jbpmContext.getConnection();
Statement statement = connection.createStatement();
String request = "SELECT COUNT(*) AS instancesCount "
+ "FROM jbpm_processinstance "
+ "WHERE processdefinition_='"
+ processDefinition.getId() + "'";
ResultSet resultSet = statement.executeQuery(request);
resultSet.next();
instancesCount = resultSet.getInt("instancesCount");
}
catch (Exception e) {}
processDefinitionsList.add(
new ProcessDefinitionBean(
processDefinition.getId(),
processDefinition.getName(),
processDefinition.getVersion(),
instancesCount
));
}
}
return(processDefinitionsList);
}
public String inspectInstance() {
try {
ProcessInstanceBean processInstanceBean = new ProcessInstanceBean(this.processInstanceId);
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean);
this.message = "";
return "inspectInstance";
}
catch (Exception exception) {
this.message = "Error for process instance " + this.processInstanceId;
return "";
}
}
public String showSearchInstances() {
return("showSearchInstances");
}
public String searchInstances() {
long count = 0;
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
try {
Connection connection = jbpmContext.getConnection();
Statement statement = connection.createStatement();
statement.setMaxRows(100);
String request = "SELECT DISTINCT processinstance_, name_, stringvalue_ FROM jbpm_variableinstance "
+ "WHERE name_ "
+ this.variableNameOperator + " '"
+ variableName + "' AND stringvalue_ "
+ this.variableValueOperator + " '" + variableValue + "'";
ResultSet resultSet = statement.executeQuery(request);
processInstances = new ArrayList();
while (resultSet.next()) {
processInstances.add(new ProcessInstanceBean(
resultSet.getLong("processinstance_"),
resultSet.getString("name_"),
resultSet.getString("stringvalue_")));
count++;
}
statement.close();
}
catch (Exception e) {
this.message = "Search error " + e.getMessage();
}
if (count == 1) {
ProcessInstanceBean processInstanceBean = (ProcessInstanceBean)processInstances.iterator().next();
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean);
return("inspectInstance");
}
return "";
}
public List getOperatorsList (){
ArrayList operatorsList = new ArrayList();
SelectItem item = new SelectItem("=", "is equal to");
operatorsList.add(item);
item = new SelectItem("like", "is like");
operatorsList.add(item);
return operatorsList;
}
public long getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(long processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isShowProcessInstances() {
if (processInstances == null) return false;
if (processInstances.size() == 0) return false;
return true;
}
public ArrayList getProcessInstances() {
return processInstances;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public String getVariableValue() {
return variableValue;
}
public void setVariableValue(String variableValue) {
this.variableValue = variableValue;
}
public String getVariableNameOperator() {
return variableNameOperator;
}
public void setVariableNameOperator(String variableNameOperator) {
this.variableNameOperator = variableNameOperator;
}
public String getVariableValueOperator() {
return variableValueOperator;
}
public void setVariableValueOperator(String variableValueOperator) {
this.variableValueOperator = variableValueOperator;
}
}

View File

@@ -0,0 +1,141 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import javax.faces.context.FacesContext;
import org.jbpm.JbpmContext;
import org.jbpm.db.GraphSession;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
/**
* Process Definition Bean Implementation.
*
* @author David Loiseau
*/
public class ProcessDefinitionBean {
String name;
int version;
long id;
int instancesCount;
public ProcessDefinitionBean() {
}
public ProcessDefinitionBean(long id) {
this.id = id;
initialize();
}
public ProcessDefinitionBean(long id, String name, int version, int instancesCount) {
this.id = id;
this.name = name;
this.version = version;
this.instancesCount = instancesCount;
}
private void initialize() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition = graphSession.loadProcessDefinition(id);
this.name = processDefinition.getName();
this.version = processDefinition.getVersion();
this.instancesCount = graphSession.findProcessInstances(this.id).size();
}
public List getProcessInstances() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ArrayList processInstancesList = new ArrayList();
List listProcessInstance = graphSession.findProcessInstances(this.id);
if (listProcessInstance.isEmpty() == false) {
ListIterator listProcessInstances = listProcessInstance.listIterator();
while (listProcessInstances.hasNext()) {
ProcessInstance processInstance = (ProcessInstance) listProcessInstances.next();
processInstancesList.add(new ProcessInstanceBean(processInstance.getId(), processInstance.getStart(), processInstance.getEnd()));
}
}
return processInstancesList;
}
public String showProcessInstances() {
ProcessDefinitionBean processDefinitionBean = new ProcessDefinitionBean();
processDefinitionBean.setId(this.id);
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processDefinitionBean", processDefinitionBean);
return ("processInstances");
}
public String startProcessInstance() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition = graphSession.loadProcessDefinition(getId());
processDefinition.createInstance();
return showProcessInstances();
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
this.initialize();
}
public int getInstancesCount() {
return instancesCount;
}
public void setInstancesCount(int instancesCount) {
this.instancesCount = instancesCount;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
}

View File

@@ -0,0 +1,420 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.Map.Entry;
import javax.faces.context.FacesContext;
import org.jbpm.JbpmContext;
import org.jbpm.db.GraphSession;
import org.jbpm.db.TaskMgmtSession;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.exe.TaskInstance;
/**
* Process Instance Bean Implementation.
*
* @author David Loiseau
*/
public class ProcessInstanceBean {
long id;
String processDefinitionLabel;
long processDefinitionId;
Date start;
Date end;
ArrayList tokens;
ArrayList variables;
ArrayList tasks;
ArrayList transitions;
String variableName;
String variableValue;
long tokenInstanceId;
long taskInstanceId;
public ProcessInstanceBean(long id, Date start, Date end) {
this.id = id;
this.start = start;
this.end = end;
}
public ProcessInstanceBean(long id) {
this.id = id;
this.initialize();
}
public ProcessInstanceBean(long id, String variableName, String variableValue) {
this.id = id;
this.variableName = variableName;
this.variableValue = variableValue;
this.initialize();
}
public String inspectProcessInstance() {
ProcessInstanceBean processInstanceBean = new ProcessInstanceBean(this.id);
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean);
return ("inspectInstance");
}
public String deleteProcessInstance() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
graphSession.deleteProcessInstance(this.id);
return ("deleteInstance");
}
private void initialize() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessInstance processInstance = graphSession.loadProcessInstance(this.id);
this.start = processInstance.getStart();
this.end = processInstance.getEnd();
this.processDefinitionId = processInstance.getProcessDefinition().getId();
this.processDefinitionLabel = processInstance.getProcessDefinition().getName() + " (version " + processInstance.getProcessDefinition().getVersion() + ")";
initializeVariablesList(processInstance);
initializeTokensList(processInstance);
initializeTasksList(processInstance);
}
private void initializeAvailableTransitions(TaskInstance taskInstance) {
transitions = new ArrayList();
if (taskInstance.getAvailableTransitions().isEmpty() == false) {
Iterator availableTransitionsIterator = taskInstance.getAvailableTransitions().iterator();
while (availableTransitionsIterator.hasNext()) {
Transition transition = (Transition) availableTransitionsIterator.next();
transitions.add(transition);
}
}
}
private void initializeAvailableTransitions(Token token) {
transitions = new ArrayList();
if (token.getNode().getLeavingTransitions().isEmpty() == false) {
Iterator availableTransitionsIterator = token.getNode().getLeavingTransitions().iterator();
while (availableTransitionsIterator.hasNext()) {
Transition transition = (Transition) availableTransitionsIterator.next();
transitions.add(transition);
}
}
}
private void initializeVariablesList(ProcessInstance processInstance) {
// Variables list
variables = new ArrayList();
if (processInstance.getContextInstance().getVariables() != null && !processInstance.getContextInstance().getVariables().values().isEmpty()) {
int mapsize = processInstance.getContextInstance().getVariables().size();
Iterator variablesIterator = processInstance.getContextInstance().getVariables().entrySet().iterator();
for (int i = 0; i < mapsize; i++) {
Entry entry = (Entry) variablesIterator.next();
variables.add(new VariableBean((String) entry.getKey(), entry.getValue()));
}
}
}
private void initializeTasksList(ProcessInstance processInstance) {
// Tasks list
tasks = new ArrayList();
if (processInstance.getTaskMgmtInstance().getTaskInstances().isEmpty() == false) {
Iterator tasksIterator = processInstance.getTaskMgmtInstance().getTaskInstances().iterator();
while (tasksIterator.hasNext()) {
TaskInstance taskInstance = (TaskInstance) tasksIterator.next();
tasks.add(new TaskBean(taskInstance.getId(), taskInstance.getName(), taskInstance.getActorId(), taskInstance.getEnd()));
}
}
}
private void initializeTokensList(ProcessInstance processInstance) {
// Tokens list
Token rootToken = processInstance.getRootToken();
tokens = new ArrayList();
this.tokenInstanceId = rootToken.getId();
this.taskInstanceId = 0;
tokens.add(new TokenBean(rootToken.getId(), "Root", rootToken.getNode().getName(), rootToken.getNode().getClass().getName(), rootToken.getStart(),
rootToken.getEnd(), 1));
try {
if (rootToken.getChildren().isEmpty() == false) {
AddChildrenTokensToTokensList(this.tokens, rootToken, 2);
}
} catch (Exception exception) {
}
}
/**
*
* Add token childs to the current token beans list
*
* @param tokensList
* Current token list to update
* @param token
* Token where are the token childs
* @param level
* Level where is the token: 1 for the root token, 2 for the childs
* of the root token, ...
*/
private void AddChildrenTokensToTokensList(ArrayList tokensList, Token token, long level) {
Iterator childrenIterator = token.getChildren().values().iterator();
while (childrenIterator.hasNext()) {
Token childToken = (Token) childrenIterator.next();
tokensList.add(new TokenBean(childToken.getId(), childToken.getName(), childToken.getNode().getName(), childToken.getNode().getClass().getName(),
childToken.getStart(), childToken.getEnd(), level));
try {
if (childToken.getChildren().isEmpty() == false) {
AddChildrenTokensToTokensList(tokensList, childToken, level + 1);
}
} catch (Exception exception) {
}
}
}
public String updateVariable() {
if (this.variableName != null) {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessInstance processInstance = graphSession.loadProcessInstance(this.id);
if (this.variableValue != null) {
processInstance.getContextInstance().setVariable(this.variableName, this.variableValue);
} else {
processInstance.getContextInstance().deleteVariable(this.variableName);
}
initializeVariablesList(processInstance);
}
return "inspectInstance";
}
public String selectToken() {
this.taskInstanceId = 0;
this.tokenInstanceId = JsfHelper.getId("tokenInstanceId");
return "";
}
public String selectTask() {
this.tokenInstanceId = 0;
this.taskInstanceId = JsfHelper.getId("taskInstanceId");
return "";
}
public String signal() {
selectToken();
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
Token token = graphSession.loadToken(this.tokenInstanceId);
if (token.getNode().getLeavingTransitions().size() > 1) {
initializeAvailableTransitions(token);
return "showTransitions";
}
token.signal();
this.initializeTokensList(token.getProcessInstance());
return "inspectInstance";
}
public String selectTransition() {
String transitionName;
transitionName = JsfHelper.getParameter("transitionName");
ProcessInstance processInstance = null;
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (this.taskInstanceId > 0) {
TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);
if (transitionName.equals("")) {
taskInstance.end();
} else {
taskInstance.end(transitionName);
}
processInstance = taskInstance.getToken().getProcessInstance();
} else if (this.tokenInstanceId > 0) {
GraphSession graphSession = jbpmContext.getGraphSession();
Token token = graphSession.loadToken(this.tokenInstanceId);
if (transitionName.equals("")) {
token.signal();
} else {
token.signal(transitionName);
}
processInstance = token.getProcessInstance();
}
jbpmContext.save(processInstance);
this.initializeTasksList(processInstance);
this.initializeTokensList(processInstance);
return "inspectInstance";
}
public String endTask() {
selectTask();
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);
if (taskInstance.getAvailableTransitions().size() > 1) {
initializeAvailableTransitions(taskInstance);
return "showTransitions";
}
taskInstance.end();
ProcessInstance processInstance = taskInstance.getToken().getProcessInstance();
jbpmContext.save(processInstance);
this.initializeTasksList(processInstance);
this.initializeTokensList(processInstance);
return "inspectInstance";
}
// Show all the process instances for a given process definition ID
public String showProcessInstances() {
ProcessDefinitionBean processDefinitionBean = new ProcessDefinitionBean(this.processDefinitionId);
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processDefinitionBean", processDefinitionBean);
return ("processInstances");
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public Date getEnd() {
return end;
}
public void setEnd(Date end) {
this.end = end;
}
public ArrayList getTokens() {
return tokens;
}
public void setTokens(ArrayList tokens) {
this.tokens = tokens;
}
public String getProcessDefinitionLabel() {
return processDefinitionLabel;
}
public void setProcessDefinitionLabel(String processDefinitionLabel) {
this.processDefinitionLabel = processDefinitionLabel;
}
public ArrayList getVariables() {
return variables;
}
public ArrayList getTasks() {
return tasks;
}
public ArrayList getTransitions() {
return transitions;
}
public void setVariables(ArrayList variables) {
this.variables = variables;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public String getVariableValue() {
return variableValue;
}
public void setVariableValue(String variableValue) {
this.variableValue = variableValue;
}
public long getTokenInstanceId() {
return tokenInstanceId;
}
public void setTokenInstanceId(long tokenInstanceId) {
this.taskInstanceId = 0;
this.tokenInstanceId = tokenInstanceId;
}
public long getTaskInstanceId() {
return taskInstanceId;
}
public void setTaskInstanceId(long taskInstanceId) {
this.tokenInstanceId = 0;
this.taskInstanceId = taskInstanceId;
}
}

View File

@@ -0,0 +1,269 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.context.def.VariableAccess;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.logging.exe.LoggingInstance;
import org.jbpm.taskmgmt.def.TaskController;
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.jbpm.taskmgmt.log.TaskAssignLog;
public class TaskBean {
UserBean userBean = null;
List taskFormParameters;
List availableTransitions;
List availableTransitionItems;
TaskInstance taskInstance;
long taskInstanceId;
DataModel transitions;
// JbpmContext jbpmContext;
// GraphSession graphSession;
// TaskMgmtSession taskMgmtSession;
// For monitoring purposes
String name;
String actorId;
Date end;
public TaskBean() {
// this.jbpmContext = JbpmContext.getCurrentJbpmContext();
// this.graphSession = jbpmContext.getGraphSession();
// this.taskMgmtSession = jbpmContext.getTaskMgmtSession();
// get the parameters from the session
// this.taskFormParameters = (List) JsfHelper.getSessionAttribute("taskFormParameters");
}
public TaskBean(long taskInstanceId, String name, String actorId, Date end) {
this.taskInstanceId = taskInstanceId;
this.name = name;
this.actorId = actorId;
this.end = end;
}
public void initialize(TaskInstance taskInstance) {
this.taskInstance = taskInstance;
this.taskInstanceId = taskInstance.getId();
// set the parameters
this.taskFormParameters = new ArrayList();
TaskController taskController = taskInstance.getTask().getTaskController();
if (taskController!=null) {
List variableAccesses = taskController.getVariableAccesses();
Iterator iter = variableAccesses.iterator();
while (iter.hasNext()) {
VariableAccess variableAccess = (VariableAccess) iter.next();
String mappedName = variableAccess.getMappedName();
Object value = taskInstance.getVariable(mappedName);
TaskFormParameter tfp = new TaskFormParameter(variableAccess, value);
taskFormParameters.add(tfp);
}
}
// store the parameters in the session
//JsfHelper.setSessionAttribute("taskFormParameters", taskFormParameters);
// get the available transitions
availableTransitions = null;
availableTransitions = taskInstance.getAvailableTransitions();
if ((availableTransitions != null) && (availableTransitions.size() <= 1)) {
transitions = null;
availableTransitions = null;
availableTransitionItems = null;
} else {
transitions = new ListDataModel(availableTransitions);
availableTransitionItems = new ArrayList();
Iterator iter = availableTransitions.iterator();
while (iter.hasNext()) {
Transition transition = (Transition) iter.next();
SelectItem transitionItem = new SelectItem();
transitionItem.setValue(transition.getName());
transitionItem.setLabel(transition.getName());
transitionItem.setDisabled(false);
availableTransitionItems.add(transitionItem);
}
}
log.debug("initialized availableTransitions " + availableTransitions);
}
public String save() {
log.debug("saving the task parameters " + taskFormParameters);
// submit the parameters in the jbpm task controller
TaskInstance taskInstance = JbpmContext.getCurrentJbpmContext().getTaskMgmtSession().loadTaskInstance(taskInstanceId);
// collect the parameter values from the values that were updated in the
// parameters by jsf.
Iterator iter = taskFormParameters.iterator();
while (iter.hasNext()) {
TaskFormParameter taskFormParameter = (TaskFormParameter) iter.next();
if ((taskFormParameter.isWritable()) && (taskFormParameter.getValue() != null)) {
log.debug("submitting [" + taskFormParameter.getLabel() + "]=" + taskFormParameter.getValue());
taskInstance.setVariable(taskFormParameter.getLabel(), taskFormParameter.getValue());
} else {
log.debug("ignoring unwritable [" + taskFormParameter.getLabel() + "]");
}
}
// save the process instance and hence the updated task instance variables
JbpmContext.getCurrentJbpmContext().save(taskInstance);
// remove the parameters from the session
//JsfHelper.removeSessionAttribute("taskFormParameters");
return "home";
}
public String saveAndClose() {
// save
save();
TaskInstance taskInstance = JbpmContext.getCurrentJbpmContext().getTaskMgmtSession().loadTaskInstance(taskInstanceId);
// close the task instance
if (transitions == null)
{
taskInstance.end();
}
else
{
Transition selectedTransition = (Transition)transitions.getRowData();
taskInstance.end(selectedTransition.getName());
}
ProcessInstance processInstance = taskInstance.getTaskMgmtInstance().getProcessInstance();
if (processInstance.hasEnded()) {
JsfHelper.addMessage("The process has finished.");
}
LoggingInstance loggingInstance = processInstance.getLoggingInstance();
List assignmentLogs = loggingInstance.getLogs(TaskAssignLog.class);
log.debug("assignmentlogs: " + assignmentLogs);
if (assignmentLogs.size() == 1) {
TaskAssignLog taskAssignLog = (TaskAssignLog) assignmentLogs.get(0);
JsfHelper.addMessage("A new task has been assigned to '" + taskAssignLog.getTaskNewActorId() + "'");
} else if (assignmentLogs.size() > 1) {
String msg = "New tasks have been assigned to: ";
Iterator iter = assignmentLogs.iterator();
while (iter.hasNext()) {
TaskAssignLog taskAssignLog = (TaskAssignLog) iter.next();
msg += taskAssignLog.getActorId();
if (iter.hasNext())
msg += ", ";
}
msg += ".";
JsfHelper.addMessage(msg);
}
JbpmContext.getCurrentJbpmContext().save(taskInstance);
return "home";
}
public long getTaskInstanceId() {
return taskInstanceId;
}
public void setTaskInstanceId(long taskInstanceId) {
this.taskInstanceId = taskInstanceId;
}
public UserBean getUserBean() {
return userBean;
}
public void setUserBean(UserBean userBean) {
this.userBean = userBean;
}
public List getTaskFormParameters() {
return taskFormParameters;
}
public DataModel getTransitions()
{
return transitions;
}
public List getAvailableTransitions() {
return availableTransitions;
}
public void setAvailableTransitions(List availableTransitions) {
this.availableTransitions = availableTransitions;
}
public List getAvailableTransitionItems() {
return availableTransitionItems;
}
public TaskInstance getTaskInstance() {
return taskInstance;
}
private static final Log log = LogFactory.getLog(TaskBean.class);
public String getActorId() {
return actorId;
}
public void setActorId(String actorId) {
this.actorId = actorId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getEnd() {
return end;
}
public void setEnd(Date end) {
this.end = end;
}
public boolean isEnded() {
if (end == null)
return true;
return false;
}
}

View File

@@ -0,0 +1,109 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.io.Serializable;
import org.hibernate.Session;
import org.jbpm.context.def.VariableAccess;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class TaskFormParameter implements Serializable {
private static final long serialVersionUID = 1L;
protected String label = null;
protected String description = null;
protected Object value = null;
protected boolean isReadable = true;
protected boolean isWritable = true;
protected boolean isRequired = true;
public TaskFormParameter() {
}
public TaskFormParameter(VariableAccess variableAccess, Object value) {
this.label = variableAccess.getMappedName();
this.value = value;
this.isReadable = variableAccess.isReadable();
this.isWritable = variableAccess.isWritable();
this.isRequired = variableAccess.isRequired();
}
public TaskFormParameter(TaskFormParameter other) {
this.label = other.label;
this.description = other.description;
this.value = other.value;
this.isReadable = other.isReadable;
this.isWritable = other.isWritable;
this.isRequired = other.isRequired;
}
public static TaskFormParameter create(TaskInstance instance, String name, Object value, Session session) {
TaskFormParameter taskFormParameter = null;
return taskFormParameter;
}
public String toString() {
return "("+label+","+value+")";
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isReadable() {
return isReadable;
}
public void setReadable(boolean isReadable) {
this.isReadable = isReadable;
}
public boolean isRequired() {
return isRequired;
}
public void setRequired(boolean isRequired) {
this.isRequired = isRequired;
}
public boolean isWritable() {
return isWritable;
}
public boolean isReadOnly() {
return !isWritable;
}
public void setWritable(boolean isWritable) {
this.isWritable = isWritable;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}

View File

@@ -0,0 +1,125 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.Date;
/**
* Token Bean Implementation.
*
* @author David Loiseau
*/
public class TokenBean {
long id;
String name;
String nodeName;
String nodeClassName;
Date start;
Date end;
long level;
public TokenBean(long id, String name, String nodeName, String nodeClassName, Date start, Date end, long level) {
this.id = id;
this.name = name;
this.nodeName = nodeName;
this.nodeClassName = nodeClassName;
this.start = start;
this.end = end;
this.level = level;
}
private String getTypeNameFromClassName(String className) {
String typeName = "";
if (className.indexOf(".") > 0) {
typeName = className.substring(className.lastIndexOf(".") + 1);
}
return typeName;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
String label = "";
int i = 1;
while (i < this.level) {
label = label + "---";
i++;
}
if (i > 1)
label = label + " ";
label = label + this.name;
return label;
}
public String getNodeName() {
return nodeName;
}
public void setNodeName(String nodeName) {
this.nodeName = nodeName;
}
public Date getEnd() {
return end;
}
public void setEnd(Date end) {
this.end = end;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public String getNodeType() {
return getTypeNameFromClassName(this.nodeClassName);
}
public boolean isSignal() {
if (this.end == null)
return true;
return false;
}
}

View File

@@ -0,0 +1,77 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.model.SelectItem;
import org.hibernate.Session;
import org.jbpm.JbpmContext;
import org.jbpm.identity.User;
import org.jbpm.identity.hibernate.IdentitySession;
public class UserBean {
String userName;
public String getUserName() {
return userName;
}
public void setUserName(String name) {
this.userName = name;
}
public String login() {
JbpmContext.getCurrentJbpmContext().setActorId(userName);
return "home";
}
public List getUsers() {
Session session = JbpmContext.getCurrentJbpmContext().getSession();
IdentitySession identitySession = new IdentitySession(session);
return identitySession.getUsers();
}
public List getUserSelectItems() {
List userSelectItems = new ArrayList();
Iterator iter = getUsers().iterator();
while (iter.hasNext()) {
User user = (User) iter.next();
userSelectItems.add(new UserSelectItem(user));
}
return userSelectItems;
}
public static class UserSelectItem extends SelectItem {
private static final long serialVersionUID = 1L;
public UserSelectItem(User user) {
setValue(user.getName());
setLabel(user.getName());
}
}
}

View File

@@ -0,0 +1,55 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.bean;
/**
* Variable Bean Implementation.
*
* @author David Loiseau
*/
public class VariableBean {
String name;
Object value;
public VariableBean(String name, Object value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}

View File

@@ -0,0 +1,44 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.context;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class BpmContext {
ProcessDefinition processDefinition;
TaskInstance taskInstance;
public ProcessDefinition getProcessDefinition() {
return processDefinition;
}
public void setProcessDefinition(ProcessDefinition processDefinition) {
this.processDefinition = processDefinition;
}
public TaskInstance getTaskInstance() {
return taskInstance;
}
public void setTaskInstance(TaskInstance taskInstance) {
this.taskInstance = taskInstance;
}
}

View File

@@ -0,0 +1,60 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.context;
import java.util.HashMap;
import java.util.Map;
public class Context {
static ThreadLocal contextsThreadLocal = new ThreadLocal();
public static void create() {
contextsThreadLocal.set(new HashMap());
}
public static void destroy() {
contextsThreadLocal.set(null);
}
public static Object getContext(Class clazz) {
Map contexts = (Map) contextsThreadLocal.get();
Object context = contexts.get(clazz);
if (context==null) {
try {
context = clazz.newInstance();
contexts.put(clazz, context);
} catch (Exception e) {
throw new RuntimeException("couldn't instantiate context '"+clazz.getName()+"'");
}
}
return context;
}
public static PersistenceContext getPersistenceContext() {
return (PersistenceContext) getContext(PersistenceContext.class);
}
public static BpmContext getBpmContext() {
return (BpmContext) getContext(BpmContext.class);
}
}

View File

@@ -0,0 +1,83 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.jbpm.db.JbpmSession;
import org.jbpm.db.JbpmSessionFactory;
import org.jbpm.identity.hibernate.IdentitySession;
public class PersistenceContext {
static String jndiName = "java:/jbpm/SessionFactory";
static JbpmSessionFactory jbpmSessionFactory = null;
static {
try {
InitialContext initialContext = new InitialContext();
Object o = initialContext.lookup(jndiName);
SessionFactory sessionFactory = (SessionFactory) PortableRemoteObject.narrow(o, SessionFactory.class);
jbpmSessionFactory = new JbpmSessionFactory(null, sessionFactory);
} catch (Exception e) {
throw new RuntimeException("couldn't get the hibernate session factory from jndi entry '"+jndiName+"'", e);
}
}
boolean isRollbackOnly;
JbpmSession jbpmSession;
IdentitySession identitySession;
public void beginTransaction() {
isRollbackOnly = false;
log.debug("beginning transaction");
jbpmSession = jbpmSessionFactory.openJbpmSessionAndBeginTransaction();
identitySession = new IdentitySession(jbpmSession.getSession());
}
public void endTransaction() {
if (isRollbackOnly) {
log.debug("rolling back transaction");
jbpmSession.rollbackTransactionAndClose();
} else {
log.debug("committing transaction");
jbpmSession.commitTransactionAndClose();
}
}
public void setRollbackOnly() {
isRollbackOnly = true;
}
public IdentitySession getIdentitySession() {
return identitySession;
}
public JbpmSession getJbpmSession() {
return jbpmSession;
}
private static final Log log = LogFactory.getLog(PersistenceContext.class);
}

View File

@@ -0,0 +1,60 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.jbpm.JbpmContext;
import org.jbpm.webapp.bean.UserBean;
public class AuthenticationFilter implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpSession session = request.getSession();
UserBean userBean = null;
if (session!=null) {
userBean = (UserBean) session.getAttribute("userBean");
}
if (userBean!=null) {
String actorId = userBean.getUserName();
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
jbpmContext.setActorId(actorId);
}
filterChain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
}
}

View File

@@ -0,0 +1,88 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.filter;
import java.io.IOException;
import java.io.Serializable;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.service.transaction.TransactionService;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
public class JbpmContextFilter implements Filter, Serializable
{
private static final long serialVersionUID = 1L;
private ServletContext context;
public void init(FilterConfig filterConfig) throws ServletException
{
this.context = filterConfig.getServletContext();
}
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain)
throws IOException, ServletException
{
WebApplicationContext wc = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
final JbpmConfiguration jbpmConfig = (JbpmConfiguration) wc.getBean("jbpm_configuration");
TransactionService trx = (TransactionService) wc.getBean("TransactionService");
TransactionUtil.executeInUserTransaction(trx, new TransactionUtil.TransactionWork<Object>()
{
public Object doWork() throws Exception
{
JbpmContext jbpmContext = jbpmConfig.createJbpmContext();
try
{
String actorId = AuthenticationUtil.getCurrentUserName();
if (actorId != null)
{
jbpmContext.setActorId(actorId);
}
filterChain.doFilter(servletRequest, servletResponse);
}
finally
{
jbpmContext.close();
}
return null;
}
});
}
public void destroy()
{
}
}

View File

@@ -0,0 +1,69 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.filter;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class LogFilter implements Filter {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
log.debug("request "+request.getRequestURL());
Enumeration enumeration = request.getParameterNames();
while (enumeration.hasMoreElements()) {
String paramName = (String) enumeration.nextElement();
log.debug("request parameter ["+paramName+"]="+request.getParameter(paramName));
}
HttpSession session = request.getSession();
enumeration = session.getAttributeNames();
while (enumeration.hasMoreElements()) {
String attributeName = (String) enumeration.nextElement();
log.debug("session parameter ["+attributeName+"]="+session.getAttribute(attributeName));
}
filterChain.doFilter(servletRequest, servletResponse);
}
public void init(FilterConfig filterConfig) throws ServletException {
}
public void destroy() {
}
private static final Log log = LogFactory.getLog(LogFilter.class);
}

View File

@@ -0,0 +1,68 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.zip.ZipInputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
/**
* servlet to be used by the process designer to deploy processes.
*/
public class DeployServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String archive = request.getParameter("archive");
log.debug("deploying archive "+archive);
PrintWriter writer = response.getWriter();
try {
URL archiveUrl = new URL(archive);
ZipInputStream zis = new ZipInputStream(archiveUrl.openStream());
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zis);
jbpmContext.deployProcessDefinition(processDefinition);
zis.close();
writer.write("Deployed archive "+archive+" successfully");
} catch (Exception e) {
e.printStackTrace();
writer.write("Deploying archive "+archive+" failed");
}
}
private static Log log = LogFactory.getLog(DeployServlet.class);
}

View File

@@ -0,0 +1,55 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.servlet;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
public class ProcessImageServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) );
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId);
byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg");
OutputStream out = response.getOutputStream();
out.write(bytes);
out.flush();
// leave this in. it is in case we want to set the mime type later.
// get the mime type
// String contentType = URLConnection.getFileNameMap().getContentTypeFor( fileName );
// set the content type (=mime type)
// response.setContentType( contentType );
}
}

View File

@@ -0,0 +1,119 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.servlet;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.ParameterParser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
public class UploadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private class GPDUpload extends DiskFileUpload
{
@Override
protected byte[] getBoundary(String contentType)
{
return super.getBoundary(contentType.replace(",", ";"));
}
}
public void service(HttpServletRequest request, HttpServletResponse response)
throws IOException {
response.setContentType("text/html");
response.getWriter().println(handleRequest(request));
}
public void printInput(HttpServletRequest request) throws IOException {
InputStream inputStream = request.getInputStream();
StringBuffer buffer = new StringBuffer();
int read;
while ((read = inputStream.read()) != -1) {
buffer.append((char)read);
}
log.debug(buffer.toString());
}
private String handleRequest(HttpServletRequest request) {
if (!FileUpload.isMultipartContent(request)) {
log.debug("Not a multipart request");
return "Not a multipart request";
}
try {
GPDUpload fileUpload = new GPDUpload();
List list = fileUpload.parseRequest(request);
Iterator iterator = list.iterator();
if (!iterator.hasNext()) {
log.debug("No process file in the request");
return "No process file in the request";
}
FileItem fileItem = (FileItem)iterator.next();
if (fileItem.getContentType().indexOf("application/x-zip-compressed") == -1) {
log.debug("Not a process archive");
return "Not a process archive";
}
return doDeployment(fileItem);
} catch (FileUploadException e) {
e.printStackTrace();
return "FileUploadException";
}
}
private String doDeployment(FileItem fileItem) {
try {
ZipInputStream zipInputStream = new ZipInputStream(fileItem.getInputStream());
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
log.debug("Created a processdefinition : " + processDefinition.getName() );
jbpmContext.deployProcessDefinition(processDefinition);
zipInputStream.close();
return "Deployed archive " + processDefinition.getName() + " successfully";
} catch (IOException e) {
return "IOException";
}
}
private static Log log = LogFactory.getLog(UploadServlet.class);
}

View File

@@ -0,0 +1,244 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.jbpm.webapp.tag;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.XPath;
import org.dom4j.xpath.DefaultXPath;
import org.jbpm.JbpmContext;
import org.jbpm.file.def.FileDefinition;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class ProcessImageTag extends TagSupport {
private static final long serialVersionUID = 1L;
private long taskInstanceId = -1;
private long tokenInstanceId = -1;
private byte[] gpdBytes = null;
private byte[] imageBytes = null;
private Token currentToken = null;
private ProcessDefinition processDefinition = null;
static String currentTokenColor = "red";
static String childTokenColor = "blue";
static String tokenNameColor = "blue";
public void release() {
taskInstanceId = -1;
gpdBytes = null;
imageBytes = null;
currentToken = null;
}
public int doEndTag() throws JspException {
try {
initialize();
retrieveByteArrays();
if (gpdBytes != null && imageBytes != null) {
writeTable();
}
} catch (IOException e) {
e.printStackTrace();
throw new JspException("table couldn't be displayed", e);
} catch (DocumentException e) {
e.printStackTrace();
throw new JspException("table couldn't be displayed", e);
}
release();
return EVAL_PAGE;
}
private void retrieveByteArrays() {
try {
FileDefinition fileDefinition = processDefinition.getFileDefinition();
gpdBytes = fileDefinition.getBytes("gpd.xml");
imageBytes = fileDefinition.getBytes("processimage.jpg");
} catch (Exception e) {
e.printStackTrace();
}
}
private void writeTable() throws IOException, DocumentException {
int borderWidth = 4;
Element rootDiagramElement = DocumentHelper.parseText(new String(gpdBytes)).getRootElement();
int[] boxConstraint;
int[] imageDimension = extractImageDimension(rootDiagramElement);
String imageLink = "/alfresco/processimage?definitionId=" + processDefinition.getId();
JspWriter jspOut = pageContext.getOut();
if (tokenInstanceId > 0) {
List allTokens = new ArrayList();
walkTokens(currentToken, allTokens);
jspOut.println("<div style='position:relative; background-image:url(" + imageLink + "); width: " + imageDimension[0] + "px; height: " + imageDimension[1] + "px;'>");
for (int i = 0; i < allTokens.size(); i++)
{
Token token = (Token) allTokens.get(i);
//check how many tokens are on teh same level (= having the same parent)
int offset = i;
if(i > 0) {
while(offset > 0 && ((Token) allTokens.get(offset - 1)).getParent().equals(token.getParent())) {
offset--;
}
}
boxConstraint = extractBoxConstraint(rootDiagramElement, token);
//Adjust for borders
//boxConstraint[2]-=borderWidth*2;
//boxConstraint[3]-=borderWidth*2;
jspOut.println("<div style='position:absolute; left: "+ boxConstraint[0] +"px; top: "+ boxConstraint[1] +"px; ");
if (i == (allTokens.size() - 1)) {
jspOut.println("border: " + currentTokenColor);
}
else {
jspOut.println("border: " + childTokenColor);
}
jspOut.println(" " + borderWidth + "px groove; "+
"width: "+ boxConstraint[2] +"px; height: "+ boxConstraint[3] +"px;'>");
if(token.getName()!=null)
{
jspOut.println("<span style='color:" + tokenNameColor + ";font-style:italic;position:absolute;left:"+ (boxConstraint[2] + 10) +"px;top:" +((i - offset) * 20) +";'>&nbsp;" + token.getName() +"</span>");
}
jspOut.println("</div>");
}
jspOut.println("</div>");
}
else
{
boxConstraint = extractBoxConstraint(rootDiagramElement);
jspOut.println("<table border=0 cellspacing=0 cellpadding=0 width=" + imageDimension[0] + " height=" + imageDimension[1] + ">");
jspOut.println(" <tr>");
jspOut.println(" <td width=" + imageDimension[0] + " height=" + imageDimension[1] + " style=\"background-image:url(" + imageLink + ")\" valign=top>");
jspOut.println(" <table border=0 cellspacing=0 cellpadding=0>");
jspOut.println(" <tr>");
jspOut.println(" <td width=" + (boxConstraint[0] - borderWidth) + " height=" + (boxConstraint[1] - borderWidth)
+ " style=\"background-color:transparent;\"></td>");
jspOut.println(" </tr>");
jspOut.println(" <tr>");
jspOut.println(" <td style=\"background-color:transparent;\"></td>");
jspOut.println(" <td style=\"border-color:" + currentTokenColor + "; border-width:" + borderWidth + "px; border-style:groove; background-color:transparent;\" width="
+ boxConstraint[2] + " height=" + (boxConstraint[3] + (2 * borderWidth)) + ">&nbsp;</td>");
jspOut.println(" </tr>");
jspOut.println(" </table>");
jspOut.println(" </td>");
jspOut.println(" </tr>");
jspOut.println("</table>");
}
}
private int[] extractBoxConstraint(Element root) {
int[] result = new int[4];
String nodeName = currentToken.getNode().getName();
XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");
Element node = (Element) xPath.selectSingleNode(root);
result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue();
result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue();
result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue();
result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue();
return result;
}
private int[] extractBoxConstraint(Element root, Token token) {
int[] result = new int[4];
String nodeName = token.getNode().getName();
XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");
Element node = (Element) xPath.selectSingleNode(root);
result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue();
result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue();
result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue();
result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue();
return result;
}
private int[] extractImageDimension(Element root) {
int[] result = new int[2];
result[0] = Integer.valueOf(root.attribute("width").getValue()).intValue();
result[1] = Integer.valueOf(root.attribute("height").getValue()).intValue();
return result;
}
private void initialize() {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (this.taskInstanceId > 0) {
TaskInstance taskInstance = jbpmContext.getTaskMgmtSession().loadTaskInstance(taskInstanceId);
currentToken = taskInstance.getToken();
}
else
{
if (this.tokenInstanceId > 0)
currentToken = jbpmContext.getGraphSession().loadToken(this.tokenInstanceId);
}
processDefinition = currentToken.getProcessInstance().getProcessDefinition();
}
private void walkTokens(Token parent, List allTokens)
{
Map children = parent.getChildren();
if(children != null && children.size() > 0)
{
Collection childTokens = children.values();
for (Iterator iterator = childTokens.iterator(); iterator.hasNext();)
{
Token child = (Token) iterator.next();
walkTokens(child, allTokens);
}
}
allTokens.add(parent);
}
public void setTask(long id) {
this.taskInstanceId = id;
}
public void setToken(long id) {
this.tokenInstanceId = id;
}
}

563
source/web/WEB-INF/c.tld Normal file
View File

@@ -0,0 +1,563 @@
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
<validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator>
<tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Simple conditional tag that establishes a context for
mutually exclusive conditional operations, marked by
&lt;when&gt; and &lt;otherwise&gt;
</description>
<name>choose</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Simple conditional tag, which evalutes its body if the
supplied condition is true and optionally exposes a Boolean
scripting variable representing the evaluation of this condition
</description>
<name>if</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or
not the body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resulting value of the test condition. The type
of the scoped variable is Boolean.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves an absolute or relative URL and exposes its contents
to either the page, a String in 'var', or a Reader in 'varReader'.
</description>
<name>import</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to import.
</description>
<name>url</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is Reader.
</description>
<name>varReader</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when accessing a relative
URL resource that belongs to a foreign
context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Character encoding of the content at the input
resource.
</description>
<name>charEncoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
</description>
<name>forEach</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
Collection of items to iterate over.
</description>
<name>items</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration begins at the item located at the
specified index. First item of the collection has
index 0.
If items not specified:
Iteration begins with index set at the value
specified.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration ends at the item located at the
specified index (inclusive).
If items not specified:
Iteration ends when index reaches the value
specified.
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step items of
the collection, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility. Its type depends
on the object of the underlying collection.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of type
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Iterates over tokens, separated by the supplied delimeters
</description>
<name>forTokens</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
String of tokens to iterate over.
</description>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
The set of delimiters (the characters that
separate the tokens in the string).
</description>
<name>delims</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
Iteration begins at the token located at the
specified index. First token has index 0.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration ends at the token located at the
specified index (inclusive).
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step tokens
of the string, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of
type
javax.servlet.jsp.jstl.core.LoopTag
Status. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Like &lt;%= ... &gt;, but for expressions.
</description>
<name>out</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Default value if the resulting value is null.
</description>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Determines whether characters &lt;,&gt;,&amp;,'," in the
resulting string should be converted to their
corresponding character entity codes. Default value is
true.
</description>
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
and runs only if all of the prior conditions evaluated to
'false'
</description>
<name>otherwise</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Adds a parameter to a containing 'import' tag's URL.
</description>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the query string parameter.
</description>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Value of the parameter.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Redirects to a new URL.
</description>
<name>redirect</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to redirect to.
</description>
<name>url</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when redirecting to a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Removes a scoped variable (from a particular scope, if specified).
</description>
<name>remove</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
<body-content>empty</body-content>
<attribute>
<description>
Name of the scoped variable to be removed.
</description>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Sets the result of an expression evaluation in a 'scope'
</description>
<name>set</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable to hold the value
specified in the action. The type of the scoped variable is
whatever type the value expression evaluates to.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Target object whose property will be set. Must evaluate to
a JavaBeans object with setter property property, or to a
java.util.Map object.
</description>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the property to be set in the target object.
</description>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Creates a URL with optional query parameters.
</description>
<name>url</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
processed url. The type of the scoped variable is
String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
URL to be processed.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when specifying a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of &lt;choose&gt; that includes its body if its
condition evalutes to 'true'
</description>
<name>when</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or not the
body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
</tag>
</taglib>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config
PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>userBean</managed-bean-name>
<managed-bean-class>org.jbpm.webapp.bean.AlfrescoUserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>authenticationService</property-name>
<value>#{AuthenticationService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>homeBean</managed-bean-name>
<managed-bean-class>org.jbpm.webapp.bean.HomeBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>taskBean</property-name>
<value>#{taskBean}</value>
</managed-property>
<managed-property>
<property-name>userBean</property-name>
<value>#{userBean}</value>
</managed-property>
<managed-property>
<property-name>jbpmConfiguration</property-name>
<value>#{jbpm_configuration}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>taskBean</managed-bean-name>
<managed-bean-class>org.jbpm.webapp.bean.TaskBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userBean</property-name>
<value>#{userBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>monitoringBean</managed-bean-name>
<managed-bean-class>org.jbpm.webapp.bean.MonitoringBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/jbpm/login.jsp</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/jbpm/home.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/home.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/jbpm/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/home.jsp</from-view-id>
<navigation-case>
<from-outcome>task</from-outcome>
<to-view-id>/jbpm/task.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/task.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/jbpm/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/task.jsp</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/jbpm/home.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/dashboards/container.jsp</from-view-id>
<navigation-case>
<from-outcome>task</from-outcome>
<to-view-id>/jbpm/task_view.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/task_view.jsp</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/jsp/dashboards/container.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/monitor.jsp</from-view-id>
<navigation-case>
<from-outcome>processDefinitions</from-outcome>
<to-view-id>/jbpm/process_definitions.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>showSearchInstances</from-outcome>
<to-view-id>/jbpm/search_instances.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/process_definitions.jsp</from-view-id>
<navigation-case>
<from-outcome>processInstances</from-outcome>
<to-view-id>/jbpm/process_instances.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jbpm/inspect_instance.jsp</from-view-id>
<navigation-case>
<from-outcome>processInstances</from-outcome>
<to-view-id>/jbpm/process_instances.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>showTransitions</from-outcome>
<to-view-id>/jbpm/inspect_instance_transitions.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>inspectInstance</from-outcome>
<to-view-id>/jbpm/inspect_instance.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!DOCTYPE taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>jBPM tags</shortname>
<info>jBPM tags</info>
<!-- PROCESS IMAGE -->
<tag>
<name>processimage</name>
<tagclass>org.jbpm.webapp.tag.ProcessImageTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>task</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>processimageToken</name>
<tagclass>org.jbpm.webapp.tag.ProcessImageTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>token</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

View File

@@ -16,7 +16,7 @@
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml,/WEB-INF/faces-config-enterprise.xml</param-value>
<param-value>/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml,/WEB-INF/faces-config-enterprise.xml,/WEB-INF/faces-config-jbpm.xml</param-value>
</context-param>
<context-param>
@@ -92,6 +92,31 @@
-->
</filter>
<!-- -->
<!-- JBPM START -->
<!-- TODO: Remove this block - just a temporary placement for testing -->
<!-- -->
<filter>
<filter-name>LogFilter</filter-name>
<filter-class>org.jbpm.webapp.filter.LogFilter</filter-class>
</filter>
<filter>
<filter-name>JbpmContextFilter</filter-name>
<filter-class>org.jbpm.webapp.filter.JbpmContextFilter</filter-class>
<!-- <filter-class>org.jbpm.webapp.filter.JbpmContextFilter</filter-class> -->
</filter>
<!--
<filter>
<filter-name>JbpmAuthenticationFilter</filter-name>
<filter-class>org.jbpm.webapp.filter.AuthenticationFilter</filter-class>
</filter>
-->
<!-- -->
<!-- JBPM END -->
<!-- -->
<filter-mapping>
<filter-name>Authentication Filter</filter-name>
<url-pattern>/faces/*</url-pattern>
@@ -111,6 +136,42 @@
<url-pattern>/webdav/*</url-pattern>
</filter-mapping>
<!-- -->
<!-- JBPM START -->
<!-- TODO: Remove this block - just a temporary placement for testing -->
<!-- -->
<filter-mapping>
<filter-name>LogFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>JbpmContextFilter</filter-name>
<url-pattern>/faces/jbpm/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>JbpmContextFilter</filter-name>
<url-pattern>/processimage</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>JbpmContextFilter</filter-name>
<url-pattern>/faces/jsp/dashboards/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>JbpmContextFilter</filter-name>
<url-pattern>/upload</url-pattern>
</filter-mapping>
<!--
<filter-mapping>
<filter-name>JbpmAuthenticationFilter</filter-name>
<url-pattern>/faces/jbpm/*</url-pattern>
</filter-mapping>
-->
<!-- -->
<!-- JBPM END -->
<!-- -->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
@@ -179,7 +240,40 @@
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<!-- -->
<!-- JBPM START -->
<!-- TODO: Remove this block - just a temporary placement for testing -->
<!-- -->
<!--
<servlet>
<servlet-name>JbpmThreadsServlet</servlet-name>
<servlet-class>org.jbpm.web.JbpmThreadsServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-->
<!-- jBPM FileServlet -->
<servlet>
<servlet-name>ProcessImageServlet</servlet-name>
<servlet-class>org.jbpm.webapp.servlet.ProcessImageServlet</servlet-class>
</servlet>
<!-- jBPM DeployServlet -->
<servlet>
<servlet-name>DeployServlet</servlet-name>
<servlet-class>org.jbpm.webapp.servlet.DeployServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>UploadServlet</servlet-name>
<servlet-class>org.jbpm.webapp.servlet.UploadServlet</servlet-class>
</servlet>
<!-- -->
<!-- JBPM END -->
<!-- -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
@@ -224,7 +318,39 @@
<servlet-name>WebDAV</servlet-name>
<url-pattern>/webdav/*</url-pattern>
</servlet-mapping>
<!-- -->
<!-- JBPM START -->
<!-- TODO: Remove this block - just a temporary placement for testing -->
<!-- -->
<!--
<servlet-mapping>
<servlet-name>JbpmThreadsServlet</servlet-name>
<url-pattern>/threads</url-pattern>
</servlet-mapping>
-->
<!-- jBPM FileServlet -->
<servlet-mapping>
<servlet-name>ProcessImageServlet</servlet-name>
<url-pattern>/processimage</url-pattern>
</servlet-mapping>
<!-- jBPM DeployServlet -->
<servlet-mapping>
<servlet-name>DeployServlet</servlet-name>
<url-pattern>/deploy</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>UploadServlet</servlet-name>
<url-pattern>/upload</url-pattern>
</servlet-mapping>
<!-- -->
<!-- JBPM END -->
<!-- -->
<session-config>
<session-timeout>60</session-timeout>
</session-config>
@@ -233,4 +359,9 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</web-app>

47
source/web/jbpm/admin.jsp Normal file
View File

@@ -0,0 +1,47 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<jsp:include page="header1.jsp" />
Administration
<jsp:include page="header2.jsp" />
<b><h:messages /></b>
TODO
<%--
(this page is not yet implemented)
<h4>Deploy process</h4>
<h:form id="deploy">
<h:inputText value="#{adminBean.deployUrl}" /> &nbsp;&nbsp;
<h:commandButton action="#{adminBean.deployProcess}" value="Deploy" />
</h:form>
<h4>Database Schema</h4>
<h:form id="createschema">
<h:commandButton action="#{adminBean.createSchema}" value="Create Schema" />
</h:form>
<h:form id="dropschema">
<h:commandButton action="#{adminBean.dropSchema}" value="Drop Schema" />
</h:form>
<h4>Scheduler</h4>
<h:dataTable value="#{adminBean.schedulerHistoryLogs}" var="schedulerLog">
<h:column >
<h:outputText value="#{schedulerLog.date}">
<f:convertDateTime type="date" dateStyle="full"/>
</h:outputText>
</h:column>
<h:column >
<h:outputText value="#{schedulerLog.timer}" />
</h:column>
<h:column >
<h:outputText value="#{schedulerLog.exception}" />
</h:column>
</h:dataTable>
--%>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,106 @@
body, td, p {
font-family:verdana;
font-size:10pt;
}
a {
color: rgb(110, 110, 110);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
div.nav2 {
background-color:#5c5c4f;
color:#ffffff;
font-size: 12px;
font-weight: bold;
text-decoration: none;
line-height: 12px;
border: 0px;
margin-left: 0px;
margin-right: 1px;
margin-top: 1px;
margin-bottom: 0px;
padding-top:5px;
padding-bottom:5px;
width:174px;
cursor: pointer;
}
div.innerNav {
position:relative;
left:10px;
}
a.nav {
font-size: 12px;
font-weight: bold;
text-decoration: none;
line-height: 12px;
width:100%;
background-color:#5c5c4f;
color:#ffffff;
border: 0px;
margin-left: 0px;
margin-right: 1px;
margin-top: 1px;
margin-bottom: 0px;
padding-left:10px;
padding-right:10px;
padding-top:5px;
padding-bottom:5px;
}
div.nav {
font-size: 12px;
font-weight: bold;
text-decoration: none;
line-height: 12px;
width:174;
background-color:#5c5c4f;
color:#ffffff;
border: 0px;
height: 20px;
margin-left: 0px;
margin-right: 1px;
margin-top: 1px;
margin-bottom: 0px;
vertical-align:middle;
padding-left:10px;
padding-top:5px;
padding-bottom:5px;
}
a.ref {
padding: 5px;
color: rgb(110, 110, 110);
text-decoration: none;
font-size: 11px;
line-height: 18px;
}
h1, h2, h3, h4, h5, h6 {
font-family:arial;
color:purple;
border-bottom:0px;
margin-bottom:0px;
padding-bottom:0px;
}
td.tablecell {
padding-left:10px;
padding-right:10px;
background-color:#eeeeee;
}
th.tableheader {
text-align:center;
text-weight:bold;
padding-right:10px;
padding-left:10px;
color:#ffffff;
background-color:#999999;
}

View File

@@ -0,0 +1,12 @@
<!-- FOOTER -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ page import="org.jbpm.webapp.bean.*" %>
<!-- HEADER -->
<html>
<head><title>JBoss jBPM</title>
<link rel="stylesheet" type="text/css" href="css/jbpm.css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<!-- next line must be put one (1!) line to overcome an IE-layouting bug -->
<td><a href="http://www.jboss.com/"><img src="images/logo_green.gif" alt="JBoss Inc." border="0" /></a></td>
<td width="100%" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="22" bgcolor="#9BCD4B" align="center" nowrap="nowrap">
</td>
</tr>
<tr>
<td width="100%" align="right" valign="middle" nowrap="nowrap">
<a class="ref" href="/alfresco">Alfresco Web Client</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/docs">Docs</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/forums">Forums</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/wiki">Wiki</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/downloads">Download</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/contact">Contact</a> &nbsp;&nbsp; &nbsp;&nbsp;
</td>
</tr>
<tr>
<td width="100%" valign="top" nowrap="nowrap">
<hr style="margin:0px; padding:0px;" size="1" width="100%" />
<h2 style="padding:0px; margin:0px; border:0px;" >

View File

@@ -0,0 +1,31 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
</h2>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%" colspan="2" valign="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="217" height="3px" valign="top"><img src="images/hdr_green_side.gif" alt="green side" /></td>
</tr>
<tr>
<td width="175" valign="top">
<a href="home.jsp"><div class="nav2" onmouseover="this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';"><div class="innerNav">Home</div></div></a>
<a href="admin.jsp"><div class="nav2" onmouseover="this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';"><div class="innerNav">Administration</div></div></a>
<a href="monitor.jsp"><div class="nav2" onmouseover="this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';"><div class="innerNav">Monitoring</div></div></a>
</td>
</tr>
</table>
</td>
<td height="100%" width="100%" valign="top">
<!-- CONTENT -->

64
source/web/jbpm/home.jsp Normal file
View File

@@ -0,0 +1,64 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<jsp:include page="header1.jsp" />
Home
<jsp:include page="header2.jsp" />
<b><h:messages /></b>
<h4>Tasklist</h4>
<h:dataTable id="taskinstances" value="#{homeBean.taskInstancesModel}" var="taskInstance" headerClass="tableheader" columnClasses="tablecell">
<h:column id="colTISelect">
<f:facet name="header">
<h:outputText value="Task Form Link" />
</f:facet>
<h:commandLink id="selectTaskInstance" action="#{homeBean.selectTaskInstance}">
<h:outputText id="selectOutTaskInstance" value="#{taskInstance.name}" />
</h:commandLink>
</h:column>
<h:column id="colTIProcessName">
<f:facet name="header">
<h:outputText value="Process" />
</f:facet>
<h:outputText id="colOutTIProcessName" value="#{taskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.name}" />
</h:column>
<h:column id="colTIProcessVer">
<f:facet name="header">
<h:outputText value="Version" />
</f:facet>
<h:outputText id="colOutTIProcessVer" value="#{taskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.version}" />
</h:column>
</h:dataTable>
<h4>Start New Process Execution</h4>
<h:dataTable id="processdefs" value="#{homeBean.latestProcessDefinitionsModel}" var="processDefinition" headerClass="tableheader" columnClasses="tablecell">
<h:column id="colProcessLink">
<f:facet name="header">
<h:outputText value="Start Process Link" />
</f:facet>
<h:commandLink id="startProcessInstance1" rendered="#{processDefinition.taskMgmtDefinition.startTask != null}" action="#{homeBean.startProcessInstance}">
<h:outputText id="colOutProcessLink1" value="#{processDefinition.taskMgmtDefinition.startTask.name}" />
</h:commandLink>
<h:commandLink id="startProcessInstance2" rendered="#{processDefinition.taskMgmtDefinition.startTask == null}" action="#{homeBean.startProcessInstance}">
<h:outputText id="colOutProcessLink2" value="start process" />
</h:commandLink>
</h:column>
<h:column id="colProcess">
<f:facet name="header">
<h:outputText value="Process" />
</f:facet>
<h:outputText id="colOutProcess" value="#{processDefinition.name}" />
</h:column>
<h:column id="colVersion">
<f:facet name="header">
<h:outputText value="Version" />
</f:facet>
<h:outputText id="colOutVersion" value="#{processDefinition.version}" />
</h:column>
</h:dataTable>
<jsp:include page="footer.jsp" />
</f:view>

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@@ -0,0 +1,190 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %>
<%@ page isELIgnored="false" %>
<f:view locale="#{facesContext.externalContext.request.locale}">
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Inspect Instance
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<br />
<i><h:commandLink styleClass="standard" value="Refresh" action="#{processInstanceBean.inspectProcessInstance}" style="float: right;" ><h:outputText value=" page" /></h:commandLink></i>
<h:outputText value="Process Instance Id"/>:
<b><h:commandLink styleClass="standard" value="#{processInstanceBean.id}" action="#{processInstanceBean.inspectProcessInstance}" /></b>
<br />
<h:outputText value="Process Definition"/>:
<b><h:commandLink value="#{processInstanceBean.processDefinitionLabel}" action="#{processInstanceBean.showProcessInstances}" /></b>
<br />
<h:outputText value="Process Instance Start"/>:
<b>
<h:outputText value="#{processInstanceBean.start}">
<f:convertDateTime type="both"/>
</h:outputText>
</b>
<br />
<h:outputText value="Process Instance End"/>:
<b>
<h:outputText value="#{processInstanceBean.end}">
<f:convertDateTime type="both"/>
</h:outputText>
</b>
<br />
<hr>
<h4>Tasks</h4>
<h:dataTable id="tasks" value="#{processInstanceBean.tasks}" var="task" headerClass="tableheader" columnClasses="tablecell" >
<h:column id="colTaskId">
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText id="colOutTaskId" value="#{task.taskInstanceId}"/>
</h:column>
<h:column id="colTaskName">
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText id="colOutTaskName" value="#{task.name}"/>
</h:column>
<h:column id="colTaskActor">
<f:facet name="header">
<h:outputText value="ActorId"/>
</f:facet>
<h:outputText id="colOutTaskActor" value="#{task.actorId}"/>
</h:column>
<h:column id="colTaskDate">
<f:facet name="header">
<h:outputText value="Date"/>
</f:facet>
<h:outputText id="colOutTaskDate" value="#{task.end}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column id="colTaskEndTask">
<h:commandLink id="endTask" rendered="#{task.ended}" action="#{processInstanceBean.endTask}" >
<h:outputText id="colOutEndTask" value="End Task"/>
<f:param name="taskInstanceId" value="#{task.taskInstanceId}"/>
</h:commandLink>
</h:column>
</h:dataTable>
<h4>Variables</h4>
<h:dataTable id="variables" value="#{processInstanceBean.variables}" var="variable" headerClass="tableheader" columnClasses="tablecell" >
<h:column id="colName">
<f:facet name="header">
<h:outputText id="colOutName" value="#{msgs.name}"/>
</f:facet>
<h:outputText value="#{variable.name}"/>
</h:column>
<h:column id="colVal">
<f:facet name="header">
<h:outputText value="#{msgs.value}"/>
</f:facet>
<h:outputText id="colOutVal" value="#{variable.value}"/>
</h:column>
</h:dataTable>
<br />
<h:form>
Variable Name:
<h:inputText id="varName" value="#{processInstanceBean.variableName}" />
<br />
Variable Value:
<h:inputText id="varValue" value="#{processInstanceBean.variableValue}" />
<br />
<h:commandButton id="updateVar" value="Update" action="#{processInstanceBean.updateVariable}" />
<br />
</h:form>
<h4>Tokens</h4>
<h:dataTable id="tokens" value="#{processInstanceBean.tokens}" var="token" headerClass="tableheader" columnClasses="tablecell" >
<h:column id="colPIBLabel">
<f:facet name="header">
<h:outputText value="#{msgs.name}"/>
</f:facet>
<h:outputText id="colOutPIBLabel" value="#{token.label}"/>
</h:column>
<h:column id="colPIBID">
<f:facet name="header">
<h:outputText value="#{msgs.id}"/>
</f:facet>
<h:outputText id="colOutPIBID" value="#{token.id}"/>
</h:column>
<h:column id="colPIBName">
<f:facet name="header">
<h:outputText value="Node name"/>
</f:facet>
<h:commandLink id="selectToken" rendered="#{token.id != processInstanceBean.tokenInstanceId}" action="#{processInstanceBean.selectToken}">
<h:outputText id="colOutSelectToken" value="#{token.nodeName}"/>
<f:param name="tokenInstanceId" value="#{token.id}"/>
</h:commandLink>
<h:panelGroup id="panelToken" rendered="#{token.id == processInstanceBean.tokenInstanceId}">
<f:verbatim><b></f:verbatim>
<h:outputText id="colOutPIBName" value="#{token.nodeName}"/>
<f:verbatim></b></f:verbatim>
</h:panelGroup>
</h:column>
<h:column id="colPIBType">
<f:facet name="header">
<h:outputText value="Node type"/>
</f:facet>
<h:outputText id="colOutPIBType" value="#{token.nodeType}"/>
</h:column>
<h:column id="colPIBStart">
<f:facet name="header">
<h:outputText value="#{msgs.start}"/>
</f:facet>
<h:outputText id="colOutPIBStart" value="#{token.start}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column id="colPIBEnd">
<f:facet name="header">
<h:outputText value="#{msgs.end}"/>
</f:facet>
<h:outputText id="colOutPIBEnd" value="#{token.end}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column id="colPIBSendSignal">
<h:commandLink id="signal" rendered="#{token.signal}" action="#{processInstanceBean.signal}" >
<h:outputText id="colOutPIBSendSignal" value="Send Signal"/>
<f:param name="tokenInstanceId" value="#{token.id}"/>
</h:commandLink>
</h:column>
</h:dataTable>
<br /><br />
<jbpm:processimageToken token="${processInstanceBean.tokenInstanceId}"/>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,69 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %>
<f:view locale="#{facesContext.externalContext.request.locale}">
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Transitions
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<br />
<h:outputText value="Process Instance Id"/>:
<b><h:commandLink styleClass="standard" value="#{processInstanceBean.id}" action="#{processInstanceBean.inspectProcessInstance}" /></b>
<br />
<h:outputText value="Task Instance Id"/>:
<b><h:outputText value="#{processInstanceBean.taskInstanceId}" /></b>
<br />
<br />
<hr>
<h4>Available Transitions</h4>
<h:dataTable id="transitions" value="#{processInstanceBean.transitions}" var="transition" headerClass="tableheader" columnClasses="tablecell" >
<h:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{transition.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{transition.name}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="To"/>
</f:facet>
<h:outputText value="#{transition.to.name}"/>
</h:column>
<h:column>
<h:commandLink action="#{processInstanceBean.selectTransition}" >
<h:outputText value="Select"/>
<f:param name="transitionName" value="#{transition.name}"/>
</h:commandLink>
</h:column>
</h:dataTable>
<br /><br />
<h:commandLink action="#{processInstanceBean.selectTransition}" >
<h:outputText value="Default Transition"/>
<f:param name="transitionName" value=""/>
</h:commandLink>
<jsp:include page="footer.jsp" />
</f:view>

105
source/web/jbpm/layout.jsp Normal file
View File

@@ -0,0 +1,105 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ page import="org.jbpm.webapp.bean.*" %>
<!-- HEADER -->
<html>
<head><title>JBoss jBPM</title>
<link rel="stylesheet" type="text/css" href="css/jbpm.css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- next line must be put one (1!) line to overcome an IE-layouting bug -->
<td><a href="http://www.jboss.com/"><img src="images/logo_green.gif" alt="JBoss Inc." border="0" /></a></td>
<td width="100%" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="22" bgcolor="#9BCD4B" align="center" nowrap="nowrap">
</td>
</tr>
<tr>
<td width="100%" align="right" valign="middle" nowrap="nowrap">
<a class="ref" href="http://jbpm.org/docs">Docs</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/forums">Forums</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/wiki">Wiki</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/downloads">Download</a> &nbsp;&nbsp;
<a class="ref" href="http://jbpm.org/contact">Contact</a> &nbsp;&nbsp; &nbsp;&nbsp;
</td>
</tr>
<tr>
<td width="100%" valign="top" nowrap="nowrap">
<hr style="margin:0px; padding:0px;" size="1" width="100%" />
<h2 style="padding:0px; margin:0px; border:0px;" >
<tiles:get name="title" flush="false"/>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
</h2>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="100%" colspan="2" valign="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="top">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="217" valign="top"><img src="images/hdr_green_side.gif" alt="green side" /></td>
</tr>
<!-- next line must be put one (1!) line to overcome an IE-layouting bug -->
<tr>
<td width="175"><a href="home.jsp"><div class="nav" onmouseover="this.style.cursor='hand'; this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.cursor='default';this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';">Home</div></a></td>
</tr>
<tr>
<td width="175"><a href="admin.jsp"><div class="nav" onmouseover="this.style.cursor='hand'; this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.cursor='default';this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';">Administration</div></a></td>
</tr>
<tr>
<td width="175"><a href="monitor.jsp"><div class="nav" onmouseover="this.style.cursor='hand'; this.style.backgroundColor='#cccccc'; this.style.color='#000000';" onmouseout="this.style.cursor='default';this.style.backgroundColor='#5c5c4f'; this.style.color='#ffffff';">Monitoring</div></a></td>
</tr>
<tr>
<td width="217" valign="top"><img style="margin-top:1px;" src="images/side_nav_green_btm.gif" alt="green side" /></td>
</tr>
<tr>
<td height="100%">
<20>
</td>
</tr>
<tr>
<td>
<img src="images/swoosh_green.gif" alt="swoosh" />
</td>
</tr>
</table>
</td>
<td height="100%" width="100%" valign="top">
<!-- CONTENT -->
<tiles:get name="body" flush="false"/>
<!-- FOOTER -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view locale="#{facesContext.externalContext.request.locale}">
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Monitoring
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<br />
<b><h:outputText value="#{monitoringBean.message}" /></b>
<br /><br />
<h:commandLink action="#{monitoringBean.showProcessDefinitions}">
<h:outputText value="#{msgs.processDefinitionsList}" />
</h:commandLink>
<br /><br />
<h:commandLink action="#{monitoringBean.showSearchInstances}">
<h:outputText value="#{msgs.searchProcessInstances}"/>
</h:commandLink>
<br /><br />
<h:form>
Instance ID:
<h:inputText value="#{monitoringBean.processInstanceId}" />
<h:commandButton value="Inspect" action="#{monitoringBean.inspectInstance}" />
</h:form>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,54 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Process Definitions
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<h:dataTable id="processdefs" value="#{monitoringBean.processDefinitions}" var="processDefinition" headerClass="tableheader" columnClasses="tablecell" >
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.id}"/>
</f:facet>
<h:outputText value="#{processDefinition.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.name}"/>
</f:facet>
<h:outputText value="#{processDefinition.name}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.version}"/>
</f:facet>
<h:outputText value="#{processDefinition.version}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.instances}"/>
</f:facet>
<h:commandLink rendered="#{processDefinition.instancesCount > 0}"
action="#{processDefinition.showProcessInstances}" >
<h:outputText value="#{processDefinition.instancesCount}"/>
</h:commandLink>
<h:outputText rendered="#{processDefinition.instancesCount == 0}" value="0"/>
</h:column>
</h:dataTable>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,71 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Process Instances
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<br />
<h:outputText value="Process Definition Id"/>:
<b><h:outputText value="#{processDefinitionBean.id}"/></b>
<br />
<h:outputText value="Process Definition Name"/>:
<b><h:outputText value="#{processDefinitionBean.name}"/></b>
<br />
<h:outputText value="Process Definition Version"/>:
<b><h:outputText value="#{processDefinitionBean.version}"/></b>
<br />
<hr>
<h4>Instances</h4>
<br />
<h:dataTable id="processinstances" value="#{processDefinitionBean.processInstances}" var="processInstance" headerClass="tableheader" columnClasses="tablecell" >
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.id}"/>
</f:facet>
<h:commandLink action="#{processInstance.inspectProcessInstance}" >
<h:outputText value="#{processInstance.id}"/>
</h:commandLink>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.start}"/>
</f:facet>
<h:outputText value="#{processInstance.start}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.end}"/>
</f:facet>
<h:outputText value="#{processInstance.end}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column>
<h:commandLink action="#{processInstance.deleteProcessInstance}" >
<h:outputText value="Delete"/>
</h:commandLink>
</h:column>
</h:dataTable>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,28 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:verbatim>&nbsp;</f:verbatim>
<h:outputLink value="/alfresco/faces/jbpm/home.jsp"><h:outputText value="jBPM Console"/> </h:outputLink>
<f:verbatim><br><br></f:verbatim>
<h:dataTable id="processdefs" value="#{homeBean.latestProcessDefinitionsModel}" var="processDefinition">
<h:column id="colProcessLink">
<f:facet name="header">
<h:outputText value="Start Task" />
</f:facet>
<h:commandLink id="startProcessInstance1" rendered="#{processDefinition.taskMgmtDefinition.startTask != null}" action="#{homeBean.startProcessInstance}">
<h:outputText id="colOutProcessLink1" value="#{processDefinition.taskMgmtDefinition.startTask.name}" />
</h:commandLink>
<h:commandLink id="startProcessInstance2" rendered="#{processDefinition.taskMgmtDefinition.startTask == null}" action="#{homeBean.startProcessInstance}">
<h:outputText id="colOutProcessLink2" value="start process" />
</h:commandLink>
</h:column>
<h:column id="colProcess">
<f:facet name="header">
<h:outputText value="Workflow" />
</f:facet>
<h:outputText id="colOutProcess" value="#{processDefinition.name}" />
</h:column>
</h:dataTable>

View File

@@ -0,0 +1,26 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %>
<%@ page isELIgnored="false" %>
<% System.out.println(request.getParameter("taskInstanceId")); %>
<c:out value="${taskInstanceId}">
default value
</c:out>
Setting the value: "Hello World!"
<c:set var="hello" value="Hello World!"/>
<p/>
<c:out value="${hello}"/>
<%-- <jsp:include page="header1.jsp" /> --%>
Process View
<%-- <jsp:include page="header2.jsp" /> --%>
<jbpm:processimage task="${param[\"taskInstanceId\"]}"/>
<%-- <jsp:include page="footer.jsp" /> --%>

View File

@@ -0,0 +1,80 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view locale="#{facesContext.externalContext.request.locale}">
<f:loadBundle basename="alfresco.messages.jbpm" var="msgs"/>
<jsp:include page="header1.jsp" />
Search Instances
<jsp:include page="header2.jsp" />
<b><h:messages showDetail="true" /></b>
<h:form>
<h:outputText value="#{msgs.variableName}" />
<h:selectOneMenu value="#{monitoringBean.variableNameOperator}">
<f:selectItems value="#{monitoringBean.operatorsList}" />
</h:selectOneMenu>
<h:inputText id="Variable_name" required="true" value="#{monitoringBean.variableName}" />
<br />
<h:outputText value="#{msgs.variableValue}" />
<h:selectOneMenu value="#{monitoringBean.variableValueOperator}">
<f:selectItems value="#{monitoringBean.operatorsList}" />
</h:selectOneMenu>
<h:inputText id="Variable_value" required="true" value="#{monitoringBean.variableValue}" />
<br />
<h:commandButton value="#{msgs.search}" action="#{monitoringBean.searchInstances}" />
<br /><br />
<h:outputText value="#{monitoringBean.message}"/>
</h:form>
<hr>
<br />
<h:dataTable id="showProcessInstances" rendered="#{monitoringBean.showProcessInstances}" value="#{monitoringBean.processInstances}" var="processInstance" headerClass="tableheader" columnClasses="tablecell" >
<h:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:commandLink action="#{processInstance.inspectProcessInstance}">
<h:outputText value="#{processInstance.id}"/>
</h:commandLink>
</h:column>
<h:column rendered="#{monitoringBean.variableNameOperator == 'like'}">
<f:facet name="header">
<h:outputText value="#{msgs.variableName}"/>
</f:facet>
<h:outputText value="#{processInstance.variableName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{msgs.variableValue}"/>
</f:facet>
<h:outputText value="#{processInstance.variableValue}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Start Date"/>
</f:facet>
<h:outputText value="#{processInstance.start}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="End Date"/>
</f:facet>
<h:outputText value="#{processInstance.end}">
<f:convertDateTime type="both"/>
</h:outputText>
</h:column>
</h:dataTable>
<jsp:include page="footer.jsp" />
</f:view>

74
source/web/jbpm/task.jsp Normal file
View File

@@ -0,0 +1,74 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %>
<%@ page import="org.jbpm.webapp.bean.*" %>
<%@ page import="org.jbpm.taskmgmt.exe.*" %>
<%@ page isELIgnored="false" %>
<f:view>
<jsp:include page="header1.jsp" />
Task
<jsp:include page="header2.jsp" />
<b><h:messages/></b>
<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">
<h:form id="taskform">
<h:inputHidden id="taskInstanceId" value="#{taskBean.taskInstanceId}" />
<h2><h:outputText id="hiddenInstanceName" value="#{taskBean.taskInstance.name}" /></h2>
<hr />
<h:dataTable id="formParameters" value="#{taskBean.taskFormParameters}" var="formParameter">
<h:column>
<h:outputText id="formLabel" value="#{formParameter.label}" />
</h:column>
<h:column>
<h:outputText id="formDescription" value="#{formParameter.description}" />
</h:column>
<h:column>
<h:inputText id="formValue" value="#{formParameter.value}" readonly="#{formParameter.readOnly}" />
</h:column>
</h:dataTable>
<hr />
<h:panelGroup id="panelTransitions" rendered="#{taskBean.transitions != null}">
<h:outputText value="Task Actions:" />
<h:dataTable id="tableTransitions" value="#{taskBean.transitions}" var="transition">
<h:column id="colTransition">
<h:commandLink id="transitionButton" action="#{taskBean.saveAndClose}" value="#{transition.name}">
</h:commandLink>
</h:column>
</h:dataTable>
</h:panelGroup>
<h:panelGroup id="panelSaveAndClose" rendered="#{taskBean.transitions == null}">
<h:outputText value="Task Actions:" />
<f:verbatim><br/>&nbsp;</f:verbatim>
<h:commandLink id="transitionButton" action="#{taskBean.saveAndClose}" value="Done"/>
</h:panelGroup>
<hr />
<h:commandButton action="#{taskBean.save}" value="Save"/>
<h:commandButton action="home" value="Cancel"/>
</h:form>
</td><td valign="top">
&nbsp;&nbsp;
</td><td valign="top">
<jbpm:processimage task="${taskBean.taskInstanceId}"/>
</td>
</tr>
</table>
<jsp:include page="footer.jsp" />
</f:view>

View File

@@ -0,0 +1,20 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<h:dataTable id="taskinstances" value="#{homeBean.taskInstancesModel}" var="taskInstance" headerClass="tableheader" columnClasses="tablecell">
<h:column id="colTISelect">
<f:facet name="header">
<h:outputText value="Task" />
</f:facet>
<h:commandLink id="selectTaskInstance" action="#{homeBean.selectTaskInstance}">
<h:outputText id="selectOutTaskInstance" value="#{taskInstance.name}" />
</h:commandLink>
</h:column>
<h:column id="colTIProcessName">
<f:facet name="header">
<h:outputText value="Workflow" />
</f:facet>
<h:outputText id="colOutTIProcessName" value="#{taskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.name}" />
</h:column>
</h:dataTable>

View File

@@ -0,0 +1,70 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %>
<%@ page import="org.jbpm.webapp.bean.*" %>
<%@ page import="org.jbpm.taskmgmt.exe.*" %>
<%@ page isELIgnored="false" %>
<f:view>
<b><h:messages/></b>
<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">
<h:form id="taskform">
<h:inputHidden id="taskInstanceId" value="#{taskBean.taskInstanceId}" />
<h2><h:outputText id="hiddenInstanceName" value="#{taskBean.taskInstance.name}" /></h2>
<hr />
<h:dataTable id="formParameters" value="#{taskBean.taskFormParameters}" var="formParameter">
<h:column>
<h:outputText id="formLabel" value="#{formParameter.label}" />
</h:column>
<h:column>
<h:outputText id="formDescription" value="#{formParameter.description}" />
</h:column>
<h:column>
<h:inputText id="formValue" value="#{formParameter.value}" readonly="#{formParameter.readOnly}" />
</h:column>
</h:dataTable>
<hr />
<h:panelGroup id="panelTransitions" rendered="#{taskBean.transitions != null}">
<h:outputText value="Task Actions:" />
<h:dataTable id="tableTransitions" value="#{taskBean.transitions}" var="transition">
<h:column id="colTransition">
<h:commandLink id="transitionButton" action="#{taskBean.saveAndClose}" value="#{transition.name}">
</h:commandLink>
</h:column>
</h:dataTable>
</h:panelGroup>
<h:panelGroup id="panelSaveAndClose" rendered="#{taskBean.transitions == null}">
<h:outputText value="Task Actions:" />
<f:verbatim><br/>&nbsp;</f:verbatim>
<h:commandLink id="transitionButton" action="#{taskBean.saveAndClose}" value="Done"/>
</h:panelGroup>
<hr />
<h:commandButton action="#{taskBean.save}" value="Save"/>
<h:commandButton action="home" value="Cancel"/>
</h:form>
</td><td valign="top">
&nbsp;&nbsp;
</td><td valign="top">
<jbpm:processimage task="${taskBean.taskInstanceId}"/>
</td>
</tr>
</table>
</f:view>