use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.
the class DumpPrincipal method dumpCol.
protected void dumpCol(final BwCalendar col, final boolean doChildren) throws CalFacadeException {
final CalendarsI colsI = getSvc().getCalendarsHandler();
try {
incCount(DumpGlobals.collections);
makeDir(col.getName(), false);
col.dump(makeFile(col.getName() + ".xml"));
/* Dump any events in this collection */
final Iterable<EventInfo> eis = getDi().getEventInfos(col.getPath());
eis.forEach(new EventConsumer());
if (!doChildren || !col.getCollectionInfo().childrenAllowed) {
return;
}
final Collection<BwCalendar> cols = colsI.getChildren(col);
if (Util.isEmpty(cols)) {
return;
}
for (final BwCalendar ch : cols) {
dumpCol(ch, true);
}
} finally {
popPath();
}
}
use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.
the class BwStringRule method end.
@Override
public void end(final String ns, final String name) throws Exception {
if (name.equals("bwstring")) {
// 3.5 onwards we wrapped with a tag. Do nothing
return;
}
BwString entity = (BwString) pop();
if (top() instanceof BwRequestStatus) {
BwRequestStatus rs = (BwRequestStatus) top();
rs.setDescription(entity);
return;
}
if (top() instanceof BwCategory) {
BwCategory cat = (BwCategory) top();
if (name.equals("keyword")) {
cat.setWord(entity);
} else if (name.equals("desc")) {
cat.setDescription(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwContact) {
BwContact ent = (BwContact) top();
if (name.equals("value")) {
ent.setCn(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwLocation) {
BwLocation loc = (BwLocation) top();
if (name.equals("addr")) {
loc.setAddress(entity);
} else if (name.equals("subaddr")) {
loc.setSubaddress(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwFilterDef) {
BwFilterDef f = (BwFilterDef) top();
if (name.equals("display-name")) {
f.addDisplayName(entity);
} else if (name.equals("subaddr")) {
f.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwAlarm) {
BwAlarm a = (BwAlarm) top();
if (name.equals("description")) {
a.addDescription(entity);
if (entity.getLang() != null) {
a.addXproperty(new BwXproperty(entity.getLang(), null, entity.getValue()));
} else {
a.addDescription(entity);
}
return;
}
if (name.equals("summary")) {
a.addSummary(entity);
} else {
unknownTag(name);
}
return;
}
EventInfo ei = (EventInfo) top();
BwEvent e = ei.getEvent();
if (e instanceof BwEventProxy) {
e = ((BwEventProxy) e).getRef();
}
if (name.equals("comment")) {
e.addComment(entity);
} else if (name.equals("description")) {
e.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
} else if (name.equals("resource")) {
e.addResource(entity);
} else if (name.equals("summary")) {
e.addSummary(entity);
} else {
unknownTag(name);
}
}
use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.
the class AlarmRule method end.
public void end(String ns, String name) throws Exception {
BwAlarm entity = (BwAlarm) pop();
globals.counts[globals.valarms]++;
if (!(top() instanceof EventInfo)) {
warn("Expected an event info object: found " + top());
return;
}
BwEvent ev = ((EventInfo) top()).getEvent();
if (entity.getOwnerHref() == null) {
entity.setOwnerHref(ev.getOwnerHref());
}
entity.setEvent(ev);
ev.addAlarm(entity);
}
use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.
the class InScheduler method processScheduleUpdateEvent.
private ProcessMessageResult processScheduleUpdateEvent(final ScheduleUpdateEvent msg) {
try (final CalSvcI svci = getSvci(msg.getOwnerHref())) {
if (debug) {
trace("ScheduleUpdateEvent for principal " + msg.getOwnerHref());
}
final EventInfo ei = svci.getEventsHandler().get(getParentPath(msg.getHref()), getName(msg.getHref()));
if (ei == null) {
// Event deleted?.
if (debug) {
trace("InSchedule event deleted?");
}
return ProcessMessageResult.NO_ACTION;
}
final BwEvent ev = ei.getEvent();
SchedProcessor proc = null;
switch(msg.getChange()) {
case attendeeChange:
{
proc = new SchedAttendeeUpdate(svci);
break;
}
default:
warn("InSchedule: unhandled change type for " + ev.getOwnerHref() + " " + msg.getChange());
}
if (proc == null) {
return ProcessMessageResult.PROCESSED;
}
final SchedProcResult pr = proc.process(ei);
if (debug) {
trace("InSchedule " + pr.sr);
}
return ProcessMessageResult.PROCESSED;
} catch (final CalFacadeStaleStateException csse) {
if (debug) {
trace("Stale state exception");
}
rollback(getSvc());
return ProcessMessageResult.STALE_STATE;
} catch (final Throwable t) {
rollback(getSvc());
error(t);
}
return ProcessMessageResult.FAILED;
}
use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.
the class OutScheduler method getOutboxEvents.
private Collection<EventInfo> getOutboxEvents() throws CalFacadeException {
BwCalendar outbox = getSvc().getCalendarsHandler().getSpecial(BwCalendar.calTypeOutbox, false);
if (outbox == null) {
return null;
}
Collection<EventInfo> eis = getSvc().getEventsHandler().getEvents(outbox, null, null, null, // retrieveList
null, BwIndexer.DeletedState.noDeleted, RecurringRetrievalMode.overrides);
if (Util.isEmpty(eis)) {
if (debug) {
trace("autoSchedule: no outbox events for " + getSvc().getPrincipal().getPrincipalRef());
}
return null;
}
return eis;
}
Aggregations