コード例 #1
0
  @Override
  public List<WorkflowEvent> listWorkflowEvents() {

    List<WorkflowRequestHandler> workflowRequestHandlers =
        WorkflowServiceDataHolder.getInstance().listRequestHandlers();
    List<WorkflowEvent> eventList = new ArrayList<>();
    if (workflowRequestHandlers != null) {
      for (WorkflowRequestHandler requestHandler : workflowRequestHandlers) {
        WorkflowEvent event = new WorkflowEvent();
        event.setEventId(requestHandler.getEventId());
        event.setEventFriendlyName(requestHandler.getFriendlyName());
        event.setEventDescription(requestHandler.getDescription());
        event.setEventCategory(requestHandler.getCategory());
        // note: parameters are not set at here in list operation. It's set only at get operation
        if (requestHandler.getParamDefinitions() != null) {
          Parameter[] parameterDTOs = new Parameter[requestHandler.getParamDefinitions().size()];
          int i = 0;
          for (Map.Entry<String, String> paramEntry :
              requestHandler.getParamDefinitions().entrySet()) {
            Parameter parameterDTO = new Parameter();
            parameterDTO.setParamName(paramEntry.getKey());
            parameterDTO.setParamValue(paramEntry.getValue());
            parameterDTOs[i] = parameterDTO;
            i++;
          }
          event.setParameters(parameterDTOs);
        }
        eventList.add(event);
      }
    }
    return eventList;
  }
コード例 #2
0
  @Override
  public WorkflowEvent getEvent(String id) {

    WorkflowRequestHandler requestHandler =
        WorkflowServiceDataHolder.getInstance().getRequestHandler(id);
    if (requestHandler != null) {
      WorkflowEvent event = new WorkflowEvent();
      event.setEventId(requestHandler.getEventId());
      event.setEventFriendlyName(requestHandler.getFriendlyName());
      event.setEventDescription(requestHandler.getDescription());
      event.setEventCategory(requestHandler.getCategory());
      if (requestHandler.getParamDefinitions() != null) {
        Parameter[] parameters = new Parameter[requestHandler.getParamDefinitions().size()];
        int i = 0;
        for (Map.Entry<String, String> paramEntry :
            requestHandler.getParamDefinitions().entrySet()) {
          Parameter parameter = new Parameter();
          parameter.setParamName(paramEntry.getKey());
          parameter.setParamValue(paramEntry.getValue());
          parameters[i] = parameter;
          i++;
        }
        event.setParameters(parameters);
      }
      return event;
    }
    return null;
  }
コード例 #3
0
  @Override
  public List<Association> listAllAssociations() throws WorkflowException {

    List<Association> associations = workflowDAO.listAssociations();
    for (Iterator<Association> iterator = associations.iterator(); iterator.hasNext(); ) {
      Association association = iterator.next();
      WorkflowRequestHandler requestHandler =
          WorkflowServiceDataHolder.getInstance().getRequestHandler(association.getEventId());
      if (requestHandler != null) {
        association.setEventName(requestHandler.getFriendlyName());
      } else {
        // invalid reference, probably event id is renamed or removed
        iterator.remove();
      }
    }
    return associations;
  }