initialize long com.opensymphony.workflow.AbstractWorkflow.initialize(String workflowName, int initialAction, Map inputs) throws InvalidRoleException, InvalidInputException, WorkflowException 初始化步骤: 1.获取存储配置(jdbc) WorkflowDescriptor wf = getConfiguration().getWorkflow(workflowName); WorkflowStore store = getPersistence(); 2.创建条目(insert into OS_WFENTRY) WorkflowEntry entry = store.createEntry(workflowName); 3.初始化PropertySet key=osff_+entryId、参数=propertyset.xml配置 PropertySet ps = store.getPropertySet(entry.getId()); 4.填充transientVars populateTransientMap(entry, transientVars, wf.getRegisters(), new Integer(initialAction), Collections.EMPTY_LIST, ps); 5.检查是否满足初始化条件 if (!canInitialize(workflowName, initialAction, transientVars, ps)) { context.setRollbackOnly(); throw new InvalidRoleException("You are restricted from initializing this workflow"); } 6.获取初始化action ActionDescriptor action = wf.getInitialAction(initialAction); 7.流转工作流 transitionWorkflow(entry, Collections.EMPTY_LIST, store, wf, action, transientVars, inputs, ps); 8.返回ID long entryId = entry.getId(); doAction void com.opensymphony.workflow.AbstractWorkflow.doAction(long id, int actionId, Map inputs) throws WorkflowException 执行动作: 1.在全局action中找到指定action。 2.在全局action中找不到就到当前步骤中找指定action。 3.流转工作流。 transitionWorkflow boolean com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(WorkflowEntry entry, List currentSteps, WorkflowStore store, WorkflowDescriptor wf, ActionDescriptor action, Map transientVars, Map inputs, PropertySet ps) throws WorkflowException 1.清空ThreadLocal中的状态缓存; 2.通过传入参数Action取得当前Step; 3.检查输入验证; 4.获取当前Step的PostFunction,并执行; 5.执行当前Action的preFunction,并执行; 6.获取满足条件的Result; 7.执行当前Result的preFunction,并执行; 8.如果Result的Split不为空,执行Splist的Result; 9.如果Result的Join不为空,执行(结束当前步骤,移动到历史步骤,找到所有join步骤放入“jn”,执行条件,执行Result。); 10.执行未执行的PostFunction; 11.执行自动action。