cancel
Showing results for 
Search instead for 
Did you mean: 

Boundary Event, timeDuration based on process variable

hheckel
Champ in-the-making
Champ in-the-making
Hello,

just wondering, if I can define the timeDuration for a timerEvent using Expression Language to access a process variable similar to:


<boundaryEvent id="myBoundaryEvent" cancelActivity="true" attachedToRef="timeoutNode">
   <timerEventDefinition>
      <timeDuration>${timeoutValue}</timeDuration>
     </timerEventDefinition>
</boundaryEvent>


So far, when creating a process instance and passing in timeoutValue as a process variable, I receive the following error message

Exception in thread "main" org.activiti.engine.ActivitiException: couldn't resolve duedate: ${_timeoutValue}
   at org.activiti.engine.impl.calendar.DurationBusinessCalendar.resolveDuedate(DurationBusinessCalendar.java:44)
   at org.activiti.engine.impl.runtime.ExecutionEntity.initialize(ExecutionEntity.java:167)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:38)
   at org.activiti.engine.impl.pvm.runtime.ExecutionImpl.performOperation(ExecutionImpl.java:521)
   at org.activiti.engine.impl.pvm.runtime.ExecutionImpl.start(ExecutionImpl.java:362)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:66)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:29)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:22)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:37)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:48)
   at com.acme.Test.main(ProcessEngineTest.java:41)
Caused by: java.lang.IllegalArgumentException: ${_timeoutValue}
   at org.apache.xerces.jaxp.datatype.DurationImpl.<init>(Unknown Source)
   at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newDuration(Unknown Source)
   at org.activiti.engine.impl.calendar.DurationBusinessCalendar.resolveDuedate(DurationBusinessCalendar.java:36)
   … 11 more

Thanks,
Holger.
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
Thats indeed a valid feature request: I added a Jira for it : http://jira.codehaus.org/browse/ACT-429

bernd_ruecker
Champ in-the-making
Champ in-the-making
Done.

jgardner
Champ in-the-making
Champ in-the-making
Hi

Does anyone know whether use of Expression Language in a timerEventDefinition timeDate (for example) for a start event is supported?

use-case: deploy a process that then allows us to create/start instances of it using a timeDate value from a process variable. During runtime, previously created instances would then 'start' at the previously prescribed timeDate used when the instance was created.

Is this even sane? If not, then would very much welcome a sane way to do this.

Our attempts to use Expression Language, like ${timeDate} for example, in a start event timerEventDefinition timeDate value raise the same exception reported in this thread.

Many thanks.

trademak
Star Contributor
Star Contributor
Hi,

Yes sure that's a valid approach.
Could you create a unit test so I can reproduce it quickly?

Best regards,

jgardner
Champ in-the-making
Champ in-the-making
Hi

Many thanks. The attached, very simple, process fails to deploy with the exception below (but when changed to use a timeDate value of 201112310900, for example, it then deploys ok) ….

org.activiti.engine.ActivitiException: couldn't resolve duedate: ${tD}
at org.activiti.engine.impl.calendar.DueDateBusinessCalendar.resolveDuedate(DueDateBusinessCalendar.java:31)
at org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl.prepareTimerEntity(TimerDeclarationImpl.java:103)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.addTimerDeclarations(BpmnDeployer.java:159)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:133)
at org.activiti.engine.impl.persistence.deploy.DeploymentCache.deploy(DeploymentCache.java:37)
at org.activiti.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:39)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:58)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:30)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:43)
at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:106)
at org.activiti.explorer.ui.management.deployment.DeploymentUploadReceiver.deployUploadedFile(DeploymentUploadReceiver.java:83)
at org.activiti.explorer.ui.management.deployment.DeploymentUploadReceiver.uploadFinished(DeploymentUploadReceiver.java:71)
at org.activiti.explorer.ui.custom.UploadComponent.uploadFinished(UploadComponent.java:173)
at sun.reflect.GeneratedMethodAccessor495.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
at com.vaadin.ui.Upload.fireUploadInterrupted(Upload.java:731)
at com.vaadin.ui.Upload$1.streamingFailed(Upload.java:1037)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.streamToReceiver(AbstractCommunicationManager.java:612)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleSimpleMultipartFileUpload(AbstractCommunicationManager.java:469)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleFileUpload(CommunicationManager.java:257)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:495)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.IllegalArgumentException: ${tD}
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseAndSetYear(XMLGregorianCalendarImpl.java:2847)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2734)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(XMLGregorianCalendarImpl.java:430)
at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(DatatypeFactoryImpl.java:233)
at org.activiti.engine.impl.calendar.DueDateBusinessCalendar.resolveDuedate(DueDateBusinessCalendar.java:28)
… 43 more

jgardner
Champ in-the-making
Champ in-the-making
concluding update to this item …. after some further investigation and community clarification (thank you) it seems that a start event cannot access the process context as there's no process actually started at that point.

We tried a normal start event and a timer intermediate catching event with the time expression definition, which then worked fine as required.