错误如下
2017-05-26 10:45:01,070 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=startInstanceById]
2017-05-26 10:45:05,110 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=process]
2017-05-26 10:45:05,111 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=getProcessById]
2017-05-26 10:45:05,111 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=ensureNameCache]
2017-05-26 10:45:05,111 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=ensureEntityCache]
2017-05-26 10:45:05,112 org.snaker.engine.core.ProcessService.getProcessById(ProcessService.java:110) DEBUG - obtain process[id=143e4f0b8da54483abe480d8a925242f] from cache.
2017-05-26 10:45:05,112 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=process]
2017-05-26 10:45:05,112 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=check]
2017-05-26 10:45:05,112 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=order]
2017-05-26 10:45:05,113 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=createOrder]
2017-05-26 10:45:05,113 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=saveOrder]
2017-05-26 10:45:05,114 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,114 org.snaker.engine.access.jdbc.JdbcAccess.saveOrUpdate(JdbcAccess.java:167) DEBUG - 增删改数据(需手动提交事务)=
insert into wf_order (id,process_Id,creator,create_Time,parent_Id,parent_Node_Name,expire_Time,last_Update_Time,last_Updator,order_No,variable,version) values (?,?,?,?,?,?,?,?,?,?,?,?)
2017-05-26 10:45:05,125 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,125 org.snaker.engine.access.jdbc.JdbcAccess.saveOrUpdate(JdbcAccess.java:167) DEBUG - 增删改数据(需手动提交事务)=
insert into wf_hist_order (id,process_Id,order_State,creator,create_Time,end_Time,parent_Id,expire_Time,order_No,variable) values (?,?,?,?,?,?,?,?,?,?)
2017-05-26 10:45:05,127 org.snaker.engine.core.SnakerEngineImpl.execute(SnakerEngineImpl.java:274) DEBUG - 创建流程实例对象:Order(id=befdefd4454b40be92358adedf276d78,processId=143e4f0b8da54483abe480d8a925242f,creator=superadmin,createTime2017-05-26 10:45:05,orderNo=20170526-10:45:05-113-881)
2017-05-26 10:45:05,128 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=task]
2017-05-26 10:45:05,128 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=createTask]
2017-05-26 10:45:05,128 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,129 org.snaker.engine.access.jdbc.JdbcAccess.saveOrUpdate(JdbcAccess.java:167) DEBUG - 增删改数据(需手动提交事务)=
insert into wf_task (id,order_Id,task_Name,display_Name,task_Type,perform_Type,operator,create_Time,finish_Time,expire_Time,action_Url,parent_Task_Id,variable,version) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
2017-05-26 10:45:05,131 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,132 org.snaker.engine.access.jdbc.JdbcAccess.saveOrUpdate(JdbcAccess.java:167) DEBUG - 增删改数据(需手动提交事务)=
insert into wf_task_actor (task_Id, actor_Id) values (?, ?)
2017-05-26 10:45:05,134 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=manager]
2017-05-26 10:45:05,134 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=getSurrogate]
2017-05-26 10:45:05,135 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=getSurrogate]
2017-05-26 10:45:05,135 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,135 org.snaker.engine.access.jdbc.JdbcAccess.queryList(JdbcAccess.java:193) DEBUG - 查询多条记录=
select id, process_Name, operator, surrogate, odate, sdate, edate, state from wf_surrogate where 1=1 and state = 1 and process_Name in(?) and operator in (?) and sdate <= ? and edate >= ? order by sdate desc
2017-05-26 10:45:05,141 com.kanq.snakerflow.SnakerLogInterceptor.intercept(SnakerLogInterceptor.java:30) INFO - 创建任务[标识=816f6318ab674762bb77b0aa743ce1ac,名称=借款申请,创建时间=2017-05-26 10:45:05,参与者={apply.operator}]
2017-05-26 10:45:05,141 com.kanq.snakerflow.SnakerAssignInterceptor.intercept(SnakerAssignInterceptor.java:12) DEBUG - SnakerAssignInterceptor >>>
2017-05-26 10:45:05,141 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=query]
2017-05-26 10:45:05,142 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=getActiveTasks]
2017-05-26 10:45:05,142 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,142 org.snaker.engine.access.jdbc.JdbcAccess.queryList(JdbcAccess.java:193) DEBUG - 查询多条记录=
select id,order_Id,task_Name,display_Name,task_Type,perform_Type,operator,create_Time,finish_Time,expire_Time,action_Url,parent_Task_Id,variable, version from wf_task where 1=1 and order_Id = ? order by create_Time desc
2017-05-26 10:45:05,150 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=executeTask]
2017-05-26 10:45:05,150 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=task]
2017-05-26 10:45:05,150 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=complete]
2017-05-26 10:45:05,151 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,151 org.snaker.engine.access.jdbc.JdbcAccess.queryObject(JdbcAccess.java:180) DEBUG - 查询单条记录=
select id,order_Id,task_Name,display_Name,task_Type,perform_Type,operator,create_Time,finish_Time,expire_Time,action_Url,parent_Task_Id,variable, version from wf_task where id = ?
2017-05-26 10:45:05,155 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=isAllowed]
2017-05-26 10:45:05,155 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:102) DEBUG - ****don't intercept method is[name=access]
2017-05-26 10:45:05,155 org.snaker.engine.access.jdbc.JdbcAccess.queryList(JdbcAccess.java:193) DEBUG - 查询多条记录=
select task_Id, actor_Id from wf_task_actor where task_Id = ?
2017-05-26 10:45:05,157 org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:85) DEBUG - intercept method is[name=getStrategy]
2017-05-26 10:45:05,161 org.snaker.nutz.access.NutzTransactionInterceptor.rollback(NutzTransactionInterceptor.java:77) ERROR -
java.lang.NullPointerException
at org.nutz.trans.Trans._depose(Trans.java:93)
at org.nutz.trans.Trans.close(Trans.java:255)
at org.snaker.nutz.access.NutzTransactionInterceptor.rollback(NutzTransactionInterceptor.java:75)
at org.snaker.engine.access.transaction.TransactionInterceptor.intercept(TransactionInterceptor.java:97)
at org.snaker.engine.core.SnakerEngineImpl$$EnhancerByCGLIB$$d48cfb25.executeTask(<generated>)
at com.kanq.modules.controllers.platform.workflow.SnakerController.startAndExecute(SnakerController.java:154)
at com.kanq.modules.controllers.platform.sys.FormController.submit(FormController.java:228)
at com.kanq.modules.controllers.platform.sys.FormController$$NUTZAOP._aop_invoke(FormController.java:2)
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at com.kanq.modules.controllers.platform.sys.FormController$$NUTZAOP.submit(FormController.java:1)
at com.kanq.modules.controllers.platform.sys.FormController$$FASTCLASS._invoke(FormController.java:1)
at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.NutShiroProcessor.process(NutShiroProcessor.java:49)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2017-05-26 10:45:05,162 com.kanq.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) DEBUG - [POST]URI=/cms/platform/sys/form/submit 35598ms
2017-05-26 10:45:05,162 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN - Error@/platform/sys/form/submit :
java.lang.NullPointerException
at org.nutz.trans.Trans._depose(Trans.java:93)
at org.nutz.trans.Trans.close(Trans.java:255)
at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:41)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at com.kanq.modules.controllers.platform.sys.FormController$$NUTZAOP.submit(FormController.java:1)
at com.kanq.modules.controllers.platform.sys.FormController$$FASTCLASS._invoke(FormController.java:1)
at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.NutShiroProcessor.process(NutShiroProcessor.java:49)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.kanq.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
代码如下NutzTransactionInterceptor
/*
* Copyright 2013-2015 www.snakerflow.com.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/
package org.snaker.nutz.access;
import java.sql.Connection;
import org.nutz.trans.Trans;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.snaker.engine.access.transaction.TransactionInterceptor;
import org.snaker.engine.access.transaction.TransactionStatus;
/**
* Nutz事务拦截器
* @author yuqs
* @since 2.0
*/
public class NutzTransactionInterceptor extends TransactionInterceptor {
private static final Logger log = LoggerFactory.getLogger(NutzTransactionInterceptor.class);
public void initialize(Object accessObject) {
//ignore
}
protected TransactionStatus getTransaction() {
try {
boolean isNew = false;
if(Trans.get() == null) {
Trans.begin(Connection.TRANSACTION_REPEATABLE_READ);
isNew = true;
}
return new TransactionStatus(Trans.get(), isNew);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
protected void commit(TransactionStatus status) {
try {
Trans.commit();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
try {
Trans.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
}
protected void rollback(TransactionStatus status) {
try {
Trans.rollback();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
try {
Trans.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
}
}
}
最简单的一个自定义流程
startAndExecute(processId, ShiroUtils.getUsername(), params).getId();
参数都是有值的,startAndExecute 的方式是这样的 engine也是有值的
public Order startAndExecute(String processId, String operator, Map<String, Object> args) {
Order order = engine.startInstanceById(processId, operator, args);
List tasks = engine.query().getActiveTasks(new QueryFilter().setOrderId(order.getId()));
List newTasks = new ArrayList();
if(tasks != null && tasks.size() > 0) {
Task task = tasks.get(0);
newTasks.addAll(engine.executeTask(task.getId(), operator, args));
}
return order;
}