cancel
Showing results for 
Search instead for 
Did you mean: 

Where did ClockUtil go in 5.15.1?

njames
Champ in-the-making
Champ in-the-making
Hi,
We were using ClockUtil.getCurrentTime() to get the current time from the Activiti process engines. This seemed like a good idea at the time, in case any unit tests set a new current time on the engine. I have changed my code to use new Date() instead, so it's not a showstopper, but clearly there is a gap. Does anyone have any ideas on the new way to do this, or is it functionality that has been deliberately removed? (It would have been nice to have something called out in the release notes).

Thanks,

Nick.
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Nick,

ClockUtil  was replaced by Clock and ClockReader interfaces. Their implementation is DefaultClockImpl. You can get/set clock for process engine with org.activiti.engine.ProcessEngineConfiguration#getClock (setClock) methods.

Regards
Martin

njames
Champ in-the-making
Champ in-the-making
Hi Martin,
Thanks for the info. Does the following look right to you?
<java>
    @Autowired
    private transient ProcessEngine processEngine;
public Date getCurrentDate() {
        final ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
        return processEngineConfiguration.getClock().getCurrentTime();
}
</java>
Is there a better alternative than the cast to ProcessEngineImpl?
Thanks,

Nick.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Nick,

May be you can autowire ProcessEngineImpl.
ProcessEngineConfiguration should be enough.

Regards
Martin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.