Search in sources :

Example 1 with PurgeImapDeleted

use of com.zimbra.cs.redolog.op.PurgeImapDeleted in project zm-mailbox by Zimbra.

the class Mailbox method purgeImapDeleted.

public void purgeImapDeleted(OperationContext octxt) throws ServiceException {
    PurgeImapDeleted redoRecorder = new PurgeImapDeleted(mId);
    boolean success = false;
    try {
        beginTransaction("purgeImapDeleted", octxt, redoRecorder);
        Set<Folder> purgeable = getAccessibleFolders((short) (ACL.RIGHT_READ | ACL.RIGHT_DELETE));
        // short-circuit the DB call if we're tracking \Deleted counts and they're all 0
        boolean skipDB = false;
        if (getVersion().atLeast(1, 9)) {
            int deleted = 0;
            for (Folder folder : purgeable != null ? purgeable : listAllFolders()) {
                deleted += folder.getDeletedCount();
            }
            skipDB = deleted == 0;
        }
        if (!skipDB) {
            PendingDelete info = DbTag.getImapDeleted(this, purgeable);
            MailItem.delete(this, info, null, true, false);
        }
        success = true;
    } finally {
        endTransaction(success);
    }
}
Also used : PurgeImapDeleted(com.zimbra.cs.redolog.op.PurgeImapDeleted) CreateFolder(com.zimbra.cs.redolog.op.CreateFolder) ZFolder(com.zimbra.client.ZFolder) RefreshMountpoint(com.zimbra.cs.redolog.op.RefreshMountpoint) TargetConstraint(com.zimbra.cs.mailbox.MailItem.TargetConstraint) CreateMountpoint(com.zimbra.cs.redolog.op.CreateMountpoint) PendingDelete(com.zimbra.cs.mailbox.MailItem.PendingDelete)

Aggregations

ZFolder (com.zimbra.client.ZFolder)1 PendingDelete (com.zimbra.cs.mailbox.MailItem.PendingDelete)1 TargetConstraint (com.zimbra.cs.mailbox.MailItem.TargetConstraint)1 CreateFolder (com.zimbra.cs.redolog.op.CreateFolder)1 CreateMountpoint (com.zimbra.cs.redolog.op.CreateMountpoint)1 PurgeImapDeleted (com.zimbra.cs.redolog.op.PurgeImapDeleted)1 RefreshMountpoint (com.zimbra.cs.redolog.op.RefreshMountpoint)1