コード例 #1
0
  /** Gets a description div of a workflow */
  public String doGetAvailableWorkflowProperties() throws Exception {
    StringBuffer sb = new StringBuffer();

    String workflowName = getRequest().getParameter("workflowName");

    try {
      List availableWorkflowVOList = controller.getAvailableWorkflowVOList(getInfoGluePrincipal());

      Iterator availableWorkflowVOListIterator = availableWorkflowVOList.iterator();
      while (availableWorkflowVOListIterator.hasNext()) {
        WorkflowVO availableWorkflowVO = (WorkflowVO) availableWorkflowVOListIterator.next();
        if (workflowName.equals(availableWorkflowVO.getName())) {
          sb.append(
              "<div id=\"availableWorkflowDetailsProperties\" class=\"propertiesDiv\" style=\"z-index: 10;\">");
          sb.append(
              "	<div id=\"availableWorkflowDetailsPropertiesHandle\" class=\"propertiesDivHandle\">");
          sb.append(
              "		<div id=\"propertiesDivLeftHandle\" class=\"propertiesDivLeftHandle\">"
                  + availableWorkflowVO.getName()
                  + "</div><div id=\"propertiesDivRightHandle\" class=\"propertiesDivRightHandle\"><a href=\"javascript:hideDiv('availableWorkflowDetailsProperties');\" class=\"white\">close</a></div>");
          sb.append("	</div>");
          sb.append(
              "	<div id=\"availableWorkflowDetailsPropertiesBody\" class=\"propertiesDivBody\">");
          sb.append("		<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" width=\"100%\">");

          Iterator workflowStepVOIterator = availableWorkflowVO.getDeclaredSteps().iterator();
          while (workflowStepVOIterator.hasNext()) {
            WorkflowStepVO workflowStepVO = (WorkflowStepVO) workflowStepVOIterator.next();

            sb.append("		<tr style=\"background-color: white;\">");
            sb.append("			<td>" + workflowStepVO.getName() + "</td>");
            sb.append(
                "			<td>"
                    + (workflowStepVO.getOwner() != null
                        ? workflowStepVO.getOwner()
                        : "Not specified")
                    + "</td>");
            sb.append("		</tr>");

            Iterator workflowActionVOIterator = workflowStepVO.getActions().iterator();
            while (workflowActionVOIterator.hasNext()) {
              WorkflowActionVO workflowActionVO =
                  (WorkflowActionVO) workflowActionVOIterator.next();

              sb.append("<tr style=\"background-color: #eeeeee;\">");
              sb.append(
                  "	<td style=\"padding-left: 20px; font-size:10px;\">"
                      + workflowActionVO.getName()
                      + "</td>");
              sb.append(
                  "		<td style=\"padding-left: 20px; font-size:10px;\"><!--"
                      + workflowActionVO.getView()
                      + "--></td>");
              sb.append("	</tr>");
            }
          }
          sb.append("		</table>");
          sb.append("	</div>");
          sb.append("</div>");
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    this.getResponse().setContentType("text/plain");
    this.getResponse().getWriter().println(sb.toString());

    return NONE;
  }
コード例 #2
0
  /** Here are some ajax-methods */
  public String doGetActiveWorkflowProperties() throws Exception {
    StringBuffer sb = new StringBuffer();

    String activeWorkflowId = getRequest().getParameter("activeWorkflowId");

    populateActiveWorkflowVOList();

    List currentWorkflowVOList = workflowVOList;
    Iterator activeWorkflowVOListIterator = currentWorkflowVOList.iterator();
    while (activeWorkflowVOListIterator.hasNext()) {
      WorkflowVO workflowVO = (WorkflowVO) activeWorkflowVOListIterator.next();
      if (activeWorkflowId.equals(workflowVO.getId().toString())) {
        sb.append(
            "<div id=\"activeWorkflowDetailsProperties\" class=\"propertiesDiv\" style=\"z-index:10\">");
        sb.append(
            "	<div id=\"activeWorkflowDetailsPropertiesHandle\" class=\"propertiesDivHandle\">");
        sb.append(
            "		<div id=\"propertiesDivLeftHandle\" class=\"propertiesDivLeftHandle\" style=\"width: 300px;\">"
                + workflowVO.getName()
                + "&nbsp;-&nbsp;#"
                + workflowVO.getId()
                + "</div><div id=\"propertiesDivRightHandle\" class=\"propertiesDivRightHandle\"><a href=\"javascript:hideDiv('activeWorkflowDetailsProperties');\" class=\"white\">close</a></div>");
        sb.append("	</div>");
        sb.append("	<div id=\"activeWorkflowDetailsPropertiesBody\" class=\"propertiesDivBody\">");
        sb.append("		<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" width=\"100%\">");

        Iterator stepsIterator = workflowVO.getSteps().iterator();
        while (stepsIterator.hasNext()) {
          WorkflowStepVO workflowStepVO = (WorkflowStepVO) stepsIterator.next();

          sb.append("		<tr>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + workflowStepVO.getName()
                  + "</td>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + (workflowStepVO.getOwner() != null
                      ? workflowStepVO.getOwner()
                      : "Not specified")
                  + "</td>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + (workflowStepVO.getCaller() != null
                      ? workflowStepVO.getCaller()
                      : "Not specified")
                  + "</td>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + workflowStepVO.getStatus()
                  + "</td>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + (workflowStepVO.getStartDate() == null
                      ? "Not started"
                      : formatter.formatDate(workflowStepVO.getStartDate(), "yyyy-MM-dd"))
                  + "</td>");
          sb.append(
              "			<td style=\""
                  + (workflowStepVO.getFinishDate() == null ? "color: black;" : "color: silver;")
                  + "\">"
                  + (workflowStepVO.getFinishDate() == null
                      ? "Not completed"
                      : formatter.formatDate(workflowStepVO.getFinishDate(), "yyyy-MM-dd"))
                  + "</td>");
          sb.append("		</tr>");
        }

        sb.append("		</table>");
        sb.append("		</div>");
        sb.append("	</div>");
        break;
      }
    }

    this.getResponse().setContentType("text/plain");
    this.getResponse().getWriter().println(sb.toString());

    return NONE;
  }