/*
* 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.pvm.internal.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.client.ClientProcessInstance;
import org.jbpm.api.env.Context;
import org.jbpm.api.env.Environment;
import org.jbpm.api.job.Timer;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.Comment;
import org.jbpm.api.model.Event;
import org.jbpm.api.model.ObservableElement;
import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.model.Transition;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.ExecutionContext;
import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.HistorySession;
import org.jbpm.pvm.internal.history.events.ActivityEnd;
import org.jbpm.pvm.internal.history.events.ActivityStart;
import org.jbpm.pvm.internal.history.events.AutomaticEnd;
import org.jbpm.pvm.internal.history.events.DecisionEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceStart;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
import org.jbpm.pvm.internal.model.op.MoveToChildActivity;
import org.jbpm.pvm.internal.model.op.Signal;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.session.MessageSession;
import org.jbpm.pvm.internal.session.RepositorySession;
import org.jbpm.pvm.internal.session.TimerSession;
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
/**
* @author Tom Baeyens
*/
public class ExecutionImpl extends ScopeInstanceImpl implements
ClientProcessInstance, ActivityExecution, EventListenerExecution,
Serializable
{
private static final long serialVersionUID = 1L;
private static final Log log = Log.getLog(Execution.class.getName());
/**
* an optional name for this execution. can be used to differentiate
* concurrent paths of execution like e.g. the 'shipping' and 'billing'
* paths.
*/
protected String name;
/**
* a key for this execution. typically this is an externally provided
* reference that is unique within the scope of the process definition.
*/
protected String key;
/** a unique id for this execution. */
protected String id;
/** are concurrent executions that related to this execution. */
protected Collection<ExecutionImpl> executions;
/**
* the parent child relation of executions is convenient for some forms of
* concurrency.
*/
protected ExecutionImpl parent = null;
protected ExecutionImpl processInstance;
/** the super process link in case this is a sub process execution */
protected ExecutionImpl superProcessExecution;
/** the sub process link in case of sub process execution */
protected ExecutionImpl subProcessInstance;
/** the free text comments users make on this execution */
protected Set<CommentImpl> comments;
/** reference to the current activity instance history record */
protected Long historyActivityInstanceDbid;
/** start time of the activity for history purposes (not persisted) */
protected Date historyActivityStart;
protected int priority = Priority.NORMAL;
protected Map<String, Variable> systemVariables;
// persistent indicators of the current position
// ////////////////////////////
/** persistent process definition reference */
protected String processDefinitionId;
/** persistent activity reference */
protected String activityName;
// transient cached indicators of the current position
// //////////////////////
/**
* transient cached process definition. persistence is managed in
* {@link #processDefinitionId}
*/
protected ProcessDefinitionImpl processDefinition;
/**
* transient cached current activity pointer. persistence is managed in
* {@link #activityName}
*/
private ActivityImpl activity;
/** transition is not to be made persistable by default */
protected TransitionImpl transition;
protected EventImpl event;
protected AtomicOperation eventCompletedOperation;
protected int eventListenerIndex;
protected ObservableElementImpl eventSource;
// cached named executions
// //////////////////////////////////////////////////
/**
* caches the child executions by execution name. This member might be null
* and is only created from the executions in case its needed. Note that not
* all executions are forced to have a name and duplicates are allowed. In
* case the {@link #executions} change, the executionsMap can be nulled or
* also updated (but a check needs to be added whether it exists).
*/
protected transient Map<String, Execution> executionsMap = null;
/** the queue of atomic operations to be performed for this execution. */
protected Queue<AtomicOperation> atomicOperations;
public enum Propagation
{
UNSPECIFIED, WAIT, EXPLICIT
}
protected Propagation propagation = null;
// construction
// /////////////////////////////////////////////////////////////
public void initializeProcessInstance(
ProcessDefinitionImpl processDefinition, String key)
{
setProcessDefinition(processDefinition);
setActivity((ActivityImpl) processDefinition.getInitial());
this.processInstance = this;
this.state = STATE_CREATED;
this.key = key;
IdGenerator idGenerator = processDefinition.getIdGenerator();
if (idGenerator != null)
{
this.id = idGenerator.createId(processDefinition, null, this);
}
}
// execution method : start
// /////////////////////////////////////////////////
public void start()
{
if (state != STATE_CREATED)
{
throw new JbpmException(toString() + " is already begun: " + state);
}
this.state = STATE_ACTIVE_ROOT;
ExecutionImpl scopedExecution = initializeScopes();
fireHistoryEvent(new ProcessInstanceStart());
fire(Event.START, getProcessDefinition());
if (getActivity() != null)
{
scopedExecution
.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
}
}
protected ExecutionImpl initializeScopes()
{
LinkedList<ActivityImpl> enteredActivities = new LinkedList<ActivityImpl>();
ActivityImpl initial = getProcessDefinition().getInitial();
ExecutionImpl scopedExecution = null;
if (initial != null)
{
enteredActivities.add(initial);
ActivityImpl parentActivity = initial.getParentActivity();
while (parentActivity != null)
{
enteredActivities.addFirst(parentActivity);
parentActivity = parentActivity.getParentActivity();
没有合适的资源?快使用搜索试试~ 我知道了~
JBPM4.0源码以及分析
共1018个文件
java:606个
html:292个
png:76个
4星 · 超过85%的资源 需积分: 9 41 下载量 53 浏览量
2009-06-17
11:21:55
上传
评论
收藏 2.19MB RAR 举报
温馨提示
JBPM4.0源码以及分析,对PVM和JPDL进行了扩展
资源推荐
资源详情
资源评论
收起资源包目录
JBPM4.0源码以及分析 (1018个子文件)
documentation.css 11KB
documentation.css 11KB
docnav.css 4KB
docnav.css 4KB
reports.css 4KB
reports.css 4KB
codehighlight.css 3KB
codehighlight.css 3KB
stylesheet.css 1KB
jbossorg.css 1KB
jbossorg.css 1KB
stylesheet.css 1KB
extensions.css 170B
extensions.css 170B
Thumbs.db 84KB
Thumbs.db 5KB
wirecontext.gif 5KB
environment.gif 4KB
bkg_gradient.gif 294B
bkg_gradient.gif 294B
inherit.gif 57B
index.html 202KB
index-all.html 171KB
index.html 106KB
activityGroup.html 71KB
wireObjectGroup.html 46KB
ActivityExecution.html 41KB
Execution.html 36KB
TaskService.html 34KB
overview-tree.html 34KB
ExecutionService.html 33KB
ClientExecution.html 32KB
OpenExecution.html 32KB
Environment.html 30KB
constant-values.html 30KB
Execution.html 27KB
ClientProcessInstance.html 27KB
wireObjectType.html 26KB
HistoryActivityInstanceQuery.html 23KB
Activity.html 22KB
activityGroup.task.html 22KB
OpenExecution.html 22KB
IdentityService.html 22KB
activityGroup.sub-process.html 22KB
EventListenerExecution.html 22KB
package-use.html 21KB
ProcessInstance.html 21KB
ProcessDefinitionQuery.html 20KB
ClientProcessDefinition.html 20KB
process.html 19KB
HistoryProcessInstanceQuery.html 19KB
OpenTask.html 18KB
TaskQuery.html 18KB
Task.html 18KB
OpenProcessInstance.html 18KB
TaskHandler.html 17KB
wireObjectGroup.set.html 17KB
Configuration.html 17KB
ObservableElement.html 17KB
package-use.html 16KB
ProcessEngine.html 16KB
Transition.html 16KB
activityGroup.decision.html 16KB
wireObjectGroup.list.html 16KB
Activity.html 16KB
Deployment.html 16KB
CompositeElement.html 16KB
Context.html 16KB
HistoryActivityInstanceQuery.html 15KB
activityGroup.java.html 15KB
ProcessInstanceQuery.html 15KB
Participation.html 15KB
taskType.html 15KB
Discussable.html 14KB
javaType.html 14KB
WireObject.html 14KB
ObservableElement.html 14KB
Task.html 14KB
EnvironmentFactory.html 14KB
OpenProcessDefinition.html 14KB
wireObjectType.property.html 14KB
wireObjectType.field.html 14KB
JobQuery.html 14KB
activityGroup.join.html 14KB
HistoryProcessInstance.html 14KB
Comment.html 13KB
IdentityRef.html 13KB
RepositoryService.html 13KB
OpenTask.html 13KB
HistoryProcessInstanceQuery.html 13KB
activityGroup.script.html 13KB
assignmentAttributes.html 13KB
Transition.html 13KB
qlType.parameters.html 13KB
wireObjectGroup.properties.html 13KB
timer.html 13KB
activityGroup.decision.transition.html 13KB
ProcessDefinitionQuery.html 13KB
Comment.html 13KB
activityGroup.sql.html 12KB
共 1018 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
- jsxzhlhm2012-03-27是官方的源码及文档,没有用
fance319
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功