use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.
the class Period method encodeMetadata.
public Metadata encodeMetadata() {
Metadata meta = new Metadata();
meta.put(FN_START, mStart.getDateTimePartString(false));
if (mHasEnd)
meta.put(FN_END, mEnd.getDateTimePartString(false));
else
meta.put(FN_DURATION, mDuration);
return meta;
}
use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.
the class Util method decodeXParamsFromMetadata.
public static List<ZParameter> decodeXParamsFromMetadata(Metadata meta) throws ServiceException {
int xparamCount = (int) meta.getLong(FN_NUM_XPROPS_OR_XPARAMS, 0);
if (xparamCount > 0) {
List<ZParameter> list = new ArrayList<ZParameter>(xparamCount);
for (int paramNum = 0; paramNum < xparamCount; paramNum++) {
Metadata paramMeta = meta.getMap(FN_XPROP_OR_XPARAM + paramNum, true);
if (paramMeta == null)
continue;
String paramName = paramMeta.get(FN_NAME, null);
if (paramName == null)
continue;
String paramValue = paramMeta.get(FN_VALUE, null);
ZParameter xparam = new ZParameter(paramName, paramValue);
list.add(xparam);
}
return list;
}
return null;
}
use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.
the class SetConfig method redo.
@Override
public void redo() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
mbox.setConfig(getOperationContext(), mSection, mConfig.equals("") ? null : new Metadata(mConfig));
}
use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.
the class ICalReply method deserializeData.
@Override
protected void deserializeData(RedoLogInput in) throws IOException {
try {
ICalTimeZone localTz = Util.decodeTimeZoneFromMetadata(new Metadata(in.readUTF()));
mInvite = Invite.decodeMetadata(getMailboxId(), new Metadata(in.readUTF()), null, localTz);
mSender = in.readUTF();
} catch (ServiceException ex) {
ex.printStackTrace();
throw new IOException("Cannot read serialized entry for ICalReply " + ex.toString());
}
}
use of com.zimbra.cs.mailbox.Metadata in project zm-mailbox by Zimbra.
the class TestMetadata method testMetadata.
/**
* Tests insert, update and delete operations for mailbox metadata.
*/
public void testMetadata() throws Exception {
ZimbraLog.test.info("Starting testMetadata");
Mailbox mbox = TestUtil.getMailbox(USER_NAME);
assertNull(mbox.getConfig(null, METADATA_SECTION));
// Insert
Metadata config = new Metadata();
config.put("string", "mystring");
mbox.setConfig(null, METADATA_SECTION, config);
config = mbox.getConfig(null, METADATA_SECTION);
assertEquals("mystring", config.get("string"));
// Update
config.put("long", 87);
mbox.setConfig(null, METADATA_SECTION, config);
config = mbox.getConfig(null, METADATA_SECTION);
assertEquals(87, config.getLong("long"));
assertEquals("mystring", config.get("string"));
// Delete
mbox.setConfig(null, METADATA_SECTION, null);
assertNull(mbox.getConfig(null, METADATA_SECTION));
}
Aggregations