关于iMatrix平台流程引擎事件处理之业务补偿分析

前面已经介绍了iMatrix平台办理人设置和表单字段权限的原理,下面再看看iMatrix平台是怎样处理事件的?

iMatrix平台流程属性中的业务补偿:
自己认为业务补偿也是属于事件的。
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方式时,使用的是 JerseyClient请求的。
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 !=  nulllog.info("=========== RESTful execute result : ["+cr.getEntity(String. class)+"]=========== ");
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值