Blue Mind
Release 1.0

net.bluemind.core.hooks
Interface ICalendarHook

All Known Implementing Classes:
AbstractCalendarHook

public interface ICalendarHook

A ICalendarHook hooks into CalendarInfo, Event and Attendee.

See Also:
HookRegistry.getCalendarHooks()

Method Summary
 void onAttendeeStateUpdated(AccessToken token, Event e, String entity, int entityId, String note)
          Get called after an Attendee as his ParticipationState updated.
 void onCalendarShare(AccessToken at, String token, String email)
          Get called after a Calendar is shared with an external user.
 void onCalendarUnShare(AccessToken at, String token)
          Get called after a token generated for an external user is invalidated.
 void onEventCreated(AccessToken at, Event e)
          Get called after an Event is created in persistent storage.
 void onEventDeleted(AccessToken at, Event e)
          Get called after an Event is deleted from the persistent storage.
 void onEventUpdated(AccessToken at, Event old, Event updated, Map<String,EventPartNotification> notifications)
          Get called after an Event is updated in persistent storage.
 

Method Detail

onCalendarShare

void onCalendarShare(AccessToken at,
                     String token,
                     String email)
                     throws ServerFault,
                            AuthFault
Get called after a Calendar is shared with an external user. The method calling this hook will generate an AccessToken for the external user, and pass the result of AccessToken.getSessionId() to this hook.

The token can be used to login in BlueMind by using this string as a password or by forging an URL with a BMHPS parameter containing this value.

Event though the share method aim was to share the calendar, the AccessToken.setAllowedRpc(java.util.HashSet) is fill with at full rpc list. Which mean that the AccessToken generated for the external have the same rights than the sharing user.

If a Exception is thrown by a hook, the external token validity and all other hook action should be rolled-back.

Parameters:
at - User whose Calendar will be shared.
token - Session id generated for the external user to be able to login in BlueMind and consult the shared Calendar.
email - Email of the external user with which the calendar will be shared.
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.
See Also:
ICalendar#share(AccessToken, String)

onCalendarUnShare

void onCalendarUnShare(AccessToken at,
                       String token)
                       throws ServerFault,
                              AuthFault
Get called after a token generated for an external user is invalidated. The token can't be used anymore for login in BlueMind.

If a Exception is thrown by a hook, the update and all other hook action should be rolled-back.

Parameters:
at - User who will be charged for the external token removal.
token - Session id generated for the external user to be able to login in BlueMind and consult the shared Calendar.
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.
See Also:
ICalendar.unshare(AccessToken, String), onCalendarShare(AccessToken, String, String)

onEventCreated

void onEventCreated(AccessToken at,
                    Event e)
                    throws ServerFault,
                           AuthFault
Get called after an Event is created in persistent storage.

Parameters:
at - User who is charged for the event create.
e - The newly created Event. This event is filled with it's IEntity.getId(), and the IEntity.getTimeCreate()
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.
See Also:
ICalendar.create(AccessToken, Event)

onEventUpdated

void onEventUpdated(AccessToken at,
                    Event old,
                    Event updated,
                    Map<String,EventPartNotification> notifications)
                    throws ServerFault,
                           AuthFault
Get called after an Event is updated in persistent storage.

This is also called when a Attendee update his ParticipationState.

If this update change an Attendee participation and if this Attendee have leaved a explanatory note with this change, a parameter containing the notes is added.

Parameters:
at - User who is charged for the event update.
old - This is a snapshot of the updated Event before the update.
updated - This Event holds the updated properties, with a new IEntity.getTimeUpdate() and IEntity.getUserUpdateId().
notifications - Map whose key is the concatenation of Event.getExtId() and Entity.getId(), separated by "-". The CalendarInfo object can be get by using Attendee.getCalendarInfo().
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.
See Also:
ICalendar.update(AccessToken, Event, boolean)

onEventDeleted

void onEventDeleted(AccessToken at,
                    Event e)
                    throws ServerFault,
                           AuthFault
Get called after an Event is deleted from the persistent storage.

e is a snapshot of the Event before removal.

Parameters:
at - User who is charged for the event removal.
e - This is a snapshot of the updated Event before removal.
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.
See Also:
ICalendar.delete(AccessToken, int)

onAttendeeStateUpdated

void onAttendeeStateUpdated(AccessToken token,
                            Event e,
                            String entity,
                            int entityId,
                            String note)
                            throws ServerFault,
                                   AuthFault
Get called after an Attendee as his ParticipationState updated.

Unfortunately this hook alone is not enough to catch all Attendee state updates. You must also add an hook on onEventUpdated(AccessToken, Event, Event, Map).

An Attendee is described by an id as described in IEntity.getId() and an entity description. The entity description is the textual representation of the entity kind, it can be for example :

Parameters:
token - User who is charged for the event update.
e - Event on which the Attendee have updated his participation.
entity - Textual description of the Attendee kind.
entityId - Attendee unique id. Uniqueness only among this entity kind and in this entity BlueMind instance.
note - Optional explanatory note to justify the Attendee decision.
Throws:
ServerFault - If any things go wrongs, this is the default Exception to throw.
AuthFault - If the at don't have permission to execute the action contained in the hook.

Blue Mind
Release 1.0