@Override
  public Collection<ProcessInstanceSummary> getProcessInstances(
      List<Integer> states, String filterText, int filterType, String initiator) {
    Collection<ProcessInstanceDesc> result = null;
    if (filterType == 0) {
      // search by process id
      result = dataService.getProcessInstancesByProcessId(states, filterText, initiator);
    } else if (filterType == 1) {
      // search by process name
      result = dataService.getProcessInstancesByProcessName(states, filterText, initiator);
    } else {
      result = dataService.getProcessInstances(states, initiator);
    }

    return ProcessInstanceHelper.adaptCollection(result);
  }
  @Override
  public Collection<String> getAvailableSignals(String businessKey, long processInstanceId) {
    ProcessInstanceDesc piDesc = dataService.getProcessInstanceById(processInstanceId);
    KieSession ksession = domainService.getSessionById(piDesc.getSessionId());
    ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId);
    Collection<String> activeSignals = new ArrayList<String>();

    if (processInstance != null) {
      ((ProcessInstanceImpl) processInstance)
          .setProcess(ksession.getKieBase().getProcess(processInstance.getProcessId()));
      Collection<NodeInstance> activeNodes =
          ((WorkflowProcessInstance) processInstance).getNodeInstances();

      activeSignals.addAll(ProcessInstanceHelper.collectActiveSignals(activeNodes));
    }

    return activeSignals;
  }
 public ProcessInstanceSummary getProcessInstanceById(long processInstanceId) {
   return ProcessInstanceHelper.adapt(dataService.getProcessInstanceById(processInstanceId));
 }
 public Collection<ProcessInstanceSummary> getProcessInstancesBySessionId(String sessionId) {
   return ProcessInstanceHelper.adaptCollection(
       dataService.getProcessInstancesBySessionId(sessionId));
 }
 public Collection<ProcessInstanceSummary> getProcessInstances() {
   return ProcessInstanceHelper.adaptCollection(dataService.getProcessInstances());
 }
 public Collection<ProcessInstanceSummary> getProcessInstancesByProcessDefinition(
     String processDefId) {
   return ProcessInstanceHelper.adaptCollection(
       dataService.getProcessInstancesByProcessDefinition(processDefId));
 }