/**
   * Creates the view URL from the given workflow action.
   *
   * @param action a workflow action
   * @return the view URL
   * @throws SystemException if an error occurs while encoding the URL
   */
  private String getViewUrl(WorkflowActionVO action) throws SystemException {
    if (!action.hasView()) return "";

    StringBuffer buffer = new StringBuffer(action.getView());
    if (containsQuestionMark(action.getView())) buffer.append('&');
    else buffer.append('?');

    return buffer
        .append("workflowId=")
        .append(getWorkflowId())
        .append("&actionId=")
        .append(action.getId())
        .append("&returnAddress=")
        .append(getReturnAddress())
        .append("&finalReturnAddress=")
        .append(getFinalReturnAddress())
        .append('&')
        .append(getRequest().getQueryString())
        .toString();
  }