Interface SakaiFacade


  • public interface SakaiFacade

    This is an interface to provides all necessary methods, which are depend on the Sakai Services. This will allow the separation of Signup Tool and the Sakai Tools

    • Method Detail

      • isUserAdmin

        boolean isUserAdmin​(String userId)
        check to see if the user is Admin
        Parameters:
        userId - userId the internal user id (not username)
        Returns:
        true if the user is Admin role
      • getCurrentUserId

        String getCurrentUserId()
        get current userId
        Returns:
        the current sakai user id (not username)
      • getUserDisplayLastFirstName

        String getUserDisplayLastFirstName​(String userId)
        Get the display name for a user by their unique id
        Parameters:
        userId - the current sakai user id (not username)
        Returns:
        display name (probably firstname lastname) or "----------" (10 hyphens) if none found
      • getUserDisplayName

        String getUserDisplayName​(String userId)
        Get the display name for a user by their unique id
        Parameters:
        userId - the current sakai user id (not username)
        Returns:
        display name (probably lastname,firstname) or "----------" (10 hyphens) if none found
      • getCurrentLocationId

        String getCurrentLocationId()
        get current site Id
        Returns:
        the current location id of the current user
      • getLocationTitle

        String getLocationTitle​(String locationId)
        get current site title
        Parameters:
        locationId - a unique id which represents the current location of the user (entity reference)
        Returns:
        the title for the context or "--------" (8 hyphens) if none found
      • isAllowedSite

        boolean isAllowedSite​(String userId,
                              String permission,
                              String siteId)
        Check if this user has access to the site
        Parameters:
        userId - the internal user id (not username)
        permission - function like signup.view
        siteId - site context id
        Returns:
        true if the user has access, false otherwise
      • isAllowedGroup

        boolean isAllowedGroup​(String userId,
                               String permission,
                               String siteId,
                               String groupId)
        Check if this user has access to the group in the site
        Parameters:
        userId - the internal user id (not username)
        permission - function like signup.create.group
        siteId - site context id
        groupId - group context id
        Returns:
        true if the user has access, false otherwise
      • getToolManager

        ToolManager getToolManager()
        get the ToolManager object.
        Returns:
        a ToolManager object.
      • getUserPublishedSiteIds

        List<String> getUserPublishedSiteIds​(String userId)
        get all the published sites, which user joins in
        Parameters:
        userId - userId the internal user id (not username)
        Returns:
        a list of SignupSite objects
      • getUserSites

        List<SignupSite> getUserSites​(String userId)
        get all the sites, which user joins in
        Parameters:
        userId - userId the internal user id (not username)
        Returns:
        a list of SignupSite objects
      • getUser

        User getUser​(String userId)
        get the User object
        Parameters:
        userId - a sakai internal user Id
        Returns:
        an User object
      • getUserQuietly

        User getUserQuietly​(String userId)
        get the User object but do not log any messages.
        Parameters:
        userId - a sakai internal user Id
        Returns:
        an User object
      • checkForUser

        boolean checkForUser​(String userId)
        Does this user exist in the system? This only logs at debug level if they don't exist.
        Parameters:
        userId -
        Returns:
        true if exists, false if not
      • getAllPossibleCoordinators

        List<SignupUser> getAllPossibleCoordinators​(SignupMeeting meeting)
        get all coordinators, who have create meeting permission in the event/meeting
        Parameters:
        meeting - a SignupMeeting object
        Returns:
        a list of SignupMeeting objects
      • getAllPossbileCoordinatorsOnFastTrack

        List<SignupUser> getAllPossbileCoordinatorsOnFastTrack​(SignupMeeting meeting)
        get all coordinators, who have create meeting permission in the event/meeting This method is much efficient and fast. It may have extra people, who don't have view permission, which we have not checked. The chances are very small since they are the site instructor/tf
        Parameters:
        meeting - a SignupMeeting object
        Returns:
        a list of SignupMeeting objects
      • hasPermissionToCreate

        boolean hasPermissionToCreate​(SignupMeeting meeting,
                                      String userId)
        test whether a user has permission to create a meeting in a meeting
        Parameters:
        meeting -
        userId -
        Returns:
      • getAllUsers

        List<SignupUser> getAllUsers​(SignupMeeting meeting)
        get all users, who have joined in the event/meeting
        Parameters:
        meeting - a SignupMeeting object
        Returns:
        a list of SignupMeeting objects
      • getAllPossibleAttendees

        List<SignupUser> getAllPossibleAttendees​(SignupMeeting meeting)
        get all users, who have permission to attend the meeting
        Parameters:
        meeting - a SignupMeeting object
        Returns:
        a list of SignupMeeting objects
      • getCalendar

        Calendar getCalendar​(String siteId)
                      throws PermissionException
        get Calendar for this specific siteId
        Parameters:
        siteId - a unique id which represents the current site
        Returns:
        a Calendar object, will return null if something went very wrong
        Throws:
        PermissionException - throw if user has no permission
      • getCalendarById

        Calendar getCalendarById​(String calendarId)
                          throws PermissionException
        get Calendar object by calendar unique Id
        Parameters:
        calendarId - a unique Calendar Id
        Returns:
        a Calendar object, will return null if something went very wrong
        Throws:
        PermissionException - throw if user has no permission
      • getGroup

        Group getGroup​(String siteId,
                       String groupId)
                throws IdUnusedException
        get group object accourding to the siteId and groupId
        Parameters:
        siteId - a unique id which represents the current site
        groupId - a unique id which represents the current group
        Returns:
        a Group object
        Throws:
        IdUnusedException - throw if siteId or groupId is not found
      • getServerConfigurationService

        ServerConfigurationService getServerConfigurationService()
        get ServerConfigurationService object
        Returns:
        a ServerConfigurationService
      • getSiteService

        SiteService getSiteService()
        set a Sakai SiteService
        Returns:
        a SiteService
      • getCurrentPageId

        String getCurrentPageId()
        get current pageId,which is an unique id
        Returns:
        an unique page Id
      • getSiteSignupPageId

        String getSiteSignupPageId​(String siteId)
        get site-signup pageId,which is an unique id *
        Parameters:
        siteId - a unique site Id
        Returns:
        an unique page Id
      • getTimeService

        TimeService getTimeService()
        get a TimeService object from one of the Sakai services
        Returns:
        a TimeService object.
      • getContentHostingService

        ContentHostingService getContentHostingService()
        get a ContentHostingService from one of the Sakai services
        Returns:
        a ContentHostingService object.
      • getSignupUser

        SignupUser getSignupUser​(SignupMeeting meeting,
                                 String userId)
        get the user, who has permission to attend the meeting
        Parameters:
        meeting - a SignupMeeting object
        userId - userId the internal user id (not username)
        Returns:
        a SignupUser object
      • getUsersWithPermission

        List<User> getUsersWithPermission​(String permission)
        Get a list of users in the current site that have the given permission
        Parameters:
        permission - the permission to check
        Returns:
        a List of Users that match the criteria
      • getUsersByEmail

        Collection<User> getUsersByEmail​(String email)
        Find users by an email address. This may return multiples so logic is needed to deal with that.
        Parameters:
        email -
        Returns:
        a list of user objects or an empty list if none.
      • getUserByEmail

        User getUserByEmail​(String email)
        Get a user by email address. Only use this if you are certain that there is only one user that matches, as it will only return the first user if there are multiples.
        Parameters:
        email -
        Returns:
        a User or null if no match
      • getUserByEid

        User getUserByEid​(String eid)
        Find a user by their eid.
        Parameters:
        eid -
        Returns:
        a user object or null if not found
      • isCsvExportEnabled

        boolean isCsvExportEnabled()
        Is csv export enabled? signup.csv.export.enabled=true/false
        Returns:
      • pushAllowCalendarEdit

        SecurityAdvisor pushAllowCalendarEdit​(Calendar calendar)
        Allow calendar.revise.any for the current user
      • pushSecurityAdvisor

        SecurityAdvisor pushSecurityAdvisor()
        Standard privileged push for the current user
      • popSecurityAdvisor

        void popSecurityAdvisor​(SecurityAdvisor advisor)
        Pop the specified security advisor
      • createGroup

        String createGroup​(String siteId,
                           String title,
                           String description,
                           List<String> userUuids)
        Create a group in the specified site with the given title and description and optionally, a list of user uuids to populate it. The title will be prefixed with the constant GROUP_PREFIX
        Parameters:
        siteId - site to create this group in
        title - group title
        description - group description
        userIds - list of users to populate the group with, optional.
        Returns:
        The groupId
      • addUsersToGroup

        boolean addUsersToGroup​(Collection<String> userIds,
                                String siteId,
                                String groupId,
                                String timeslottoGroup)
        Add the users to the given group in the given site
        Parameters:
        userIds - Collection of users, could be a single user
        siteId - id of the site
        groupId - id of the group
        Returns:
        true if users added, false if not
      • removeUserFromGroup

        boolean removeUserFromGroup​(String userId,
                                    String siteId,
                                    String groupId)
        Remove the user from the given group in the given site
        Parameters:
        userId - uuid of the user
        siteId - id of the site
        groupId - id of the group
        Returns:
        true if user removed, false if not
      • getGroupMembers

        List<String> getGroupMembers​(String siteId,
                                     String groupId)
        Get the list of users in a group
        Parameters:
        siteId - id of the site
        groupId - id of the group
        Returns:
        list of uuids for users in the group
      • checkForGroup

        boolean checkForGroup​(String siteId,
                              String groupId)
        Check if a group with the given id exists
        Parameters:
        siteId - id of the site
        groupId - id of the group
        Returns:
        true if group exists, false if not.
      • synchonizeGroupTitle

        boolean synchonizeGroupTitle​(String siteId,
                                     String groupId,
                                     String newTitle)
        Synchronize the group title if group title has not been modified directly via Site-Info tool
        Parameters:
        siteId - id of the site
        groupId - id of the group
        newTitle - new group title
        Returns:
      • getFormattedText

        FormattedText getFormattedText()
        Returns:
        Returns the FormattedText service for use in cleaning up HTML.