Class Utils


  • public class Utils
    extends Object
    • Method Detail

      • getCalendarOwnersOfUser

        public static List<Long> getCalendarOwnersOfUser​(org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                                         org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                         org.exoplatform.social.core.identity.model.Identity userIdentity)
      • addUserSpacesIdentities

        public static void addUserSpacesIdentities​(org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                                   org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                   String username,
                                                   List<Long> identityIds)
                                            throws Exception
        Throws:
        Exception
      • getOccurrences

        public static List<org.exoplatform.agenda.model.Event> getOccurrences​(org.exoplatform.agenda.model.Event event,
                                                                              LocalDate from,
                                                                              LocalDate to,
                                                                              int limit)
      • getOccurrenceId

        public static ZonedDateTime getOccurrenceId​(boolean allDay,
                                                    net.fortuna.ical4j.model.DateTime eventStartDate,
                                                    ZoneId eventStartDateTimeZone)
      • getICalendarRecur

        public static net.fortuna.ical4j.model.Recur getICalendarRecur​(org.exoplatform.agenda.model.EventRecurrence recurrence,
                                                                       ZoneId zoneId)
      • checkAclByCalendarOwner

        public static boolean checkAclByCalendarOwner​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                      org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                                      long ownerId,
                                                      String username,
                                                      boolean readonly)
                                               throws IllegalAccessException
        Parameters:
        identityManager - IdentityManager service instance
        spaceService - SpaceService service instance
        ownerId - calendar owner Identity technical identifier
        username - name of user accessing calendar data
        readonly - whether the access is to read or to write
        Returns:
        true if user can modify calendar, else return false
        Throws:
        IllegalAccessException - when the user ACL fails
      • canCreateEvent

        public static boolean canCreateEvent​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                             org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                             long ownerId,
                                             long userIdentityId)
        Parameters:
        identityManager - IdentityManager service instance
        spaceService - SpaceService service instance
        ownerId - calendar owner Identity technical identifier
        userIdentityId - Identity identifier of user accessing calendar data
        Returns:
        true if user can create event in a calendar, else return false
      • canInviteeEdit

        public static boolean canInviteeEdit​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                             org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                             long ownerId)
        Parameters:
        identityManager - IdentityManager service instance
        spaceService - SpaceService service instance
        ownerId - calendar owner Identity technical identifier
        Returns:
        true if owner is a space and has at least one redactor, else return false
      • canEditCalendar

        public static boolean canEditCalendar​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                              org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                              long ownerId,
                                              long userIdentityId)
        Parameters:
        identityManager - IdentityManager service instance
        spaceService - SpaceService service instance
        ownerId - calendar owner Identity technical identifier
        userIdentityId - Identity identifier of user accessing calendar data
        Returns:
        true if user can modify calendar or its events, else return false
      • canAccessCalendar

        public static boolean canAccessCalendar​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                                long ownerId,
                                                long userIdentityId)
        Parameters:
        identityManager - IdentityManager service instance
        spaceService - SpaceService service instance
        ownerId - calendar owner Identity technical identifier
        userIdentityId - Identity identifier of user accessing calendar data
        Returns:
        true if user can access calendar or its events, else return false
      • broadcastEvent

        public static void broadcastEvent​(org.exoplatform.services.listener.ListenerService listenerService,
                                          String eventName,
                                          Object source,
                                          Object data)
      • getIdentityById

        public static org.exoplatform.social.core.identity.model.Identity getIdentityById​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                                                          long identityId)
      • getIdentityById

        public static org.exoplatform.social.core.identity.model.Identity getIdentityById​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                                                          String identityId)
      • getIdentityIdByUsername

        public static long getIdentityIdByUsername​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                                   String username)
      • getSpaceMembersBySpaceName

        public static List<String> getSpaceMembersBySpaceName​(String spaceName,
                                                              org.exoplatform.social.core.space.spi.SpaceService spaceService)
      • isEventAttendee

        public static boolean isEventAttendee​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                              org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                              long identityId,
                                              org.exoplatform.agenda.model.EventAttendeeList eventAttendeeList)
      • isEventAttendee

        public static boolean isEventAttendee​(org.exoplatform.social.core.manager.IdentityManager identityManager,
                                              org.exoplatform.social.core.space.spi.SpaceService spaceService,
                                              long identityId,
                                              List<org.exoplatform.agenda.model.EventAttendee> eventAttendees)
      • getICalTimeZone

        public static net.fortuna.ical4j.model.TimeZone getICalTimeZone​(ZoneId zoneId)
      • detectEventModifiedFields

        public static void detectEventModifiedFields​(org.exoplatform.agenda.model.Event newEvent,
                                                     org.exoplatform.agenda.model.Event oldEvent,
                                                     org.exoplatform.agenda.model.AgendaEventModification eventModification)
      • getResourceBundleLabel

        public static String getResourceBundleLabel​(Locale locale,
                                                    String label)
      • getUserLanguage

        public static String getUserLanguage​(String userId)
        Gets platform language of user. In case of any errors return null.
        Parameters:
        userId - user Id
        Returns:
        the platform language
      • isExternal

        public static boolean isExternal​(String userId)