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;
  }
  @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);
    }
  }
  @Override
  public void addComment(Number id, WorkflowComment comment) throws WorkflowManagerException {
    final Row row = new Row();
    try {
      row.add(new CInteger("id", RowID.get(ec, WorkflowConstants.WORKFLOW_NOTES_TABLE, "id")));
    } catch (DBException e) {
      throw new WorkflowManagerException(e);
    }
    row.add(new CInteger("workflowstatusid", id));
    row.add(new CString("scope", comment.getScope()));
    row.add(new CInteger("userid", comment.getUser().getID()));
    row.add(new CString("comment", comment.getComment()));
    row.add(new CDateTime("date", comment.getDate()));

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

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