use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class BwAlarm method getXicalProperties.
/**
* Find x-properties storing the value of the named ical property
*
* @param val - name to match
* @return list of matching properties - never null
* @throws CalFacadeException
*/
@NoProxy
@NoDump
public List<BwXproperty> getXicalProperties(final String val) throws CalFacadeException {
List<BwXproperty> res = new ArrayList<>();
List<BwXproperty> xs = getXproperties();
if (xs == null) {
return res;
}
for (BwXproperty x : xs) {
if (x.getName().equals(BwXproperty.bedeworkIcalProp)) {
List<Xpar> xpars = x.getParameters();
Xpar xp = xpars.get(0);
if (xp.getName().equals(val)) {
res.add(x);
}
}
}
return res;
}
use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class BwAlarm method getNextTriggerDate.
/* ====================================================================
* Convenience methods
* ==================================================================== */
/**
* Get the next trigger Date value. This is the next time for the
* alarm.
*
* <p>This is based on the previous time which will have been set when the
* alarm was last triggered.
*
* <p>Returns null for no more triggers.
*
* <p>Can be called repeatedly for the same result. To move to the next
* trigger time, update repeatCount.
*
* @param start for instance to base this on
* @param previousTrigger null for first
* @return Date next trigger time as a date object
* @throws CalFacadeException on error
*/
@NoDump
public Date getNextTriggerDate(final BwDateTime start, final Date previousTrigger) throws CalFacadeException {
if (previousTrigger == null) {
// First time
triggerDate = null;
return getTriggerDate(start);
}
if (repeat == 0) {
// No next trigger
return null;
}
if (repeatCount == repeat) {
// No next trigger
return null;
}
repeatCount++;
final Dur dur = new Duration(null, duration).getDuration();
triggerDate = dur.getTime(previousTrigger);
return triggerDate;
}
use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class BwAlarm method getTriggerDate.
/**
* Get the trigger Date value. This is the earliest time for the
* alarm.
*
* @return Date trigger time as a date object
* @throws CalFacadeException on error
*/
@NoDump
public Date getTriggerDate(final BwDateTime start) throws CalFacadeException {
try {
if (triggerDate != null) {
return triggerDate;
}
final Trigger tr = new Trigger();
tr.setValue(getTrigger());
/* if dt is null then it's a duration????
*/
Date dt = tr.getDateTime();
if (dt == null) {
final Dur dur = tr.getDuration();
if (start == null) {
throw new CalFacadeException("No start date for alarm " + this);
}
dt = dur.getTime(BwDateTimeUtil.getDate(start));
}
triggerDate = dt;
return dt;
} catch (final CalFacadeException cfe) {
throw cfe;
} catch (final Throwable t) {
throw new CalFacadeException(t);
}
}
use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class BwCalendar method getRestoreCallback.
@NoDump
public static FromXmlCallback getRestoreCallback() {
if (fromXmlCb == null) {
fromXmlCb = new FromXmlCallback() {
@Override
public boolean save(final Element el, final Object theObject, final Object theValue) throws Throwable {
if ("col-lastmod".equals(el.getTagName())) {
((BwCalendar) theObject).setLastmod((BwCollectionLastmod) theValue);
return true;
}
return false;
}
};
fromXmlCb.addClassForName("col-lastmod", BwCollectionLastmod.class);
fromXmlCb.addClassForName("property", BwProperty.class);
fromXmlCb.addSkips("byteSize", "id", "seq");
fromXmlCb.addMapField("col-lastmod", "lastmod");
fromXmlCb.addMapField("public", "publick");
}
return fromXmlCb;
}
use of org.bedework.calfacade.annotations.NoDump in project bw-calendar-engine by Bedework.
the class BwCalendar method getEventList.
/**
* Get the event list
*
* @return event list - never null
*/
@NoDump
public SortedSet<EventListEntry> getEventList() {
final Set<BwProperty> props = getProperties(eventListProperty);
final SortedSet<EventListEntry> res = new TreeSet<>();
if (props == null) {
return res;
}
for (final BwProperty prop : props) {
final String[] vals = prop.getValue().split("\t");
String curPath = null;
for (final String s : vals) {
if (s.startsWith("/")) {
final EventListEntry ele = new EventListEntry(s);
curPath = ele.getPath();
res.add(ele);
} else {
res.add(new EventListEntry(curPath + s));
}
}
}
return res;
}
Aggregations