コード例 #1
0
  public void addJournalNote(DocumentNote documentNote) throws Exception {

    kLogger.fine("Adding journal note for document: id=" + documentNote.getDocumentId());

    Connection connection = ConnectionPoolManager.getInstance().getConnection();

    PreparedStatement psInsert = connection.prepareStatement(SQL_INSERT_JOURNALNOTE);

    int i = 1;

    psInsert.setString(i++, documentNote.getNoteData());
    psInsert.setString(i++, documentNote.getUserName().toUpperCase());
    psInsert.setInt(i++, documentNote.getDocumentId());
    psInsert.setString(i++, documentNote.getNoteType());

    int recCount = psInsert.executeUpdate();

    psInsert.close();
    connection.commit();
    connection.close();

    if (recCount == 0) {
      kLogger.warning(
          "Unable to add journal note for document: id=" + documentNote.getDocumentId());
      throw new Exception(
          "Unable to add journal note for document: id=" + documentNote.getDocumentId());
    }
  }
コード例 #2
0
  public void updateJournalNote(DocumentNote documentNote) throws Exception {

    kLogger.fine("Updating journal notes id=" + documentNote.getNoteId());

    Connection connection = ConnectionPoolManager.getInstance().getConnection();

    PreparedStatement psUpdate = connection.prepareStatement(SQL_UPDATE_JOURNALNOTE);

    int i = 1;

    psUpdate.setString(i++, documentNote.getNoteData());
    psUpdate.setString(i++, documentNote.getUserName().toUpperCase());
    psUpdate.setString(i++, documentNote.getCreated());
    if (documentNote.isActive()) {
      psUpdate.setString(i++, "Y");
    } else {
      psUpdate.setString(i++, "N");
    }
    psUpdate.setInt(i++, documentNote.getDocumentId());
    psUpdate.setString(i++, documentNote.getNoteType());

    psUpdate.setInt(i++, documentNote.getNoteId());

    int recCount = psUpdate.executeUpdate();

    psUpdate.close();
    connection.commit();
    connection.close();

    if (recCount == 0) {
      kLogger.warning("Unable to update journal notes id=" + documentNote.getNoteId());
      throw new Exception("Unable to update journal notes id=" + documentNote.getNoteId());
    }
  }