AnsweredAssumed Answered

Workflow query on custom props fails with datetime prop datatype

Question asked by vincent-kali on Jul 29, 2018
Latest reply on Jul 30, 2018 by vincent-kali

Hi,
I want to query workflow instances using property filter.
Query on String datatype are working well, but query on DateTime datatype fails with exception below.
Any Idea ?

 

My code:

 WorkflowInstanceQuery workflowInstanceQuery = new WorkflowInstanceQuery();
 Map<QName, Object> filters = new HashMap<QName, Object>;
 filters.put(PropertyQName, DateParam);
 workflowInstanceQuery.setCustomProps(filters);
 this.workflowService.getWorkflows(workflowInstanceQuery, maxItems, skipCount);

 

Exception:

2018-07-29 23:16:46,476  ERROR [extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-2] Exception from executeScript: java.util.Date cannot be cast to java.util.Map
 java.lang.ClassCastException: java.util.Date cannot be cast to java.util.Map
        at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.createQuery(ActivitiWorkflowEngine.java:2556)
        at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getWorkflowsInternal(ActivitiWorkflowEngine.java:2403)
        at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getWorkflows(ActivitiWorkflowEngine.java:2388)
        at org.alfresco.repo.workflow.WorkflowServiceImpl.getWorkflows(WorkflowServiceImpl.java:502)
        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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:64)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy77.getWorkflows(Unknown Source)

Outcomes