Skip to content

incoming event interception via EventAddHandler #89

@f1-outsourcing

Description

@f1-outsourcing

Hi @danielgrigore Daniel I am not sure if you read these old posts[1].

We implemented incoming event interception via EventAddHandler. We intercept it in beforeAdd. The wveint is successfully intercepted - we can see it in log. But when we try to update the description of event - it does not change. Why? Or is this successfully changed in the server, but just not synced to the client?

public boolean handleCalendarEvent(CollectionItem collection, ContentItem item) {
    // Get event
    EventStamp eventStamp = StampUtils.getEventStamp(item);
    VEvent masterEvent = eventStamp.getMasterEvent();
    if (isValidManagementEvent(masterEvent)) {
        boolean success = processEvent(masterEvent);
        if (success) {
            // TODO
            item.addStamp(eventStamp);
        }
        return success;
    } else {
        return false;
    }
}

private boolean processEvent(VEvent event) {
    // Based on the event's SUMMARY, process the management command
    String summary = event.getSummary().getValue().trim();
    switch (summary) {
        case COMMAND:
            // Process sharing read permissions
            LOG.info("Processing event");
            java.util.Calendar calendar = java.util.Calendar.getInstance();
            SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            try {
                event.getProperty(Property.DESCRIPTION).setValue("======= update (" + format.format(calendar.getTime()) + ") =======");
            } catch (Exception e) {
                LOG.error(e.toString());
                return false;
            }
            break;

[1]
#84

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions