Interface ProfileLogic


  • public interface ProfileLogic
    An interface for working with profiles in Profile2.
    Author:
    Steve Swinsburg (s.swinsburg@lancaster.ac.uk)
    • Method Detail

      • getUserProfile

        UserProfile getUserProfile​(String userUuid)
        Get a UserProfile for the given userUuid

        All users have profiles, even if they haven't filled it in yet. At a very minimum it will contain their name. Privacy checks will determine visibility of other fields

        You must be logged-in in order to make requests to this method as the content returned will be tailored to be visible for the currently logged in user.

        Parameters:
        userUuid - uuid of the user to retrieve the profile for
        Returns:
        UserProfile for the user, that is visible to the requesting user, or null if the user does not exist.
      • getUserProfile

        UserProfile getUserProfile​(String userUuid,
                                   String siteId)
        Get a UserProfile for the given userUuid

        All users have profiles, even if they haven't filled it in yet. At a very minimum it will contain their name. Privacy checks will determine visibility of other fields

        You must be logged-in in order to make requests to this method as the content returned will be tailored to be visible for the currently logged in user.

        Parameters:
        userUuid - uuid of the user to retrieve the profile for
        siteId - a site id to check permissions against. Occasionally, site persmissions like roster.viewemail need to override profile2 permissions.
        Returns:
        UserProfile for the user, that is visible to the requesting user, or null if the user does not exist.
      • saveUserProfile

        boolean saveUserProfile​(org.sakaiproject.api.common.edu.person.SakaiPerson sp)
        Persist a SakaiPerson object and send an email notification, if required.

        Note that this may eventually change to UserProfile, when SakaiPerson is reimplemented.

        Parameters:
        sp - SakaiPerson obj
        Returns:
      • addNewCompanyProfile

        boolean addNewCompanyProfile​(CompanyProfile companyProfile)
        Adds a new company profile to the database.
        Parameters:
        companyProfile - the company profile to add.
        Returns:
        the success of the operation.
      • getCompanyProfiles

        List<CompanyProfile> getCompanyProfiles​(String userId)
        Retrieves the company profiles from the database for the specified user.
        Parameters:
        userId - the ID of the user to query by.
      • removeCompanyProfile

        boolean removeCompanyProfile​(String userId,
                                     long companyProfile)
        Removes the specified company profile for the specified user.
        Parameters:
        userId - the ID of the user to query by.
        companyProfile - the ID of the company profile to remove.
      • updateCompanyProfile

        boolean updateCompanyProfile​(CompanyProfile companyProfile)
        Saves an existing company profile in the database. New company profiles should be added using the addNewCompanyProfile method.
        Parameters:
        companyProfile - the existing company profile to be saved.
        Returns:
        the success of the operation.
      • getSocialNetworkingInfo

        SocialNetworkingInfo getSocialNetworkingInfo​(String userId)
        Retrieves the social networking information for the specified user from the database.
        Parameters:
        userId - the user to query by.
        Returns:
        the social networking information for the specified user.
      • saveSocialNetworkingInfo

        boolean saveSocialNetworkingInfo​(SocialNetworkingInfo socialNetworkingInfo)
        Saves the social networking information to the database.
        Parameters:
        socialNetworkingInfo -
        Returns:
      • getBasicPerson

        BasicPerson getBasicPerson​(String userUuid)
        Get a BasicPerson
        Parameters:
        userUuid -
        Returns:
      • getBasicPerson

        BasicPerson getBasicPerson​(org.sakaiproject.user.api.User user)
        Get a BasicPerson
        Parameters:
        user -
        Returns:
      • getBasicPersons

        List<BasicPerson> getBasicPersons​(List<org.sakaiproject.user.api.User> users)
        Get a List of BasicPersons for the given Users.
        Parameters:
        users -
        Returns:
      • getPerson

        Person getPerson​(String userUuid)
        Get a Person
        Parameters:
        userUuid - The user to lookup
        Returns:
        The found person or null if the person can't be found.
      • getPerson

        Person getPerson​(org.sakaiproject.user.api.User user)
        Get a Person
        Parameters:
        user -
        Returns:
      • getPersons

        List<Person> getPersons​(List<org.sakaiproject.user.api.User> users)
        Get a List of Persons for the given Users.
        Parameters:
        users -
        Returns:
      • getAllSakaiPersonIds

        List<String> getAllSakaiPersonIds()
        Get a list of all SakaiPerson's userIds (ie list of all people with profile records)
        Returns:
        List of Sakai userId's
      • getAllSakaiPersonIdsCount

        int getAllSakaiPersonIdsCount()
        Get a count of all users with SakaiPerson records
        Returns:
        count
      • getUserNamePronunciationResourceId

        String getUserNamePronunciationResourceId​(String uuid)
        Get the user pronunciation audio resource id
        Parameters:
        uuid - The user id
        Returns:
        the audio resource id
      • getUserNamePronunciation

        MimeTypeByteArray getUserNamePronunciation​(String uuid)
        Get the bytes of user pronunciation ogg audio
        Parameters:
        uuid - The user id
        Returns:
        MimeTypeByteArray of ogg audio