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 a count of the nodes associated with the given sCodeIS
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param sCodeID, the code id for the particular code object
   * @return a count of the nodes associated with given sCodeID in the DB
   * @exception java.sql.SQLException
   */
  public int getNodeCount(PCSession session, String sCodeID) throws SQLException {

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

    int count = DBCodeNode.getNodeCount(dbcon, sCodeID);

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

    return count;
  }
Exemplo n.º 3
0
  /**
   * Returns all the nodes associated with the given sCodeIS
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param sCodeID, the code id for the particular code object
   * @return a Vector of all the nodes associated with given sCodeID in the DB
   * @exception java.sql.SQLException
   */
  public Vector getNodes(PCSession session, String sCodeID, String userID) throws SQLException {

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

    Vector vtNodes = DBCodeNode.getNodes(dbcon, sCodeID, userID);

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

    return vtNodes;
  }
Exemplo n.º 4
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.º 5
0
  /**
   * Returns all the codes in the DB
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @return a Vector of all the codes in the Database
   * @exception java.sql.SQLException
   */
  public Vector getCodes(PCSession session) throws SQLException {

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

    Vector vtCodes = DBCode.getCodes(dbcon);

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

    return vtCodes;
  }
Exemplo n.º 6
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.º 7
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;
  }
Exemplo n.º 8
0
  /**
   * CURRENTLY NOT IMPLEMENTED.<br>
   * Gets the behavior of the code with the particular codeID
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param codeId, the code id for the particular code object
   * @return the behavior of the code
   * @exception throws java.sql.SQLException
   */
  public String getBehavior(PCSession session, String codeId) throws SQLException {

    String modelName = session.getModelName();
    // get the behavior
    return null;
  }
Exemplo n.º 9
0
  /**
   * CURRENTLY NOT IMPLEMENTED.<br>
   * Gets the description of the code with the particular codeID
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param codeId, the code id for the particular code object
   * @return the description of the code
   * @exception throws java.sql.SQLException
   */
  public String getDescription(PCSession session, String codeId) throws SQLException {

    String modelName = session.getModelName();
    // get the description
    return null;
  }
Exemplo n.º 10
0
  /**
   * CURRENTLY NOT IMPLEMENTED.<br>
   * Gets the name of the code with the particular code Id
   *
   * @param PCSession session, the PCSession object for the database to use.
   * @param codeId, the code id for the particular code object
   * @return the name of the code
   * @exception throws java.sql.SQLException
   */
  public String getName(PCSession session, String codeId) {

    String modelName = session.getModelName();
    // retrieve code name from database
    return null;
  }