use of com.zimbra.cs.service.mail.CopyActionResult in project zm-mailbox by Zimbra.
the class Mailbox method copyItemAction.
/**
* Copies the items identified in {@link idlist} to folder {@link targetFolder}
* @param idlist - list of item ids for items to copy
* @param targetFolder - Destination folder
* @return The item IDs of the created items - these may be full item IDs in the case of remote folders
*/
@Override
public List<String> copyItemAction(OpContext ctxt, ItemIdentifier targetFolder, List<ItemIdentifier> idlist) throws ServiceException {
if ((idlist == null) || idlist.isEmpty()) {
return Collections.emptyList();
}
List<Integer> ids = Lists.newArrayListWithExpectedSize(idlist.size());
for (ItemIdentifier ident : idlist) {
if (this.referencesOtherMailbox(ident)) {
// requests are proxied to the selected folder's owner.
throw ServiceException.FAILURE("Unexpected attempt to copy item from mountpoint", null);
}
ids.add(ident.id);
}
ItemActionHelper op = ItemActionHelper.COPY((OperationContext) ctxt, this, null, ids, MailItem.Type.UNKNOWN, null, new ItemId(targetFolder));
CopyActionResult caResult = (CopyActionResult) op.getResult();
return caResult.getCreatedIds();
}
Aggregations