/**
   * Delete a {@link Operation} in the DB
   *
   * @param operation - the {@link Operation} to delete
   * @return <code>true</code> if the item has been updated, <code>false</code> otherwise.
   * @throws OHException
   */
  public boolean deleteOperation(Operation operation) throws OHException {
    DbQueryLogger dbQuery = new DbQueryLogger();
    String sqlString = "DELETE FROM OPERATION WHERE OPE_ID_A = ?";
    List<Object> parameters = Collections.<Object>singletonList(operation.getCode());

    return dbQuery.setDataWithParams(sqlString, parameters, true);
  }
  /**
   * updates an {@link Operation} in the DB
   *
   * @param operation - the {@link Operation} to update
   * @return <code>true</code> if the item has been updated, <code>false</code> otherwise.
   * @throws OHException
   */
  public boolean updateOperation(Operation operation) throws OHException {
    DbQueryLogger dbQuery = new DbQueryLogger();
    boolean result = false;

    try {
      String sqlString =
          "UPDATE OPERATION set "
              + " OPE_DESC = ?,"
              + " OPE_LOCK = OPE_LOCK + 1, "
              + " OPE_STAT = ?"
              + " WHERE OPE_ID_A = ?";

      List<Object> parameters = new ArrayList<Object>();
      parameters.add(operation.getDescription());
      parameters.add(operation.getMajor());
      parameters.add(operation.getCode());

      result = dbQuery.setDataWithParams(sqlString, parameters, true);
      if (result) operation.setLock(operation.getLock() + 1);

    } finally {
      dbQuery.releaseConnection();
    }
    return result;
  }
  /**
   * insert an {@link Operation} in the DB
   *
   * @param operation - the {@link Operation} to insert
   * @return <code>true</code> if the operation has been inserted, <code>false</code> otherwise.
   * @throws OHException
   */
  public boolean newOperation(Operation operation) throws OHException {
    DbQueryLogger dbQuery = new DbQueryLogger();
    String sqlString =
        "INSERT INTO OPERATION (OPE_ID_A, OPE_OCL_ID_A, OPE_DESC, OPE_STAT) VALUES (?, ?, ?, ?)";
    List<Object> parameters = new ArrayList<Object>();
    parameters.add(operation.getCode());
    parameters.add(operation.getType().getCode());
    parameters.add(operation.getDescription());
    parameters.add(operation.getMajor());

    return dbQuery.setDataWithParams(sqlString, parameters, true);
  }