Search in sources :

Example 36 with Metadata

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

the class DbScheduledTask method setProperties.

private static void setProperties(ScheduledTask task, String encodedMetadata) throws ServiceException {
    if (StringUtil.isNullOrEmpty(encodedMetadata)) {
        return;
    }
    Metadata metadata = new Metadata(encodedMetadata);
    Map<String, ?> map = metadata.asMap();
    for (Map.Entry<String, ?> entry : map.entrySet()) {
        if (entry.getValue() instanceof String) {
            task.setProperty(entry.getKey(), (String) entry.getValue());
        }
    }
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata) Map(java.util.Map)

Example 37 with Metadata

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

the class ImapCredentials method saveConfig.

private void saveConfig(Set<String> subscriptions) throws ServiceException {
    MetadataList slist = new MetadataList();
    if (subscriptions != null && !subscriptions.isEmpty()) {
        for (String sub : subscriptions) slist.add(sub);
    }
    getMailbox().setConfig(getContext(), SN_IMAP, new Metadata().put(FN_SUBSCRIPTIONS, slist));
}
Also used : MetadataList(com.zimbra.cs.mailbox.MetadataList) Metadata(com.zimbra.cs.mailbox.Metadata)

Example 38 with Metadata

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

the class CalendarData method encodeMetadata.

Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_FOLDER_ID, mFolderId);
    meta.put(FN_MODSEQ, mModSeq);
    meta.put(FN_RANGE_START, mRangeStart);
    meta.put(FN_RANGE_END, mRangeEnd);
    meta.put(FN_NUM_CALITEMS, mCalendarItems.size());
    int i = 0;
    for (CalendarItemData calItemData : mCalendarItems) {
        meta.put(FN_CALITEM + i, calItemData.encodeMetadata());
        i++;
    }
    return meta;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Example 39 with Metadata

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

the class CalendarItemData method encodeMetadata.

Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_TYPE, type.toByte());
    meta.put(FN_FOLDER_ID, mFolderId);
    meta.put(FN_CALITEM_ID, mCalItemId);
    meta.put(FN_FLAGS, mFlags);
    meta.put(FN_TAGS, DbTag.serializeTags(mTags));
    meta.put(FN_IS_PUBLIC, mIsPublic);
    meta.put(FN_MOD_METADATA, mModMetadata);
    meta.put(FN_MOD_CONTENT, mModContent);
    meta.put(FN_DATE, mDate);
    meta.put(FN_CHANGE_DATE, mChangeDate);
    meta.put(FN_SIZE, mSize);
    meta.put(FN_UID, mUid);
    meta.put(FN_IS_RECURRING, mIsRecurring);
    meta.put(FN_HAS_EXCEPTIONS, mHasExceptions);
    if (mAlarm != null)
        meta.put(FN_ALARM, mAlarm.encodeMetadata());
    if (mDefaultData != null)
        meta.put(FN_DEFAULT_INST, mDefaultData.encodeMetadata());
    if (mInstances != null) {
        meta.put(FN_NUM_INST, mInstances.size());
        int i = 0;
        for (InstanceData inst : mInstances) {
            meta.put(FN_INST + i, inst.encodeMetadata());
            i++;
        }
    }
    meta.put(FN_RANGE_START, mActualRangeStart);
    meta.put(FN_RANGE_END, mActualRangeEnd);
    return meta;
}
Also used : Metadata(com.zimbra.cs.mailbox.Metadata)

Example 40 with Metadata

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

the class CtagInfo method encodeMetadata.

Metadata encodeMetadata() {
    Metadata meta = new Metadata();
    meta.put(FN_ID, mId);
    meta.put(FN_FOLDER_ID, mFolderId);
    meta.put(FN_PATH, mPath);
    meta.put(FN_CTAG, mCtag);
    if (mIsMountpoint) {
        meta.put(FN_REMOTE_ACCOUNT, mRemoteAccount);
        meta.put(FN_REMOTE_ID, mRemoteId);
    }
    return meta;
}
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