/**
  * Method declaration
  *
  * @param con
  * @see
  */
 private void freeConnection(Connection con) {
   if (con != null) {
     try {
       con.close();
     } catch (Exception e) {
       SilverTrace.error(
           "favorit", "FavoritBmEJB.freeConnection", "root.MSG_GEN_CONNECTION_CLOSE_FAILED");
     }
   }
 }
  /**
   * Method declaration
   *
   * @param userId
   * @param node
   * @see
   */
  public void addFavoritNode(String userId, NodePK node) {
    SilverTrace.info(
        "favorit",
        "FavoritBmEJB.addFavoritNode",
        "root.MSG_GEN_ENTER_METHOD",
        "userId = " + userId + ", node = " + node.toString());
    Connection con = null;

    try {
      con = getConnection();
      NodeActorLinkDAO.add(con, rootTableName, userId, node);
    } catch (Exception e) {
      throw new FavoritRuntimeException("favorit.CANNOT_ADD_FAVORIT", e);
    } finally {
      freeConnection(con);
    }
  }
  /**
   * Method declaration
   *
   * @param node
   * @param path
   * @see
   */
  public void removeFavoritByNodePath(NodePK node, String path) {
    SilverTrace.info(
        "favorit",
        "FavoritBmEJB.removeFavoritByNodePath",
        "root.MSG_GEN_ENTER_METHOD",
        "node = " + node.toString() + ", path = " + path);
    Connection con = null;

    try {
      con = getConnection();
      NodeActorLinkDAO.removeByNodePath(con, rootTableName, node, path);
    } catch (Exception e) {
      throw new FavoritRuntimeException("favorit.CANNOT_REMOVE_FAVORIT_BY_NODE", e);
    } finally {
      freeConnection(con);
    }
  }
  /**
   * Method declaration
   *
   * @param userId
   * @see
   */
  public void removeFavoritByUser(String userId) {
    SilverTrace.info(
        "favorit",
        "FavoritBmEJB.removeFavoritByUser",
        "root.MSG_GEN_ENTER_METHOD",
        "userId = " + userId);
    Connection con = null;

    try {
      con = getConnection();
      NodeActorLinkDAO.removeByUser(con, rootTableName, userId);
    } catch (Exception e) {
      throw new FavoritRuntimeException("favorit.CANNOT_REMOVE_FAVORIT_BY_USER", e);
    } finally {
      freeConnection(con);
    }
  }
  /**
   * Method declaration
   *
   * @param userId
   * @return
   * @see
   */
  public Collection getFavoritNodePKs(String userId) {
    SilverTrace.info(
        "favorit",
        "FavoritBmEJB.getFavoritNodePKs",
        "root.MSG_GEN_ENTER_METHOD",
        "userId = " + userId);
    Connection con = null;
    Collection result = null;

    try {
      con = getConnection();
      result = NodeActorLinkDAO.getNodePKsByActor(con, rootTableName, userId);
    } catch (Exception e) {
      throw new FavoritRuntimeException("favorit.CANNOT_GET_FAVORIT_BY_USER", e);
    } finally {
      freeConnection(con);
    }
    return result;
  }
 /**
  * Constructor declaration
  *
  * @see
  */
 public FavoritBmEJB() {
   SilverTrace.info("favorit", "FavoritBmEJB.FavoritBmEJB", "root.MSG_GEN_ENTER_METHOD");
 }