Search in sources :

Example 26 with Metadata

use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.

the class RdateExdate method encodeMetadata.

public Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_IS_RDATE, isRDATE());
    if (mTimeZone != null)
        meta.put(FN_TZID, mTimeZone.getID());
    String vt = VT_DATE_TIME;
    if (!ICalTok.DATE_TIME.equals(mValueType)) {
        vt = ICalTok.DATE.equals(mValueType) ? VT_DATE : VT_PERIOD;
    }
    meta.put(FN_VALUE_TYPE, vt);
    meta.put(FN_NUM_VALUES, mValues.size());
    int i = 0;
    for (Object val : mValues) {
        if (val instanceof ParsedDateTime) {
            ParsedDateTime dt = (ParsedDateTime) val;
            meta.put(FN_VALUE + i, dt.getDateTimePartString(false));
        } else if (val instanceof Period) {
            Period p = (Period) val;
            meta.put(FN_VALUE + i, p.encodeMetadata());
        }
        i++;
    }
    return meta;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata) ParsedDateTime(com.zimbra.common.calendar.ParsedDateTime)

Example 27 with Metadata

use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.

the class RecurId method encodeMetadata.

public Metadata encodeMetadata() {
    Metadata md = new Metadata();
    md.put(FN_DT, mDateTime.toString());
    md.put(FN_RANGE, mRange);
    return md;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Example 28 with Metadata

use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.

the class AlarmData method encodeMetadata.

Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_NEXT_AT, mNextAt);
    meta.put(FN_NEXT_INSTANCE_START, mNextInstStart);
    meta.put(FN_INV_ID, mInvId);
    meta.put(FN_COMP_NUM, mCompNum);
    meta.put(FN_SUMMARY, mSummary);
    meta.put(FN_LOCATION, mLocation);
    if (mAlarm != null)
        meta.put(FN_ALARM, mAlarm.encodeMetadata());
    return meta;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Example 29 with Metadata

use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.

the class Alarm method encodeMetadata.

public Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_ACTION, abbrevAction(mAction));
    meta.put(FN_TRIGGER_TYPE, abbrevTriggerType(mTriggerType));
    if (TriggerType.RELATIVE.equals(mTriggerType)) {
        meta.put(FN_TRIGGER_RELATED, abbrevTriggerRelated(mTriggerRelated));
        meta.put(FN_TRIGGER_RELATIVE, mTriggerRelative.toString());
    } else {
        meta.put(FN_TRIGGER_ABSOLUTE, mTriggerAbsolute.getDateTimePartString(false));
    }
    if (mRepeatDuration != null) {
        meta.put(FN_REPEAT_DURATION, mRepeatDuration.toString());
        meta.put(FN_REPEAT_COUNT, mRepeatCount);
    }
    meta.put(FN_DESCRIPTION, mDescription);
    meta.put(FN_SUMMARY, mSummary);
    if (mAttach != null)
        meta.put(FN_ATTACH, Util.encodeMetadata(mAttach));
    if (mAttendees != null) {
        meta.put(FN_NUM_ATTENDEES, mAttendees.size());
        int i = 0;
        for (Iterator<ZAttendee> iter = mAttendees.iterator(); iter.hasNext(); i++) {
            ZAttendee at = iter.next();
            meta.put(FN_ATTENDEE + i, at.encodeAsMetadata());
        }
    }
    if (xProps.size() > 0)
        Util.encodeXPropsAsMetadata(meta, xpropsIterator());
    return meta;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Example 30 with Metadata

use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.

the class DbScheduledTask method getEncodedMetadata.

private static String getEncodedMetadata(ScheduledTask task) {
    boolean hasProperties = false;
    Metadata metadata = new Metadata();
    Set<String> keys = task.getPropertyNames();
    for (String key : keys) {
        hasProperties = true;
        metadata.put(key, task.getProperty(key));
    }
    if (!hasProperties) {
        return null;
    }
    return metadata.toString();
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Aggregations

Metadata (com.zimbra.cs.mailbox.Metadata)60 Mailbox (com.zimbra.cs.mailbox.Mailbox)16 ArrayList (java.util.ArrayList)15 ServiceException (com.zimbra.common.service.ServiceException)13 DbConnection (com.zimbra.cs.db.DbPool.DbConnection)9 SQLException (java.sql.SQLException)9 IOException (java.io.IOException)8 PreparedStatement (java.sql.PreparedStatement)8 ResultSet (java.sql.ResultSet)8 OperationContext (com.zimbra.cs.mailbox.OperationContext)7 ICalTimeZone (com.zimbra.common.calendar.ICalTimeZone)6 MailItem (com.zimbra.cs.mailbox.MailItem)5 HashMap (java.util.HashMap)5 ZParameter (com.zimbra.common.calendar.ZCalendar.ZParameter)4 DataSource (com.zimbra.cs.account.DataSource)4 DbDataSource (com.zimbra.cs.db.DbDataSource)4 DataSourceItem (com.zimbra.cs.db.DbDataSource.DataSourceItem)4 Map (java.util.Map)4 Entry (java.util.Map.Entry)4 ParsedDateTime (com.zimbra.common.calendar.ParsedDateTime)3