1、开始事件中运用了两个自定义的表单类型bigtext和double
<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>
外部与异常边界事件关联
<boundaryEvent id="boundaryerror1" name="Error" attachedToRef="subprocessPay">
<errorEventDefinition errorRef="PAYMENT_REJECT"></errorEventDefinition>
</boundaryEvent>
运行流程后查看此表有两条流程实例ID相同的记录,一个ID与流程实例ID相同时主流程,另一个为子流程,它的parent_id_不空,指向主流程的实例ID。
5、act_hi_procinst表为历史流程实例表
其中只有一条关于主流程的记录,而无子流程记录。
6、在子流程中的一些用户任务使用了amountMoney变量,而在子流程中并未设置此变量。查看act_hi_varinst表,子流程可以共享主流程的所有变量,而且子流程在获取数据时使用主流程的执行实例ID(parent_id_字段)查询变量。
来源:oschina
链接:https://my.oschina.net/u/2453016/blog/610034