public Number insertStatus(Integer workingSetID, WorkflowStatus status)
      throws WorkflowManagerException {
    final Number id;

    final Row row = new Row();
    try {
      row.add(new CInteger("id", id = RowID.get(ec, WorkflowConstants.WORKFLOW_TABLE, "id")));
    } catch (DBException e) {
      throw new WorkflowManagerException(e);
    }
    row.add(new CString("status", status.toString()));
    row.add(new CString("workingsetid", workingSetID.toString()));

    final InsertQuery query = new InsertQuery();
    query.setTable(WorkflowConstants.WORKFLOW_TABLE);
    query.setRow(row);

    try {
      ec.doUpdate(query);
    } catch (DBException e) {
      throw new WorkflowManagerException(e);
    }

    return id;
  }
  private String buildBody(WorkflowUserInfo recipient) {
    bodyBuilder = new StringBuilder();

    append("Dear " + recipient.getDisplayName(), 2);
    append(
        "The following working set within SIS has "
            + "been submitted to you for "
            + newStatus.getEmailFriendlyDesc()
            + ":",
        2);

    append("Working Set: " + workingSet.getWorkingSetName());
    append("Working Set Owner: " + workingSet.getCreatorUsername());
    append("Working Set Status: " + workingSet.getWorkflowStatus());
    append("Working Set Description: " + workingSet.getDescription());
    append("Number of species: " + Integer.toString(workingSet.getSpeciesIDs().size()));
    append("Submission notes: " + comment.getComment());
    append("Person submitting: " + sender.getDisplayName(), 2);
    append(
        "Please log into SIS and review the assessments; be sure "
            + "to provide appropriate notes and to change the status, if necessary, "
            + "to keep the assessments moving through the submission process.",
        2);
    append("Thank you.", 2);
    append("SIS Administration.");

    return bodyBuilder.toString();
  }
  @Override
  public void updateStatus(Number id, WorkflowStatus status) throws WorkflowManagerException {
    final Row row = new Row();
    row.add(new CString("status", status.toString()));

    final UpdateQuery query = new UpdateQuery();
    query.setTable(WorkflowConstants.WORKFLOW_TABLE);
    query.setRow(row);
    query.constrain(
        new CanonicalColumnName(WorkflowConstants.WORKFLOW_TABLE, "id"), QConstraint.CT_EQUALS, id);

    try {
      ec.doUpdate(query);
    } catch (DBException e) {
      throw new WorkflowManagerException(e);
    }
  }