cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: Dates in different format for create process and get Task Info

bobfleischman
Champ in-the-making
Champ in-the-making
We are developing around the rest service and have noticed the following problem.

When we create a process we need to send the date using
private ISO8601DateFormat ISO8601DATEFORMAT = new ISO8601DateFormat();

However, when we request information on a task the date is returned as 2014-04-03T00:55:00.643+0000 and will not parse with the ISO8601DATEFORMAT.

We have worked around this for now, but it would be nice to use the same format for input and output.

Thank you,

Bob
5 REPLIES 5

trademak
Star Contributor
Star Contributor
You are using the REST API right?
Which REST services are you using and experiencing this issue with?

Best regards,

Yes, we are using the REST API for all interactions with the Activiti Engine.

We are using activiti-rest 5.15.1 - the latest stable release

Thanks,

Bob

trademak
Star Contributor
Star Contributor
Hi Bob,

Okay thanks, but which specific REST services are using and experiencing these issues with?

Best regards,

Here are my constants

private BPMServer activiti_server = BPMServer.TEST;
private String activiti_rest_base_url = "http://" + activiti_server.getServerName() + "/activiti-rest/service";
private static final String TASK_URL        = "/history/historic-task-instances";
private static final String RUNTIME_PROCESS = "/runtime/process-instances";
[\code]
To Create a process I use this
[code] HashMap<String,Object> response2 = restTemplate.postForObject( activiti_rest_base_url + RUNTIME_PROCESS , request, HashMap.class);
To get the task info I use this:
String url = activiti_rest_base_url + TASK_URL + "?taskId=" + pTaskId + "&includeTaskLocalVariables=true&includeProcessVariables=true";
The issue seems to be specifically related to global variables.

Thanks

Bob

HashMap<String,Object> response2 = restTemplate.postForObject( activiti_rest_base_url + RUNTIME_PROCESS , request, HashMap.class);

String url = activiti_rest_base_url + TASK_URL + "?taskId=" + pTaskId + "&includeTaskLocalVariables=true&includeProcessVariables=true";

frederikherema1
Star Contributor
Star Contributor
We use the jackson ISO8601 way of reading/writing dates, we force all dates to be written in ISO8601:


// Get hold of JSONConverter and enable ISO-date format by default
    List<ConverterHelper> registeredConverters = Engine.getInstance().getRegisteredConverters();
    for(ConverterHelper helper : registeredConverters) {
      if(helper instanceof JacksonConverter) {
        JacksonConverter jacksonConverter = (JacksonConverter) helper;
        jacksonConverter.getObjectMapper().configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
      }
    }

The input accepts a variety of formats (including ISO8601), when date-typed members are encountered. Perhaps the ISO8601DATEFORMAT you're using is more strict or does not cover all possible notations?