KIE Remote Services :: Services 6.2.0.CR4

org.kie.remote.services.rest.query
Class InternalProcInstQueryHelper

java.lang.Object
  extended by org.kie.remote.services.rest.query.InternalProcInstQueryHelper

public class InternalProcInstQueryHelper
extends Object


Field Summary
protected  ResourceBase resourceBase
           
 
Constructor Summary
InternalProcInstQueryHelper(ResourceBase resourceBase)
           
 
Method Summary
static void badParameter(String paramName)
           
 void businessAdmin(String[] data)
           
protected  void createAndSetQueryBuilders(String identity)
          Create the RemoteServicesQueryCommandBuilder instances used by the particular Query Helper implementation.
 void deploymentId(String[] data)
           
protected  boolean determineWorkFlowInstanceVariableUse(Map<String,String[]> queryParams)
          Figure out whether or not we're getting audit variable logs or workflow instance variables.
 void dispose()
           
 JaxbQueryProcessInstanceResult doQueryAndCreateResultObjects(boolean onlyRetrieveLastVarLogs, boolean workFlowInstanceVariables)
           Use the created RemoteServicesQueryCommandBuilder instances to execute the query via the backend.
 void endDate(Date[] dateData)
           
 void endDateMax(Date date)
           
 void endDateMin(Date date)
           
protected  Queue<org.kie.remote.services.rest.query.QueryAction> fillQueryActionQueueFromQueryParams(Map<String,String[]> queryParams, Map<String,String> varValueMap, Map<String,String> varRegexMap)
          Parse the given query parameters to create an ArrayDeque of QueryAction.
protected  org.kie.remote.services.rest.query.RemoteServicesQueryCommandBuilder[] getQueryBuilders()
           
 void initiator(String[] data)
           
 void potentialOwner(String[] data)
           
 void processId(String[] data)
           
 void processInstanceId(long[] longData)
           
 void processInstanceIdMax(long[] longData)
           
 void processInstanceIdMin(long[] longData)
           
 void processInstanceStatus(int[] intData)
           
protected  void processQueryActionQueue(Queue<org.kie.remote.services.rest.query.QueryAction> queryActionQueue, Map<String,String> varValueMap, Map<String,String> varRegexMap, boolean workFlowInstanceVariables)
          This is the main core of logic for the query helper classes.
 void processVersion(String[] data)
           
 R queryTaskOrProcInstAndAssociatedVariables(String identity, Map<String,String[]> queryParams, int[] pageInfo, int maxResults)
          This method is the internal logic that preprocesses the list of query parameters passed to the ..
 R queryTasksOrProcInstsAndVariables(Map<String,String[]> queryParams, int[] pageInfo, int maxResults)
           
protected  void setQueryBuilders(org.kie.remote.services.rest.query.RemoteServicesQueryCommandBuilder... queryBuilders)
           
 void stakeHolder(String[] data)
           
 void startDate(Date[] dateData)
           
 void startDateMax(Date date)
           
 void startDateMin(Date date)
           
 void taskId(long[] longData)
           
 void taskIdMax(long longData)
           
 void taskIdMin(long longData)
           
 void taskOwner(String[] data)
           
 void taskStatus(org.kie.api.task.model.Status[] statuses)
           
 void value(String[] data)
           
protected  boolean variableCriteriaInQuery(org.kie.internal.query.data.QueryData queryData)
           
 void variableId(String[] data)
           
 void variableValue(String varId, String value)
           
 void workItemId(long[] longData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceBase

protected ResourceBase resourceBase
Constructor Detail

InternalProcInstQueryHelper

public InternalProcInstQueryHelper(ResourceBase resourceBase)
Method Detail

createAndSetQueryBuilders

protected void createAndSetQueryBuilders(String identity)
Create the RemoteServicesQueryCommandBuilder instances used by the particular Query Helper implementation.

Parameters:
identity - The identity of the user doing the REST call, needed when querying Tasks

doQueryAndCreateResultObjects

public JaxbQueryProcessInstanceResult doQueryAndCreateResultObjects(boolean onlyRetrieveLastVarLogs,
                                                                    boolean workFlowInstanceVariables)
  1. Use the created RemoteServicesQueryCommandBuilder instances to execute the query via the backend.
  2. Create and fill a result instance (a JaxbQueryProcessInstanceResult or JaxbQueryTaskResult) with the information from the results of the queries

    Parameters:
    onlyRetrieveLastVarLogs - Whether to
    workFlowInstanceVariables - (UNFINISHED FEATURE) whether to use the information from variable instance logs or from the process instance variables themselves.
    Returns:

taskId

public void taskId(long[] longData)

initiator

public void initiator(String[] data)

stakeHolder

public void stakeHolder(String[] data)

potentialOwner

public void potentialOwner(String[] data)

taskOwner

public void taskOwner(String[] data)

businessAdmin

public void businessAdmin(String[] data)

taskStatus

public void taskStatus(org.kie.api.task.model.Status[] statuses)

badParameter

public static void badParameter(String paramName)

dispose

public void dispose()

queryTaskOrProcInstAndAssociatedVariables

public R queryTaskOrProcInstAndAssociatedVariables(String identity,
                                                   Map<String,String[]> queryParams,
                                                   int[] pageInfo,
                                                   int maxResults)
This method is the internal logic that
  1. preprocesses the list of query parameters passed to the ../rest/query/runtime/{task,process} operation
  2. builds and executes a query to retrieved the requested information
  3. converts the results to a JaxbQueryTaskResult or JaxbQueryProcessInstanceResult instance
There are some design patterns here that future developers should be aware of:
  1. The meta-message format: We translate the REST query parameters to a list of QueryAction instances to the actual QueryData, instead of directly translating REST query parameters to QueryData information. This effectively decouples the REST query parameters from the query builders, giving us more flexibility/maintainability in the code.

Parameters:
identity - The identity of the caller, needed when doing task queries
queryParams - The query parameters map returned by the JAX-RS logic
pageInfo - The pagination information
maxResults - The maximum number of results to be returned, determined by the pagination information
Returns:
A JaxbQueryTaskResult or JaxbQueryProcessInstanceResult containing a list of entities containing task and process variable information

queryTasksOrProcInstsAndVariables

public R queryTasksOrProcInstsAndVariables(Map<String,String[]> queryParams,
                                           int[] pageInfo,
                                           int maxResults)

determineWorkFlowInstanceVariableUse

protected boolean determineWorkFlowInstanceVariableUse(Map<String,String[]> queryParams)
Figure out whether or not we're getting audit variable logs or workflow instance variables.

Parameters:
queryParams - The map of (REST operation) query parameters
Returns:
Whether or not to use workflow instance variables

fillQueryActionQueueFromQueryParams

protected Queue<org.kie.remote.services.rest.query.QueryAction> fillQueryActionQueueFromQueryParams(Map<String,String[]> queryParams,
                                                                                                    Map<String,String> varValueMap,
                                                                                                    Map<String,String> varRegexMap)
Parse the given query parameters to create an ArrayDeque of QueryAction.

The Queue of QueryAction is then acted upon by the {#processQueryActionQueue(ArrayDeque, Map, Map, boolean) method, which applies the different query actions to build the query requested via the query builder instances.

Parameters:
queryParams - a Map of the received query parameters
varValueMap - a Map that maps query variable names to the passed values
varRegexMap - a Map that maps query variable names to the passed regexs for the specified variable
Returns:
A Queue of QueryAction instances

variableCriteriaInQuery

protected boolean variableCriteriaInQuery(org.kie.internal.query.data.QueryData queryData)

processQueryActionQueue

protected void processQueryActionQueue(Queue<org.kie.remote.services.rest.query.QueryAction> queryActionQueue,
                                       Map<String,String> varValueMap,
                                       Map<String,String> varRegexMap,
                                       boolean workFlowInstanceVariables)
This is the main core of logic for the query helper classes.

Initially, in methods called before this method, we converted the (REST operation) query methods to a Deque of QueryAction instances.

We're using a Queue instead of a List because I may eventually want to add new QueryAction elements to the queue during processing: once I'm sure that I won't be doing that, I'll move this back to a List which is more efficient and performant.

In this method, we go through each element (in the order that it was added) and translate the REST query parameter to a action on the query builder(s) so that the requested query can be built an executed.

Parameters:
queryActionQueue - An ordered collection of QueryAction instances
varValueMap - A Map mapping the variable name to the variable's value
varRegexMap - A Map mapping the variable name to a regex for the variable's value
workFlowInstanceVariables - Whether or not variable values should be retrieved from the audit logs or the process instance

setQueryBuilders

protected void setQueryBuilders(org.kie.remote.services.rest.query.RemoteServicesQueryCommandBuilder... queryBuilders)

getQueryBuilders

protected org.kie.remote.services.rest.query.RemoteServicesQueryCommandBuilder[] getQueryBuilders()

processInstanceId

public void processInstanceId(long[] longData)

processInstanceIdMin

public void processInstanceIdMin(long[] longData)

processInstanceIdMax

public void processInstanceIdMax(long[] longData)

processId

public void processId(String[] data)

workItemId

public void workItemId(long[] longData)

deploymentId

public void deploymentId(String[] data)

taskIdMin

public void taskIdMin(long longData)

taskIdMax

public void taskIdMax(long longData)

processInstanceStatus

public void processInstanceStatus(int[] intData)

processVersion

public void processVersion(String[] data)

startDateMin

public void startDateMin(Date date)

startDateMax

public void startDateMax(Date date)

startDate

public void startDate(Date[] dateData)

endDateMin

public void endDateMin(Date date)

endDateMax

public void endDateMax(Date date)

endDate

public void endDate(Date[] dateData)

variableId

public void variableId(String[] data)

value

public void value(String[] data)

variableValue

public void variableValue(String varId,
                          String value)

KIE Remote Services :: Services 6.2.0.CR4

Copyright © 2001-2015 JBoss by Red Hat. All Rights Reserved.