use of com.zimbra.common.calendar.ICalTimeZone in project zm-mailbox by Zimbra.
the class Util method newICalTimeZone.
private static ICalTimeZone newICalTimeZone(String tzId, Metadata meta) throws ServiceException {
int standardOffset = (int) meta.getLong(FN_STANDARD_OFFSET, 0);
String dayToStdDtStart = meta.get(FN_DAYTOSTD_DTSTART, null);
String dayToStdRule = meta.get(FN_DAYTOSTD_RULE, null);
String standardTzname = meta.get(FN_STANDARD_TZNAME, null);
int daylightOffset = (int) meta.getLong(FN_DAYLIGHT_OFFSET, 0);
String stdToDayDtStart = meta.get(FN_STDTODAY_DTSTART, ICalTimeZone.DEFAULT_DTSTART);
String stdToDayRule = meta.get(FN_STDTODAY_RULE, null);
String daylightTzname = meta.get(FN_DAYLIGHT_TZNAME, null);
ICalTimeZone tz = new ICalTimeZone(tzId, standardOffset, dayToStdDtStart, dayToStdRule, standardTzname, daylightOffset, stdToDayDtStart, stdToDayRule, daylightTzname);
tz.initFromICalData(true);
return tz;
}
use of com.zimbra.common.calendar.ICalTimeZone in project zm-mailbox by Zimbra.
the class Invite method createFromCalendar.
private static void createFromCalendar(List<Invite> toAdd, Account account, String fragment, ZVCalendar cal, boolean sentByMe, Mailbox mbx, int mailItemId, boolean continueOnError, InviteVisitor visitor) throws ServiceException {
String method = cal.getPropVal(ICalTok.METHOD, ICalTok.PUBLISH.toString());
// process the TIMEZONE's first: everything depends on them being there...
TimeZoneMap tzmap = new TimeZoneMap(Util.getAccountTimeZone(account));
Map<String, String> tzidRenames = Maps.newHashMap();
List<ZComponent> components = Lists.newArrayList(cal.getComponentIterator());
for (ZComponent comp : components) {
if (ICalTok.VTIMEZONE.equals(comp.getTok())) {
ICalTimeZone tz = ICalTimeZone.fromVTimeZone(comp, false, /* skipLookup */
ICalTimeZone.TZID_NAME_ASSIGNMENT_BEHAVIOR.KEEP_IF_DOESNT_CLASH);
tzmap.add(tz);
String origTZID = comp.getPropVal(ICalTok.TZID, null);
if ((null != origTZID) && (origTZID != tz.getID())) {
tzidRenames.put(origTZID, tz.getID());
}
}
}
adjustTZIDnames(components, tzidRenames);
createFromCalendar(toAdd, account, fragment, method, tzmap, cal.getComponentIterator(), sentByMe, mbx, mailItemId, continueOnError, visitor);
}
use of com.zimbra.common.calendar.ICalTimeZone in project zm-mailbox by Zimbra.
the class SetCalendarItem method serializeSetCalendarItemData.
private void serializeSetCalendarItemData(RedoLogOutput out, Mailbox.SetCalendarItemData data) throws IOException {
// keep this for backward compatibility with when SetCalendarItemData
out.writeBoolean(true);
// used to have mForce field
ICalTimeZone localTz = data.invite.getTimeZoneMap().getLocalTimeZone();
out.writeUTF(Util.encodeAsMetadata(localTz).toString());
out.writeUTF(Invite.encodeMetadata(data.invite).toString());
if (getVersion().atLeast(1, 24)) {
out.writeBoolean(data.message != null);
}
// If version is earlier than 1.24, we always have non-null data.mPm.
if (data.message != null) {
out.writeLong(data.message.getReceivedDate());
byte[] pmData = data.message.getRawData();
out.writeInt(pmData.length);
out.write(pmData);
}
}
use of com.zimbra.common.calendar.ICalTimeZone in project zm-mailbox by Zimbra.
the class FixCalendarItemTZ method serializeData.
@Override
protected void serializeData(RedoLogOutput out) throws IOException {
out.writeInt(mId);
if (mReplacementMap != null) {
out.writeInt(mReplacementMap.size());
for (Entry<String, ICalTimeZone> entry : mReplacementMap.entrySet()) {
String tzid = entry.getKey();
ICalTimeZone newTZ = entry.getValue();
String newTZMeta = null;
if (newTZ != null)
newTZMeta = Util.encodeAsMetadata(newTZ).toString();
out.writeUTF(tzid);
out.writeUTF(newTZMeta);
}
} else {
// map size == 0
out.writeInt(0);
}
}
use of com.zimbra.common.calendar.ICalTimeZone in project zm-mailbox by Zimbra.
the class FixCalendarItemTZ method getPrintableData.
@Override
protected String getPrintableData() {
StringBuilder sb = new StringBuilder("id=");
sb.append(mId);
if (mReplacementMap != null) {
sb.append(", replacementMap=[");
for (Entry<String, ICalTimeZone> entry : mReplacementMap.entrySet()) {
String tzid = entry.getKey();
ICalTimeZone newTZ = entry.getValue();
sb.append("\n");
sb.append("oldTZID=\"").append(tzid).append("\"\n==> newTZ: ").append(newTZ.toString()).append(",");
}
sb.append("]");
}
return sb.toString();
}
Aggregations