Class RelationShipDao

    • Constructor Detail

      • RelationShipDao

        public RelationShipDao()
    • Method Detail

      • createRelationShip

        public int createRelationShip​(Connection connection,
                                      RelationShip relationShip)
                               throws SQLException
        Creates the specified relationship in the data source.
        Parameters:
        connection - a connection to the data source.
        relationShip - the relationship to create.
        Returns:
        the unique identifier of the created relationship.
        Throws:
        SQLException - if an error occurs while creating the relationship in the data source.
      • deleteRelationShip

        public boolean deleteRelationShip​(Connection connection,
                                          int user1Id,
                                          int user2Id)
                                   throws SQLException
        Deletes the relationship between the two specified users in the data source.
        Parameters:
        connection - a connection to the data source.
        user1Id - the unique identifier of a user in Silverpeas.
        user2Id - the unique identifier of another user in Silverpeas
        Returns:
        true if the deletion succeeds, false otherwise.
        Throws:
        SQLException - if an error occurs while deleting the relationship between the two users.
      • getRelationShip

        public RelationShip getRelationShip​(Connection connection,
                                            int user1Id,
                                            int user2Id)
                                     throws SQLException
        Gets the relationship between the two specified users from the data source.
        Parameters:
        connection - a connection to the data source.
        user1Id - the unique identifier of a user in Silverpeas.
        user2Id - the unique identifier of another user in Silverpeas.
        Returns:
        the relationship between the two specified users or null if there is no relationship between the two users in the data source.
        Throws:
        SQLException - if an error occurs while getting the relationship between the two users.
      • isInRelationShip

        public boolean isInRelationShip​(Connection connection,
                                        int user1Id,
                                        int user2Id)
                                 throws SQLException
        Does exist a relationship between the two specified users in the data source.
        Parameters:
        connection - a connection to the data source.
        user1Id - the unique identifier of a user in Silverpeas.
        user2Id - the unique identifier of another user in Silverpeas.
        Returns:
        true if a relationship between the two users exist in the data source. False otherwise.
        Throws:
        SQLException - if an error occurs while checking the existence of a relationship between the two users.
      • getAllMyRelationShips

        public List<RelationShip> getAllMyRelationShips​(Connection connection,
                                                        int myId)
                                                 throws SQLException
        Gets all the relationships of the specified user in the data source.
        Parameters:
        connection - a connection to the data source.
        myId - the unique identifier of a user in Silverpeas.
        Returns:
        a list of all the relationships of the given user.
        Throws:
        SQLException - if an error occurs while getting the relationships of the given user.
      • getAllMyRelationShips

        public List<SocialInformation> getAllMyRelationShips​(Connection con,
                                                             String userId,
                                                             Date begin,
                                                             Date end)
                                                      throws SQLException
        Gets from the data source all the social information that were emitted between the two specified dates and that are about the relationships of the relationships of the specified user.
        Parameters:
        con - the connection to the data source.
        userId - the unique identifier of a user in Silverpeas.
        begin - the begin date of the search interval.
        end - the end date of the search interval.
        Returns:
        a list of SocialInformationRelationShip instances.
        Throws:
        SQLException - if an error occurs while gettings the social information.
      • getRelationShip

        public RelationShip getRelationShip​(Connection connection,
                                            int relationShipId)
                                     throws SQLException
        Gets the relationship in the data source that have the specified unique identifier.
        Parameters:
        connection - a connection to the data source.
        relationShipId - the relationship identifier
        Returns:
        the RelationShip instance loaded from the relationship identifier
        Throws:
        SQLException - on SQL error.