Exemplo n.º 1
0
  /**
   * Adds a new code to the database and returns it if successful
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param String sCodeID, the code id for the particular code object
   * @param String sAuthor, the author of this code
   * @param Date dCreationDate, the creation date of this code
   * @param Date dModificationDate, the modification date
   * @param String sName, the value of the code name
   * @param String sDescription, the value of the code description
   * @param String sBehavior, the value of the code behavior
   * @return Code, the newly created Code object from the data placed in the database.
   * @exception java.sql.SQLException
   */
  public Code createCode(
      PCSession session,
      String sCodeID,
      String sAuthor,
      java.util.Date dCreationDate,
      java.util.Date dModificationDate,
      String sName,
      String sDescription,
      String sBehavior)
      throws SQLException {

    DBConnection dbcon = getDatabaseManager().requestConnection(session.getModelName());

    Code code =
        DBCode.insert(
            dbcon,
            null /*NodeId*/,
            sCodeID,
            sAuthor,
            dCreationDate,
            dModificationDate,
            sName,
            sDescription,
            sBehavior);

    getDatabaseManager().releaseConnection(session.getModelName(), dbcon);

    return code;
  }
Exemplo n.º 2
0
  /**
   * Returns all the codes for the given code name
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param String sName, the value of the code name
   * @return a Vector of all the codes for the given code name
   * @exception java.sql.SQLException
   */
  public Vector getCodeIDs(PCSession session, String name) throws SQLException {

    DBConnection dbcon = getDatabaseManager().requestConnection(session.getModelName());

    Vector vtCodes = DBCode.getCodeIDs(dbcon, name);

    getDatabaseManager().releaseConnection(session.getModelName(), dbcon);

    return vtCodes;
  }
Exemplo n.º 3
0
  /**
   * Returns the Code Object for the given code name
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param String sName, the name of the code to return
   * @return a Code object for the given code name
   * @exception java.sql.SQLException
   */
  public Code getCodeForName(PCSession session, String sName) throws SQLException {

    DBConnection dbcon = getDatabaseManager().requestConnection(session.getModelName());

    Code code = DBCode.getCodeForName(dbcon, sName);

    getDatabaseManager().releaseConnection(session.getModelName(), dbcon);

    return code;
  }
Exemplo n.º 4
0
  /**
   * Delete a code with the given code id from the database and returns it if successful
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param String sCodeID, the code id for the particular code object
   * @return boolean, indicating if the deletion of the code was successful.
   * @exception java.sql.SQLException, if something went wrong.
   */
  public boolean delete(PCSession session, String sCodeID) throws SQLException {

    DBConnection dbcon = getDatabaseManager().requestConnection(session.getModelName());

    boolean deleted = DBCode.delete(dbcon, sCodeID);

    getDatabaseManager().releaseConnection(session.getModelName(), dbcon);

    return deleted;
  }
Exemplo n.º 5
0
  /**
   * Udaptes the behavior of the code with the particular sCodeID
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param String sCodeID, the code id for the particular code object
   * @param String sBehavior, the value of the code behavior
   * @param Date dModificationDate, the modification date
   * @exception throws java.sql.SQLException
   */
  public boolean setBehavior(
      PCSession session, String sCodeID, String sBehavior, java.util.Date dModificationDate)
      throws SQLException {

    DBConnection dbcon = getDatabaseManager().requestConnection(session.getModelName());

    boolean successful = DBCode.setBehavior(dbcon, sCodeID, sBehavior, dModificationDate);

    getDatabaseManager().releaseConnection(session.getModelName(), dbcon);

    return successful;
  }