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);
}
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations