use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class PendingLocalModifications method recordDeleted.
@Override
public void recordDeleted(ZimbraMailItem itemSnapshot) {
MailItem.Type type = MailItem.Type.fromCommon(itemSnapshot.getMailItemType());
changedTypes.add(type);
try {
addChangedParentFolderId(itemSnapshot.getFolderIdInMailbox());
} catch (ServiceException e) {
ZimbraLog.mailbox.warn("error getting folder ID for modified item");
}
delete(new ModificationKey(itemSnapshot), type, itemSnapshot);
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class PendingLocalModifications method recordModified.
@Override
public void recordModified(BaseItemInfo item, int reason, ZimbraMailItem preModifyItem) {
MailItem.Type type = MailItem.Type.fromCommon(item.getMailItemType());
changedTypes.add(type);
try {
addChangedParentFolderId(item.getFolderIdInMailbox());
} catch (ServiceException e) {
ZimbraLog.mailbox.warn("error getting folder ID for modified item");
}
if (type == MailItem.Type.FOLDER) {
try {
addChangedFolderId(item.getIdInMailbox());
} catch (ServiceException e) {
ZimbraLog.mailbox.warn("error getting ID for modified item");
}
}
recordModified(new ModificationKey(item), item, reason, preModifyItem, false);
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class ZBaseItem method getModifiedSequence.
@Override
public int getModifiedSequence() {
int modSeq = modifiedSequence;
if (modSeq > 0) {
return modSeq;
}
ZimbraMailItem zmi = null;
try {
zmi = getMailbox().getItemById(null, getItemIdentifier(), getMailItemType());
} catch (ServiceException e) {
ZimbraLog.mailbox.debug("ZBaseItem getModifiedSequence() - getItemById failed for mailbox=%s item=%s", mMailbox, getId(), e);
return 0;
}
if ((null == zmi) || !(zmi instanceof ZBaseItem)) {
return 0;
}
modifiedSequence = (((ZBaseItem) zmi).modifiedSequence <= 0) ? 0 : ((ZBaseItem) zmi).modifiedSequence;
return modifiedSequence;
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class Mailbox method getItemsById.
/**
* @returns MailItems with the specified ids.
* @throws NoSuchItemException if any item does not exist
*/
@Override
public List<ZimbraMailItem> getItemsById(OpContext octxt, Collection<ItemIdentifier> ids) throws ServiceException {
List<Integer> idInts = Lists.newArrayListWithCapacity(ids.size());
for (ItemIdentifier iid : ids) {
idInts.add(iid.id);
}
MailItem[] mitms = getItemById(OperationContext.asOperationContext(octxt), idInts, MailItem.Type.UNKNOWN);
if (null == mitms || (mitms.length == 0)) {
return Collections.emptyList();
}
return Lists.newArrayList(mitms);
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class ZMailbox method resetImapUid.
/**
* @return the list of new IMAP UIDs corresponding to the specified items
*/
@Override
public List<Integer> resetImapUid(OpContext octxt, List<Integer> itemIds) throws ServiceException {
if ((null == itemIds) || itemIds.isEmpty()) {
return Collections.emptyList();
}
resetImapUid(itemIds);
// TODO: ItemAction returns the original IDs. However, the underlying mailbox
// operation on the server returns the new UIDs - i.e. ItemAction throws away that information.
// If performance is a problem probably worth creating a dedicated SOAP request.
List<ZimbraMailItem> zmis = getItemsById(octxt, ItemIdentifier.fromAccountIdAndItemIds(getAccountId(), itemIds));
if ((null == zmis) || zmis.isEmpty()) {
return Collections.emptyList();
}
List<Integer> newImapUIDs = Lists.newArrayListWithExpectedSize(zmis.size());
for (ZimbraMailItem zmi : zmis) {
newImapUIDs.add(zmi.getImapUid());
}
return newImapUIDs;
}
Aggregations