Activiti to Use UTC date time
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 06:53 AM
Hello,
Can we store using UTC time zone in activiti tables?
My problem is that User should fetch and see the data in their local time zone. If it will be in UTC format in tables, then it can change it to user's timezone before displaying.
Is there any way to use UTC Date time in activiti tables.
-
Can we store using UTC time zone in activiti tables?
My problem is that User should fetch and see the data in their local time zone. If it will be in UTC format in tables, then it can change it to user's timezone before displaying.
Is there any way to use UTC Date time in activiti tables.
-
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 02:14 PM
I have checked in my activiti tables, On starting a process instance and creating tasks, It used current time zone. But I need to store in UTC time zone.
Can somebody help me on this?
_
Can somebody help me on this?
_
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 08:18 AM
Which database? For example on mysql, dates are generally stored in UTC.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 08:32 AM
I am using Oracle Database.
I did some operations on Task and checked in the Activiti tables. It is storing in local time zone on which server is running.
-
Dinesh
I did some operations on Task and checked in the Activiti tables. It is storing in local time zone on which server is running.
-
Dinesh
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2016 02:53 AM
I got a solution cause of activiti workflow, it is very much extendible almost all points in API. Thanks to activiti developers.
I have extended DefaultClockImpl class of activiti and override the required method to use Calendar for my purpose. Activti uses Clock to get and set Time in their entities, wherever required.
My Project is using Spring framework and did Java configuration for workflow project, So I did below changes to register my class, while doing Process engine configuration:
Override DefaultClockImpl Class
<java>public class CustomDefaultClockImpl extends DefaultClockImpl {
private static volatile Calendar CURRENT_TIME = null;
@Override
public void setCurrentTime(Date currentTime) {
Calendar time = null;
if (currentTime != null) {
time = new GregorianCalendar();
time.setTimeZone(TimeZone.getTimeZone("UTC"));
time.setTime(currentTime);
}
setCurrentCalendar(time);
}
@Override
public Calendar getCurrentCalendar() {
Calendar calendar = new GregorianCalendar();
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
return CURRENT_TIME == null ? calendar : (Calendar) CURRENT_TIME.clone();
}
}</java>
Create a Spring bean of Clock:
<java>
@Bean
public Clock clock(){
// CustomDefaultClockImpl is class which extends DefaultClockImpl
Clock clock = new CustomDefaultClockImpl();
return clock;
}
</java>
and While doing process engine configuration :
<java>
SpringProcessEngineConfiguration processEngineConfiguration =
new SpringProcessEngineConfiguration();
// Calling above method to register spring bean in activiti configuration
processEngineConfiguration.setClock(clock());
</java>
Now it will store using UTC time zone in all activiti tables, wherever date time is present in tables.
I have extended DefaultClockImpl class of activiti and override the required method to use Calendar for my purpose. Activti uses Clock to get and set Time in their entities, wherever required.
My Project is using Spring framework and did Java configuration for workflow project, So I did below changes to register my class, while doing Process engine configuration:
Override DefaultClockImpl Class
<java>public class CustomDefaultClockImpl extends DefaultClockImpl {
private static volatile Calendar CURRENT_TIME = null;
@Override
public void setCurrentTime(Date currentTime) {
Calendar time = null;
if (currentTime != null) {
time = new GregorianCalendar();
time.setTimeZone(TimeZone.getTimeZone("UTC"));
time.setTime(currentTime);
}
setCurrentCalendar(time);
}
@Override
public Calendar getCurrentCalendar() {
Calendar calendar = new GregorianCalendar();
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
return CURRENT_TIME == null ? calendar : (Calendar) CURRENT_TIME.clone();
}
}</java>
Create a Spring bean of Clock:
<java>
@Bean
public Clock clock(){
// CustomDefaultClockImpl is class which extends DefaultClockImpl
Clock clock = new CustomDefaultClockImpl();
return clock;
}
</java>
and While doing process engine configuration :
<java>
SpringProcessEngineConfiguration processEngineConfiguration =
new SpringProcessEngineConfiguration();
// Calling above method to register spring bean in activiti configuration
processEngineConfiguration.setClock(clock());
</java>
Now it will store using UTC time zone in all activiti tables, wherever date time is present in tables.