AnsweredAssumed Answered

query api supporting multiple or conditions

Question asked by k5 on Jan 5, 2015
Hi,

i needed an api to express more complex queries than the current api would allow(e.g. selecting all tasks of a list of process instances, or were two processvariables are same/different). So i diddled around with the native queries and an ibatis mapper. The final approach was to generate native queries based on the custom sql like syntax, bound to an interface.


   public interface ListByProcessDefinition extends Variables {

      @Query("processDefinitionKey = :key")
      List<ProcessInstance> listByProcessDefinitionKey(@Param("key") String key);

      @Query("(processDefinitionKey = :key1 AND var.stringVar='1') OR (processDefinitionKey = :key2 AND var.stringVar='2')")
      List<ProcessInstance> listByProcessDefinitionOr(@Param("key1") String key1, @Param("key2") String key2);
   }

(Variables is a marker interface providing type information for the processvaribles)

The full testcase can be found here.
https://bitbucket.org/k5_/activiti-wao/src/fca9e2005a86524640e187013156fecb0f5d995a/source/activiti-wao/src/test/java/eu/k5/cell/activiti/Wao_listInstances_Test.java?at=default
The whole project is at https://bitbucket.org/k5_/activiti-wao/

So my questions are:
- Whats the general opinion about that approach?
- What are the future plans for the current fluent api? Will it go beyond the single "or" condition?
- What further queries/syntax could be interesting? (e.g. "isDue" over "dueDate >= now()" , how to include paging/sorting optional including of variables)


cheers,
Frank

Outcomes