流程属性中的业务补偿:
自己认为业务补偿也是属于事件的。
1 xml中的配置
<process … … ……>
… … … …
<extend>
… … … …
<expiation-setting>
<set-type>http</set-type>
<delete-instance>
/expense-report/delete-instance-expiation.htm
</delete-instance>
<cancel-instance>
/expense-report/cancel-instance-expiation.htm
</cancel-instance>
<task-jump>/expense-report/task-jump-expiation.htm</task-jump>
<pause-instance/>
<continue-instance/>
<goback-task/>
</expiation-setting>
</extend>
… … … …
</process>
任务退回配置的是
spring bean名称,该
bean需要实现的接口为
com.norteksoft.wf.engine.client.ReturnTaskInterface。当在流程监控中删除、取消、暂停、继续实例时,做法基本一致,如下:
首先获得
xml中配置的请求方式和请求的
url;当请求方式是
HTTP方式时,使用
httpclient请求
url;当请求方式是
RESTful方式时,使用的是
Jersey的
Client请求的。
WebUtil.java中的两种请求方式实现如下:
/**
* 普通的
http请求
*
@param url
*/
public
static
void getHttpConnection(String url,Long companyId,LongentityId,String systemCode){
String resultUrl=SystemUrls.
getBusinessPath(systemCode);
if(PropUtils.
isBasicSystem(resultUrl)){
resultUrl = SystemUrls.
getSystemUrl("imatrix");
}
log.info(" == systemurl : ["+resultUrl+"] == ");
resultUrl = resultUrl + url+"?companyId="+companyId+"&entityId="+entityId;
log.info(" == restleturl : ["+resultUrl+"] == ");
HttpGet httpget =
new HttpGet(resultUrl);
HttpClient httpclient =
new DefaultHttpClient();
ResponseHandler<String> responseHandler =
newBasicResponseHandler();
try {
httpclient.execute(httpget, responseHandler);
}
catch (ClientProtocolException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
httpclient.getConnectionManager().shutdown();
}
/**
* RESTful请求
*
@param url
*
@param companyId
*/
public
static
void restful(String url,Long companyId,Long entityId,StringsystemCode){
ClientConfig config =
new DefaultClientConfig();
Client client = Client.
create(config);
String resultUrl = SystemUrls.
getSystemUrl(systemCode);
if(PropUtils.
isBasicSystem(resultUrl)){
resultUrl = SystemUrls.
getSystemUrl("imatrix");
}
log.info(" == systemurl : ["+resultUrl+"] == ");
resultUrl = resultUrl + url;
log.info(" == restleturl : ["+resultUrl+"] == ");
WebResource service = client.resource(resultUrl);
ClientResponse cr = service
.entity("companyId="+companyId+"&entityId="+entityId,
MEDIA_TYPE)
.accept(
MEDIA_TYPE)
.post(ClientResponse.
class);
if(cr !=
null)
log.info("=========== RESTful execute result : ["+cr.getEntity(String.
class)+"]=========== ");
}
Demo演示登录地址:http://demo.imatrix.net.cn:8888/imatrix
iMatrix平台源码下载地址:https://github.com/norteksoft/5.2.1.RC
如有使用问题请登录iMatrix平台论坛咨询:http://bbs.imatrix.net.cn/forum.php?mod=forumdisplay&fid=37