use of com.zimbra.cs.redolog.op.SetRetentionPolicy in project zm-mailbox by Zimbra.
the class Mailbox method setRetentionPolicy.
public void setRetentionPolicy(OperationContext octxt, int itemId, MailItem.Type type, RetentionPolicy rp) throws ServiceException {
if (type != MailItem.Type.FOLDER && type != MailItem.Type.TAG) {
throw ServiceException.FAILURE("Cannot set retention policy for " + type, null);
}
if (rp == null) {
rp = new RetentionPolicy();
} else {
validateRetentionPolicy(rp.getKeepPolicy());
validateRetentionPolicy(rp.getPurgePolicy());
}
SetRetentionPolicy redoPlayer = new SetRetentionPolicy(mId, type, itemId, rp);
boolean success = false;
try {
beginTransaction("setRetentionPolicy", octxt, redoPlayer);
if (type == MailItem.Type.FOLDER) {
Folder folder = getFolderById(itemId);
checkItemChangeID(folder);
folder.setRetentionPolicy(rp);
} else {
Tag tag = getTagById(itemId);
checkItemChangeID(tag);
tag.setRetentionPolicy(rp);
}
success = true;
} finally {
endTransaction(success);
}
}
Aggregations