Search in sources :

Example 1 with SetRetentionPolicy

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);
    }
}
Also used : SetRetentionPolicy(com.zimbra.cs.redolog.op.SetRetentionPolicy) AlterItemTag(com.zimbra.cs.redolog.op.AlterItemTag) CreateTag(com.zimbra.cs.redolog.op.CreateTag) DbTag(com.zimbra.cs.db.DbTag) CreateFolder(com.zimbra.cs.redolog.op.CreateFolder) ZFolder(com.zimbra.client.ZFolder) RetentionPolicy(com.zimbra.soap.mail.type.RetentionPolicy) SetRetentionPolicy(com.zimbra.cs.redolog.op.SetRetentionPolicy)

Aggregations

ZFolder (com.zimbra.client.ZFolder)1 DbTag (com.zimbra.cs.db.DbTag)1 AlterItemTag (com.zimbra.cs.redolog.op.AlterItemTag)1 CreateFolder (com.zimbra.cs.redolog.op.CreateFolder)1 CreateTag (com.zimbra.cs.redolog.op.CreateTag)1 SetRetentionPolicy (com.zimbra.cs.redolog.op.SetRetentionPolicy)1 RetentionPolicy (com.zimbra.soap.mail.type.RetentionPolicy)1