use of org.bedework.calfacade.annotations.ical.NoProxy in project bw-calendar-engine by Bedework.
the class BwEvent method setDtstamps.
/**
* Set the dtstamp, lastmod and created if created is not set already.
* @param val
*/
@NoProxy
public void setDtstamps(final Timestamp val) {
DateTime dt = new DateTime(val);
setDtstamp(new DtStamp(dt).getValue());
setLastmod(new LastModified(dt).getValue());
setCtoken(getLastmod() + "-" + hex4FromNanos(val.getNanos()));
if (getCreated() == null) {
setCreated(new Created(dt).getValue());
}
}
use of org.bedework.calfacade.annotations.ical.NoProxy in project bw-calendar-engine by Bedework.
the class BwEvent method findAttendee.
/**
* Find an attendee entry for the given uri (calendar address).
*
* @param uri
* @return BwAttendee or null if none exists
* @throws CalFacadeException
*/
@NoProxy
public BwAttendee findAttendee(final String uri) throws CalFacadeException {
if (getNumAttendees() == 0) {
return null;
}
int uriLen = uri.length();
boolean hasMailTo = false;
int uriStart = 0;
if (uri.toLowerCase().startsWith(mailTo)) {
hasMailTo = true;
uriStart = 7;
}
while (uri.charAt(uriLen - 1) == '/') {
uriLen--;
if (uriLen <= uriStart) {
return null;
}
}
String uriSeg = uri.substring(uriStart, uriLen);
for (BwAttendee att : getAttendees()) {
String auri = att.getAttendeeUri();
int auriLen = auri.length();
int auriStart = 0;
if (hasMailTo) {
if (!auri.toLowerCase().startsWith(mailTo)) {
return null;
}
auriStart = uriStart;
}
while (auri.charAt(auriLen - 1) == '/') {
auriLen--;
if (auriLen <= auriStart) {
return null;
}
}
if ((auriLen == uriLen) && (uriSeg.regionMatches(0, auri, auriStart, uriLen - auriStart))) {
return att;
}
}
return null;
}
use of org.bedework.calfacade.annotations.ical.NoProxy in project bw-calendar-engine by Bedework.
the class BwEvent method hex4FromNanos.
/**
* @param val - nanoseconds
* @return a 4 digit hex value
*/
@NoProxy
public static String hex4FromNanos(final int val) {
final String formatted = Integer.toHexString(val / 100000);
final StringBuilder buf = new StringBuilder("0000");
buf.replace(4 - formatted.length(), 4, formatted);
return buf.toString();
}
use of org.bedework.calfacade.annotations.ical.NoProxy in project bw-calendar-engine by Bedework.
the class BwEvent method getTimeZoneIds.
/**
* Return all timezone ids this event uses. This is used when an event is
* added by another user to ensure that the target user has a copy of user
* specific timezones.
*
* @return Set of timezone ids.
* @throws CalFacadeException
*/
@NoProxy
@NoDump
public Set<String> getTimeZoneIds() throws CalFacadeException {
Set<String> ids = new TreeSet<String>();
BwDateTime dt = getDtstart();
if ((dt != null) && (dt.getTzid() != null)) {
ids.add(dt.getTzid());
}
dt = getDtend();
if ((dt != null) && (dt.getTzid() != null)) {
ids.add(dt.getTzid());
}
Set<BwDateTime> dts = getRdates();
if (dts != null) {
for (BwDateTime rdt : dts) {
if (rdt.getTzid() != null) {
ids.add(rdt.getTzid());
}
}
}
dts = getExdates();
if (dts != null) {
for (BwDateTime rdt : dts) {
if (rdt.getTzid() != null) {
ids.add(rdt.getTzid());
}
}
}
List<BwFreeBusyComponent> fbcs = getFreeBusyPeriods();
if (fbcs != null) {
for (BwFreeBusyComponent fbc : fbcs) {
for (Period p : fbc.getPeriods()) {
DateTime fdt = p.getStart();
if (fdt.getTimeZone() != null) {
ids.add(fdt.getTimeZone().getID());
}
fdt = p.getEnd();
if (fdt.getTimeZone() != null) {
ids.add(fdt.getTimeZone().getID());
}
}
}
}
return ids;
}
use of org.bedework.calfacade.annotations.ical.NoProxy in project bw-calendar-engine by Bedework.
the class BwEvent method hex4.
/* ====================================================================
* Private methods
* =================================================================== */
/**
* @param val number to convert to hex
* @return a 4 digit hex value
*/
@NoProxy
public static String hex4(final int val) {
final String formatted = Integer.toHexString(val % 32001);
final StringBuilder buf = new StringBuilder("0000");
buf.replace(4 - formatted.length(), 4, formatted);
return buf.toString();
}
Aggregations