Search in sources :

Example 71 with BwEvent

use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.

the class SchedulingBase method setupReschedule.

/* (non-Javadoc)
   * @see org.bedework.calsvci.SchedulingI#setupReschedule(org.bedework.calfacade.svc.EventInfo)
   */
@Override
public void setupReschedule(final EventInfo ei) throws CalFacadeException {
    BwEvent event = ei.getEvent();
    BwAttendee userAttendee = findUserAttendee(event);
    /* Set the PARTSTAT to needs action for all attendees - except us */
    for (BwAttendee att : event.getAttendees()) {
        if ((userAttendee != null) && att.equals(userAttendee)) {
            continue;
        }
        att.setPartstat(IcalDefs.partstatValNeedsAction);
        att.setRsvp(true);
    }
}
Also used : BwEvent(org.bedework.calfacade.BwEvent) BwAttendee(org.bedework.calfacade.BwAttendee)

Example 72 with BwEvent

use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.

the class SchedulingBase method initScheduleEvent.

protected boolean initScheduleEvent(final EventInfo ei, final boolean response, final boolean iSchedule) throws CalFacadeException {
    BwEvent event = ei.getEvent();
    if (!iSchedule) {
        if (!Util.isEmpty(event.getRecipients())) {
            event.getRecipients().clear();
        }
        if (response) {
            event.addRecipient(event.getOrganizer().getOrganizerUri());
        } else {
            getRecipients(event, event);
            if (ei.getNumOverrides() > 0) {
                for (EventInfo oei : ei.getOverrides()) {
                    getRecipients(event, oei.getEvent());
                }
            }
        }
    }
    setupSharableEntity(event, getPrincipal().getPrincipalRef());
    event.setDtstamps(getCurrentTimestamp());
    // no-op if already set
    assignGuid(event);
    /* Ensure attendees have sequence and dtstamp of event */
    if (event.getNumAttendees() > 0) {
        for (BwAttendee att : event.getAttendees()) {
            if (att.getScheduleAgent() != IcalDefs.scheduleAgentServer) {
                continue;
            }
            att.setSequence(event.getSequence());
            att.setDtstamp(event.getDtstamp());
            if (response) {
                att.setScheduleStatus(IcalDefs.deliveryStatusSuccess);
            }
        }
    }
    return true;
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwEvent(org.bedework.calfacade.BwEvent) BwAttendee(org.bedework.calfacade.BwAttendee)

Example 73 with BwEvent

use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.

the class AttendeeSchedulingHandler method makeReplyEvent.

protected BwEvent makeReplyEvent(final BwEvent origEv, final String ownerHref) throws CalFacadeException {
    BwEvent newEv = new BwEventObj();
    if (origEv instanceof BwEventProxy) {
        getSvc().reAttach(((BwEventProxy) origEv).getRef());
    /* we are being asked to copy an instance of a recurring event - rather than
       * a complete recurring event + all overrides - clone the master
       */
    } else {
        getSvc().reAttach(origEv);
    }
    newEv.setUid(origEv.getUid());
    newEv.setOrganizer(origEv.getOrganizer());
    newEv.setRecurrenceId(origEv.getRecurrenceId());
    newEv.setSequence(origEv.getSequence());
    // Attendee and DTSTAMP set by caller?
    newEv.setOwnerHref(ownerHref);
    newEv.setCreatorHref(ownerHref);
    newEv.setDtstamps(getCurrentTimestamp());
    // These to get past validation
    newEv.setDtstart(origEv.getDtstart());
    newEv.setDtend(origEv.getDtend());
    newEv.setEndType(origEv.getEndType());
    newEv.setDuration(origEv.getDuration());
    newEv.setNoStart(origEv.getNoStart());
    newEv.setRecurring(false);
    // XXX Temp set summary so we have something to display - this may not be
    // the case for incoming events from outside
    newEv.setSummary(origEv.getSummary());
    return newEv;
}
Also used : BwEvent(org.bedework.calfacade.BwEvent) BwEventProxy(org.bedework.calfacade.BwEventProxy) BwEventObj(org.bedework.calfacade.BwEventObj)

Example 74 with BwEvent

use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.

the class AttendeeSchedulingHandler method setPollResponse.

/**
 * Set the poll response for the given voter in the output event
 * from the voting state in the incoming event. The output event
 * should only have one VVOTER sub-component for this voter with
 * its state set by the current voters state.
 *
 * @param outEi - destined for somebodies inbox
 * @param ei - the voters copy
 * @param attUri - uri of the voter
 * @throws CalFacadeException on error
 */
private void setPollResponse(final EventInfo outEi, final EventInfo ei, final String attUri) throws CalFacadeException {
    /* This requires us to parse out the VVOTER components - find our voter
       and add a poll item id property in the output.

       Note that this is implementing poll mode basic.
     */
    final BwEvent ev = ei.getEvent();
    final BwEvent outEv = outEi.getEvent();
    try {
        final Map<String, VVoter> voters = IcalUtil.parseVpollVvoters(ev);
        outEv.clearVvoters();
        final VVoter vv = voters.get(attUri);
        if (vv == null) {
            warn("No Vvoter element for " + attUri);
            return;
        }
        outEv.addVvoter(vv.toString());
    } catch (final Throwable t) {
        throw new CalFacadeException(t);
    }
}
Also used : VVoter(net.fortuna.ical4j.model.component.VVoter) BwEvent(org.bedework.calfacade.BwEvent) BwString(org.bedework.calfacade.BwString) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 75 with BwEvent

use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.

the class AttendeeSchedulingHandler method makeReplyEventInfo.

protected EventInfo makeReplyEventInfo(final EventInfo ei, final String owner) throws CalFacadeException {
    BwEvent newEv = makeReplyEvent(ei.getEvent(), owner);
    EventInfo newEi = new EventInfo(newEv);
    return newEi;
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwEvent(org.bedework.calfacade.BwEvent)

Aggregations

BwEvent (org.bedework.calfacade.BwEvent)160 EventInfo (org.bedework.calfacade.svc.EventInfo)80 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)55 BwEventProxy (org.bedework.calfacade.BwEventProxy)33 ChangeTableEntry (org.bedework.calfacade.util.ChangeTableEntry)26 BwAttendee (org.bedework.calfacade.BwAttendee)25 BwDateTime (org.bedework.calfacade.BwDateTime)25 BwString (org.bedework.calfacade.BwString)24 UpdateResult (org.bedework.caldav.server.sysinterface.SysIntf.UpdateResult)23 BwEventAnnotation (org.bedework.calfacade.BwEventAnnotation)23 CoreEventInfo (org.bedework.calcorei.CoreEventInfo)21 BwCalendar (org.bedework.calfacade.BwCalendar)21 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)20 BwXproperty (org.bedework.calfacade.BwXproperty)16 TreeSet (java.util.TreeSet)15 BwEventObj (org.bedework.calfacade.BwEventObj)13 ArrayList (java.util.ArrayList)12 Period (net.fortuna.ical4j.model.Period)12 BwCategory (org.bedework.calfacade.BwCategory)10 BwContact (org.bedework.calfacade.BwContact)10