Package org.exoplatform.agenda.util
Class Utils
- java.lang.Object
-
- org.exoplatform.agenda.util.Utils
-
public class Utils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringPOST_CREATE_AGENDA_EVENT_EVENTstatic StringPOST_CREATE_AGENDA_EVENT_POLLstatic StringPOST_DELETE_AGENDA_EVENT_EVENTstatic StringPOST_DISMISS_AGENDA_EVENT_POLLstatic StringPOST_EVENT_RESPONSE_SAVEDstatic StringPOST_EVENT_RESPONSE_SENTstatic StringPOST_UPDATE_AGENDA_EVENT_EVENTstatic StringPOST_VOTE_AGENDA_EVENT_POLLstatic StringPOST_VOTES_AGENDA_EVENT_POLL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddUserSpacesIdentities(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.social.core.manager.IdentityManager identityManager, String username, List<Long> identityIds)static voidbroadcastEvent(org.exoplatform.services.listener.ListenerService listenerService, String eventName, Object source, Object data)static booleancanAccessCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long ownerId, long userIdentityId)static booleancanCreateEvent(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long ownerId, long userIdentityId)static booleancanEditCalendar(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long ownerId, long userIdentityId)static booleancanInviteeEdit(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long ownerId)static booleancheckAclByCalendarOwner(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long ownerId, String username, boolean readonly)static voiddetectEventModifiedFields(org.exoplatform.agenda.model.Event newEvent, org.exoplatform.agenda.model.Event oldEvent, org.exoplatform.agenda.model.AgendaEventModification eventModification)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)static net.fortuna.ical4j.model.RecurgetICalendarRecur(org.exoplatform.agenda.model.EventRecurrence recurrence, ZoneId zoneId)static net.fortuna.ical4j.model.TimeZonegetICalTimeZone(ZoneId zoneId)static org.exoplatform.social.core.identity.model.IdentitygetIdentityById(org.exoplatform.social.core.manager.IdentityManager identityManager, long identityId)static org.exoplatform.social.core.identity.model.IdentitygetIdentityById(org.exoplatform.social.core.manager.IdentityManager identityManager, String identityId)static longgetIdentityIdByUsername(org.exoplatform.social.core.manager.IdentityManager identityManager, String username)static ZonedDateTimegetOccurrenceId(boolean allDay, ZonedDateTime eventStartDate, ZoneId eventStartDateTimeZone)static ZonedDateTimegetOccurrenceId(boolean allDay, net.fortuna.ical4j.model.DateTime eventStartDate, ZoneId eventStartDateTimeZone)static List<org.exoplatform.agenda.model.Event>getOccurrences(org.exoplatform.agenda.model.Event event, LocalDate from, LocalDate to, int limit)static StringgetResourceBundleLabel(Locale locale, String label)static List<String>getSpaceMembersBySpaceName(String spaceName, org.exoplatform.social.core.space.spi.SpaceService spaceService)static StringgetUserLanguage(String userId)Gets platform language of user.static booleanisEventAttendee(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long identityId, List<org.exoplatform.agenda.model.EventAttendee> eventAttendees)static booleanisEventAttendee(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, long identityId, org.exoplatform.agenda.model.EventAttendeeList eventAttendeeList)static booleanisExternal(String userId)static ZonedDateTimetoDateTime(String dateTimeString, ZoneId userTimeZone)
-
-
-
Field Detail
-
POST_CREATE_AGENDA_EVENT_EVENT
public static final String POST_CREATE_AGENDA_EVENT_EVENT
- See Also:
- Constant Field Values
-
POST_UPDATE_AGENDA_EVENT_EVENT
public static final String POST_UPDATE_AGENDA_EVENT_EVENT
- See Also:
- Constant Field Values
-
POST_DELETE_AGENDA_EVENT_EVENT
public static final String POST_DELETE_AGENDA_EVENT_EVENT
- See Also:
- Constant Field Values
-
POST_EVENT_RESPONSE_SENT
public static final String POST_EVENT_RESPONSE_SENT
- See Also:
- Constant Field Values
-
POST_EVENT_RESPONSE_SAVED
public static final String POST_EVENT_RESPONSE_SAVED
- See Also:
- Constant Field Values
-
POST_CREATE_AGENDA_EVENT_POLL
public static final String POST_CREATE_AGENDA_EVENT_POLL
- See Also:
- Constant Field Values
-
POST_VOTES_AGENDA_EVENT_POLL
public static final String POST_VOTES_AGENDA_EVENT_POLL
- See Also:
- Constant Field Values
-
POST_VOTE_AGENDA_EVENT_POLL
public static final String POST_VOTE_AGENDA_EVENT_POLL
- See Also:
- Constant Field Values
-
POST_DISMISS_AGENDA_EVENT_POLL
public static final String POST_DISMISS_AGENDA_EVENT_POLL
- See Also:
- Constant Field Values
-
-
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)
-
getOccurrenceId
public static ZonedDateTime getOccurrenceId(boolean allDay, ZonedDateTime 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-IdentityManagerservice instancespaceService-SpaceServiceservice instanceownerId- calendar ownerIdentitytechnical identifierusername- name of user accessing calendar datareadonly- 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-IdentityManagerservice instancespaceService-SpaceServiceservice instanceownerId- calendar ownerIdentitytechnical identifieruserIdentityId-Identityidentifier 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-IdentityManagerservice instancespaceService-SpaceServiceservice instanceownerId- calendar ownerIdentitytechnical 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-IdentityManagerservice instancespaceService-SpaceServiceservice instanceownerId- calendar ownerIdentitytechnical identifieruserIdentityId-Identityidentifier 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-IdentityManagerservice instancespaceService-SpaceServiceservice instanceownerId- calendar ownerIdentitytechnical identifieruserIdentityId-Identityidentifier 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)
-
toDateTime
public static ZonedDateTime toDateTime(String dateTimeString, ZoneId userTimeZone)
-
detectEventModifiedFields
public static void detectEventModifiedFields(org.exoplatform.agenda.model.Event newEvent, org.exoplatform.agenda.model.Event oldEvent, org.exoplatform.agenda.model.AgendaEventModification eventModification)
-
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)
-
-