Filter History case-activity-instance


#1

Hi,

I am using
/engine-rest/history/case-activity-instance?createdAfter=“2019-01-05T20:48:48.894+0530”
to query cmmn model
But in response it gives me records with

“createTime”: “2019-01-04T15:20:00.415+0530”

Facing same issue with “createdBefore”, “endedBefore”, “endedAfter”.


#2

Remove Quotes and check like below:

/engine-rest/history/case-activity-instance?createdAfter=2019-01-05T20:48:48.894+0530


#3

If I am passing date without quotes then I am facing following exception

{
“type”: “InvalidRequestException”,
“message”: “Cannot set query parameter ‘createdAfter’ to value ‘2019-01-05T20:48:48.894 0530’: Cannot convert value “2019-01-05T20:48:48.894 0530” to java type java.util.Date”
}


#4

can you provide stacktrace of error?


#5

09-Jan-2019 13:00:49.206 WARNING [http-nio-8080-exec-4] org.camunda.bpm.engine.rest.exception.RestExceptionHandler.toResponse org.camunda.bpm.engine.rest.exception.InvalidRequestException: Cannot set query parameter ‘createdAfter’ to value ‘2019-01-05T20:48:48.894 0530’: Cannot convert value “2019-01-05T20:48:48.894 0530” to java type java.util.Date
at org.camunda.bpm.engine.rest.dto.AbstractSearchQueryDto.setValueBasedOnAnnotation(AbstractSearchQueryDto.java:90)
at org.camunda.bpm.engine.rest.dto.AbstractSearchQueryDto.(AbstractSearchQueryDto.java:51)
at org.camunda.bpm.engine.rest.dto.AbstractQueryDto.(AbstractQueryDto.java:64)
at org.camunda.bpm.engine.rest.dto.history.HistoricCaseActivityInstanceQueryDto.(HistoricCaseActivityInstanceQueryDto.java:90)
at org.camunda.bpm.engine.rest.impl.history.HistoricCaseActivityInstanceRestServiceImpl.getHistoricCaseActivityInstances(HistoricCaseActivityInstanceRestServiceImpl.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:140)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:109)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:135)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:103)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:377)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:200)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.EmptyBodyFilter.doFilter(EmptyBodyFilter.java:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:409)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.camunda.bpm.engine.rest.exception.InvalidRequestException: Cannot convert value “2019-01-05T20:48:48.894 0530” to java type java.util.Date
at org.camunda.bpm.engine.rest.dto.converter.JacksonAwareStringToTypeConverter.mapToType(JacksonAwareStringToTypeConverter.java:43)
at org.camunda.bpm.engine.rest.dto.converter.DateConverter.convertQueryParameterToType(DateConverter.java:21)
at org.camunda.bpm.engine.rest.dto.converter.DateConverter.convertQueryParameterToType(DateConverter.java:17)
at org.camunda.bpm.engine.rest.dto.AbstractSearchQueryDto.setValueBasedOnAnnotation(AbstractSearchQueryDto.java:81)
… 48 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.util.Date from String value ‘2019-01-05T20:48:48.894 0530’: not a valid representation (error: Failed to parse Date value ‘2019-01-05T20:48:48.894 0530’: Unparseable date: “2019-01-05T20:48:48.894 0530”)
at [Source: “2019-01-05T20:48:48.894 0530”; line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:55)
at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:907)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseDate(StdDeserializer.java:787)
at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateBasedDeserializer._parseDate(DateDeserializers.java:175)
at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateDeserializer.deserialize(DateDeserializers.java:261)
at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateDeserializer.deserialize(DateDeserializers.java:245)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2726)
at org.camunda.bpm.engine.rest.dto.converter.JacksonAwareStringToTypeConverter.mapToType(JacksonAwareStringToTypeConverter.java:38)
… 51 more


#6

Have you checked your date input? The Date format should comply with ISO 8601 date format. The thing which missing was ‘+’ in your Date format.

2019-01-05T20:48:48.894 0530
this should be like below,

2019-01-05T20:48:48.894+0530


#7

in rest query I am passing date with ‘+’, still facing issue

/engine-rest/history/case-activity-instance?createdAfter=2019-01-05T20:48:48.894+0530