技术分享 -- 面向过程设计

     现在面向过程开发展示出他独特的魅力,我也是附庸风雅的自己鼓捣下,写了一个基于程序流程控制的Xml文档结构图,入下所示。希望对大家有所启发,他是面向对象基础的升级于升华。不知大家是否明白。 呵呵~~~~

 

<?xml version="1.0" encoding="UTF-8"?>
<flows namespace="haoxiaojie">

	<flow id="parent-flow" abstract="true">
		<!-- Filter:表明该流程是从Spring IOC 中 getBean 获取执行代码 -->
		<step type="filter" name="spring-bean-id(1)" />
		<step type="filter" name="spring-bean-id(2)" />
		<step type="filter" name="spring-bean-id(3)" />
		<step type="filter" name="spring-bean-id(4)" />
	</flow>

	<flow id="demo-flow" parent="parentFlow">
		<step type="filter" name="spring-bean-id(5)" />
		<!-- 如果满足  EL表达式的结果['hao'] == 'qiu' 则在当前程序处理流程中加入 sub-flow 的内容继续运行 -->
		<step type="join" name="sub-flow" spel="['hao'] == 'qiu'" />
		<!-- 如果满足  EL表达式的结果['sum'] != 99  则运行内嵌的节点Filter -->
		<step type="join" name="" spel="['sum'] != 99">
			<step type="filter" name="spring-bean-id" />
			<step type="filter" name="spring-bean-id" />
		</step>
		<!-- type="condition" 为流程分支点,按照处理结果进行不同的分支处理 -->
		<step type="condition" spel="['hao'].value">
			<next on="hao" to="swtich-bean-1" />
			<next on="qiu" to="swtich-bean-2" />
		</step>
		<step type="filter" name="swtich-bean-1" />
		<step type="filter" name="swtich-bean-2" />
		<!-- merger="true" 表明是否于合并 parent flow 同样配置的信息-->
		<!-- end 正常处理完业务流程之后需要处理的代码配置 -->
		<end merger="true">
			<step type="filter" name="spring-bean-id" />
			<step type="filter" name="spring-bean-id" />
		</end>
		<!-- fail 中间发生异常时需要处理的代码段 -->
		<fail merger="false">
		</fail>
		<!-- listeners 在解析程序流过程中的监听事件,可以配置多个,按顺序触发 -->
		<listeners merger="true">
			<listener name="spring-listeners-bean" />
		</listeners>
	</flow>

	<flow id="sub-flow" abstract="true">
		<step type="filter" name="spring-bean-id(7)" />
		<step type="filter" name="spring-bean-id(8)" />
		<!-- 基于Spring PlatformTransactionManager 的数据库事务声明 开启事务 -->
		<step type="transaction" name="start" />
		<step type="filter" name="spring-bean-id(9)" />
		<step type="filter" name="spring-bean-id(10)" />
		<!-- 基于Spring PlatformTransactionManager 的数据库事务声明 提交事务 -->
		<step type="transaction" name="cmmit" />
	</flow>
	
</flows>

转载于:https://my.oschina.net/qfhxj/blog/66402

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值