Ejemplo n.º 1
0
  /**
   * Inserts a message to the database using a object made in Java
   *
   * @param message the message object constructed by the application
   * @return true if the message was inserted, else false
   */
  @Override
  public boolean insert(Message message) {
    boolean success = true;

    try {
      // Set the current time for the object
      message.updateTimestamp();

      // Insert object
      this.messageData.insert(message);
      this.messageCategoriesData.insert(
          new MessageCategories(
              this.messageData.getLastInsertId(), message.getCategory().getCid()));
    } catch (Exception e) {
      success = false;
    }

    return success;
  }