一、開始事件中運用了兩個自定義的表單類型bigtext和double html
<startEvent id="startevent1" name="startevent1" activiti:initiator="applyUserId"> <extensionElements> <activiti:formProperty id="dueDate" name="到貨期限" type="date" datePattern="yyyy-MM-dd" required="true"></activiti:formProperty> <activiti:formProperty id="listing" name="物品清單" type="bigtext" required="true"></activiti:formProperty> <activiti:formProperty id="amountMoney" name="總金額" type="double" required="true"></activiti:formProperty> </extensionElements> </startEvent>
public class BigtextFormType extends StringFormType { @Override public String getName(){ return "bigtext"; } }
public class DoubleFormType extends AbstractFormType { @Override public String getName() { return "double"; } @Override public Object convertFormValueToModelValue(String formValue) { return new Double(formValue); } @Override public String convertModelValueToFormValue(Object modelValue) { return Objects.toString(modelValue); } }
List<AbstractFormType> customFormTypes = new ArrayList<AbstractFormType>(); customFormTypes.add(new BigtextFormType()); customFormTypes.add(new DoubleFormType()); processEngineConfiguration.setCustomFormTypes(customFormTypes);
<%-- 文本或者數字類型 --%> <c:if test="${fp.type.name == 'string' || fp.type.name == 'long' || fp.type.name == 'double'}"> <label class="control-label" for="${fp.id}">${fp.name}:</label> <div class="controls"> <input type="text" id="${fp.id}" name="${fp.id}" data-type="${fp.type.name}" value="" /> </div> </c:if> <%-- 大文本 --%> <c:if test="${fp.type.name == 'bigtext'}"> <label class="control-label" for="${fp.id}">${fp.name}:</label> <div class="controls"> <textarea id="${fp.id}" name="${fp.id}" data-type="${fp.type.name}" ${required}></textarea> </div> </c:if>
<sequenceFlow id="flow22" name="進入付費子流程" sourceRef="contactSupplier" targetRef="subprocessPay"> <extensionElements> <activiti:executionListener event="take" expression="${execution.setVariable('usage', listing)}"></activiti:executionListener> </extensionElements> </sequenceFlow>
<endEvent id="errorendevent1" name="TerminateEndEvent"> <errorEventDefinition errorRef="PAYMENT_REJECT"></errorEventDefinition> </endEvent> <endEvent id="errorendevent2" name="End"> <errorEventDefinition errorRef="PAYMENT_REJECT"></errorEventDefinition> </endEvent>
外部與異常邊界事件關聯 java
<boundaryEvent id="boundaryerror1" name="Error" attachedToRef="subprocessPay"> <errorEventDefinition errorRef="PAYMENT_REJECT"></errorEventDefinition> </boundaryEvent>
運行流程後查看此表有兩條流程實例ID相同的記錄,一個ID與流程實例ID相同時主流程,另外一個爲子流程,它的parent_id_不空,指向主流程的實例ID。 express
五、act_hi_procinst表爲歷史流程實例表 app
其中只有一條關於主流程的記錄,而無子流程記錄。 jsp
六、在子流程中的一些用戶任務使用了amountMoney變量,而在子流程中並未設置此變量。查看act_hi_varinst表,子流程能夠共享主流程的全部變量,並且子流程在獲取數據時使用主流程的執行實例ID(parent_id_字段)查詢變量。 ide