Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.kie.remote.services.rest.query;
  
  import static org.kie.internal.query.QueryParameterIdentifiers.ACTUAL_OWNER_ID_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.BUSINESS_ADMIN_ID_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.CREATED_BY_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.END_DATE_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.EXTERNAL_ID_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.LAST_VARIABLE_LIST;
  import static org.kie.internal.query.QueryParameterIdentifiers.OLD_VALUE_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.POTENTIAL_OWNER_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.PROCESS_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.PROCESS_INSTANCE_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.PROCESS_INSTANCE_STATUS_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.PROCESS_VERSION_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.STAKEHOLDER_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.START_DATE_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.TASK_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.TASK_STATUS_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.VALUE_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.VARIABLE_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.VAR_VALUE_ID_LIST;
 import static org.kie.internal.query.QueryParameterIdentifiers.VAR_VAL_SEPARATOR;
 import static org.kie.internal.query.QueryParameterIdentifiers.WORK_ITEM_ID_LIST;
 
 import java.util.Date;
 
 import  org.jbpm.process.audit.command.AuditVariableInstanceLogQueryCommand;
 import  org.jbpm.services.task.commands.TaskQueryDataCommand;
 import  org.kie.api.task.model.Status;
 import  org.kie.internal.query.AbstractQueryBuilderImpl;
 import  org.kie.internal.query.data.QueryData;
 import  org.kie.internal.runtime.manager.audit.query.NodeInstanceLogQueryBuilder;
 import  org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder;
 import  org.kie.internal.runtime.manager.audit.query.VariableInstanceLogQueryBuilder;
 import  org.kie.internal.runtime.manager.audit.query.NodeInstanceLogQueryBuilder.OrderBy;
 import  org.kie.internal.task.query.TaskQueryBuilder;

This is the AbstractQueryBuilderImpl implementation used by the REST query operations to create the queries (the QueryData instances) needed.
 
 class RemoteServicesQueryCommandBuilder extends AbstractQueryBuilderImpl<RemoteServicesQueryCommandBuilder> {
 
     private final String taskUserId;
     
         this. = null;
         intersect();
     }
     
     public RemoteServicesQueryCommandBuilder(String userId) { 
         this. = userId;
         intersect();
     }
 
     // process related criteria
    
    
Add one or more deployment ids as a criteria to the query

Parameters:
deploymentId
Returns:
the current instance
 
     public RemoteServicesQueryCommandBuilder deploymentIdString... deploymentId ) {
         addObjectParameter(EXTERNAL_ID_LIST, "deployment id"deploymentId);
         return this;
     }

    
Add one or more process ids as a criteria to the query

Parameters:
processId
Returns:
the current instance
 
     public RemoteServicesQueryCommandBuilder processIdString... processId ) {
         addObjectParameter(PROCESS_ID_LIST, "process id"processId );
         return this;
     }

    
Add one or more process versions as a criteria to the query

Parameters:
processId
Returns:
the current instance
 
     public RemoteServicesQueryCommandBuilder processVersionString... processVersion ) {
         addObjectParameter(PROCESS_VERSION_LIST, "process version"processVersion);
         return this;
     }

    
Add one or more process instance ids as a criteria to the query

Parameters:
processInstanceId
Returns:
the current instance
 
     public RemoteServicesQueryCommandBuilder processInstanceIdlong... processInstanceId ) {
         addLongParameter(PROCESS_INSTANCE_ID_LIST, "process instance id"processInstanceId);
         return this;
     }

    
Add one or more process instance ids as a criteria to the query

Parameters:
processInstanceId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder processInstanceIdMinlong processInstanceId ) {
        addRangeParameter(PROCESS_INSTANCE_ID_LIST, "process instance id range, start"processInstanceIdtrue);
        return this;
    }

    
Add one or more process instance ids as a criteria to the query

Parameters:
processInstanceId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder processInstanceIdMaxlong processInstanceId ) {
        addRangeParameter(PROCESS_INSTANCE_ID_LIST, "process instance id range, end"processInstanceIdfalse);
        return this;
    }
    
    
Specify one more statuses (in the form of an int) as criteria.

Parameters:
status one or more int statuses
Returns:
The current instance of this query builder
    public RemoteServicesQueryCommandBuilder processInstanceStatus(int... status) { 
        addIntParameter(PROCESS_INSTANCE_STATUS_LIST, "process instance status"status);
        return this;
    }
    public RemoteServicesQueryCommandBuilder startDateDate... date ) {
        addObjectParameter(START_DATE_LIST, "start date"date);
        return this;
    }
    public RemoteServicesQueryCommandBuilder startDateMinDate rangeStart ) {
        addRangeParameter(START_DATE_LIST, "start date range, start"rangeStarttrue);
        return this;
    }
    public RemoteServicesQueryCommandBuilder startDateMaxDate rangeEnd ) {
        addRangeParameter(START_DATE_LIST, "start date range, end"rangeEndfalse);
        return this;
    }
    public RemoteServicesQueryCommandBuilder endDateDate... date ) {
        addObjectParameter(END_DATE_LIST, "end date"date );
        return this;
    }
    public RemoteServicesQueryCommandBuilder endDateMinDate rangeStart ) {
        addRangeParameter(END_DATE_LIST, "end date range, start"rangeStarttrue);
        return this;
    }
    public RemoteServicesQueryCommandBuilder endDateMaxDate rangeEnd ) {
        addRangeParameter(END_DATE_LIST, "end date range, end"rangeEndfalse);
        return this;
    }
    // task related criteria
    
    public RemoteServicesQueryCommandBuilder workItemIdlong... workItemId ) {
        addLongParameter(WORK_ITEM_ID_LIST, "work item id"workItemId);
        return this;
    }

    
Add one or more task ids as a criteria to the query

Parameters:
taskId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder taskIdlong... taskId ) {
        addLongParameter(TASK_ID_LIST, "task id"taskId);
        return this;
    }

    
Add the start of a range of task ids as a criteria to the query

Parameters:
taskId the lower end of the range, inclusive
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder taskIdMinlong taskId ) {
        addRangeParameter(TASK_ID_LIST, "task instance id range, start"taskIdtrue);
        return this;
    }
    
    
Add the end of a range of task ids as a criteria to the query

Parameters:
taskId the upper end of the range, inclusive
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder taskIdMaxlong taskId ) {
        addRangeParameter(TASK_ID_LIST, "task instance id range, start"taskIdfalse);
        return this;
    }
    
    
Add one or more statuses as a criteria to the query

Parameters:
status
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder taskStatus( Status... status ) {
        addObjectParameter(TASK_STATUS_LIST, "task status"status);
        return this;
    }

    

    
Add one or more initiator ids as a criteria to the query

Parameters:
createdById
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder initiatorString... createdById ) {
        addObjectParameter(CREATED_BY_LIST, "initiator"createdById);
        return this;
    }

    
Add one or more stakeholder ids as a criteria to the query

Parameters:
stakeHolderId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder stakeHolderString... stakeHolderId ) {
        addObjectParameter(STAKEHOLDER_ID_LIST, "stakeholder"stakeHolderId);
        return this;
    }
    
    
Add one or more potential owner ids as a criteria to the query

Parameters:
stakeHolderId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder potentialOwnerString... potentialOwnerId ) {
        addObjectParameter(POTENTIAL_OWNER_ID_LIST, "potential owner"potentialOwnerId);
        return this;
    }

    
Add one or more (actual) task owner ids as a criteria to the query

Parameters:
taskOwnerId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder taskOwnerString... taskOwnerId ) {
        addObjectParameter(ACTUAL_OWNER_ID_LIST, "task owner"taskOwnerId);
        return this;
    }

    
Add one or more business administrator ids as a criteria to the query

Parameters:
businessAdminId
Returns:
the current instance
    public RemoteServicesQueryCommandBuilder businessAdminString... businessAdminId ) {
        addObjectParameter(BUSINESS_ADMIN_ID_LIST, "business admin"businessAdminId);
        return this;
    }
    public RemoteServicesQueryCommandBuilder variableIdString... variableId ) {
        addObjectParameter(VARIABLE_ID_LIST, "variable id"variableId );
        return this;
    }
   
    // variable related critera
    
    public RemoteServicesQueryCommandBuilder valueString... value ) {
        addObjectParameter(VALUE_LIST, "variable value"value );
        return this;
    }
    public RemoteServicesQueryCommandBuilder oldValueString... oldVvalue ) {
        addObjectParameter(OLD_VALUE_LIST, "old variable value"oldVvalue );
        return this;
    }
    
    public RemoteServicesQueryCommandBuilder variableValue(String variableIdString value) {
        String varValStr = variableId.length() + VAR_VAL_SEPARATOR + variableId + VAR_VAL_SEPARATOR + value;
        addObjectParameter(VAR_VALUE_ID_LIST, "value for variable"varValStr);
        return this;
    }
    
        addObjectParameter(LAST_VARIABLE_LIST, "last variable value"..booleanValue() );
        return this;
    }
    public RemoteServicesQueryCommandBuilder orderByObject orderByField ) {
        iforderByField == null ) { 
            throw new IllegalArgumentException"A null order by criteria is invalid." );
        }
        String orderByString = null;
        iforderByField instanceof TaskQueryBuilder.OrderBy ) { 
            switch( (TaskQueryBuilder.OrderBy) orderByField ) {
            case processInstanceId:
                orderByString = "t.taskData.processInstanceId";
                break;
            default:
                throw new UnsupportedOperationException("Unsupported order by arqument: " + orderByField.toString() );
            }
        } else iforderByField instanceof VariableInstanceLogQueryBuilder.OrderBy ) {
            switch( (VariableInstanceLogQueryBuilder.OrderBy) orderByField ) { 
            case processInstanceId:
                orderByString = "processInstanceId";
                break;
            default:
                throw new UnsupportedOperationException("Unsupported order by arqument: " + orderByField.toString() );
            }
        } else iforderByField instanceof ProcessInstanceLogQueryBuilder.OrderBy ) {
            switch( (ProcessInstanceLogQueryBuilder.OrderBy) orderByField ) { 
            case processInstanceId:
                orderByString = "processInstanceId";
                break;
            default:
                throw new UnsupportedOperationException("Unsupported order by arqument: " + orderByField.toString() );
            }
        }
        this..getQueryContext().setOrderBy(orderByString);
        return this;
    }
        
    // command generation
    
    public TaskQueryDataCommand createTaskQueryDataCommand() { 
        if == null ) { 
            throw new IllegalStateException("A user id is required to create a " + TaskQueryDataCommand.class.getSimpleName() );
        }
        TaskQueryDataCommand cmd = new TaskQueryDataCommand(getQueryData());
        cmd.setUserId();
        return cmd;
    }
    
    public AuditVariableInstanceLogQueryCommand createVariableInstanceLogQueryCommand() { 
        return new AuditVariableInstanceLogQueryCommand(getQueryData());
    }
    @Override
      super.clear();
      intersect();
      return this;
    }
    
New to GrepCode? Check out our FAQ X