Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incoming event interception via EventAddHandler #89

Open
f1-outsourcing opened this issue Oct 31, 2024 · 0 comments
Open

incoming event interception via EventAddHandler #89

f1-outsourcing opened this issue Oct 31, 2024 · 0 comments

Comments

@f1-outsourcing
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant