use of com.zimbra.cs.mailbox.MailItem.CustomMetadata.CustomMetadataList in project zm-mailbox by Zimbra.
the class MailItem method decodeMetadata.
void decodeMetadata(Metadata meta) throws ServiceException {
if (meta == null)
return;
mRGBColor = Color.fromMetadata(meta.getLong(Metadata.FN_COLOR, DEFAULT_COLOR));
mMetaVersion = (int) meta.getLong(Metadata.FN_METADATA_VERSION, 1);
mVersion = (int) meta.getLong(Metadata.FN_VERSION, 1);
mExtendedData = null;
for (Map.Entry<String, ?> entry : meta.asMap().entrySet()) {
String key = entry.getKey();
if (key.startsWith(CUSTOM_META_PREFIX)) {
if (mExtendedData == null) {
mExtendedData = new CustomMetadataList();
}
mExtendedData.addSection(key.substring(CUSTOM_META_PREFIX.length()), entry.getValue().toString());
}
}
ACL acl = null;
if (meta.containsKey(Metadata.FN_RIGHTS_MAP)) {
//new format
acl = makeACLFromMap(Metadata.FN_RIGHTS_MAP, meta);
} else if (meta.containsKey(Metadata.FN_RIGHTS)) {
try {
//try the HELIX list format
MetadataList mlistACL = meta.getList(Metadata.FN_RIGHTS, true);
if (mlistACL != null) {
acl = new ACL(mlistACL);
}
} catch (ServiceException se) {
//map may exist in old attr for a short time between bug 60048 and bug 68928
ZimbraLog.mailbox.warn("Metadata.FN_RIGHTS exists, but is not list. Should never see this outside CF/DF!");
acl = makeACLFromMap(Metadata.FN_RIGHTS, meta);
}
}
if (acl != null) {
rights = acl.isEmpty() ? null : acl;
if (!isTagged(Flag.FlagInfo.NO_INHERIT)) {
alterTag(mMailbox.getFlagById(Flag.ID_NO_INHERIT), true);
}
}
}
Aggregations