public static void delete(Mailbox mbox, List ids) throws ServiceException {  if (ids == null || ids.size() == 0) return; List targets = new ArrayList(); for (Iterator it = ids.iterator(); it.hasNext(); ) { Integer id = (Integer) it.next(); if (id.intValue() > 0) targets.add(id); } if (targets.size() == 0)
public static void delete(MailItem item) throws ServiceException { deleteContents(item); if (item instanceof VirtualConversation)
    public static void delete(Mailbox mbox, List ids) throws ServiceException {        // trim out any non-persisted items        if (ids == null || ids.size() == 0)            return;        List targets = new ArrayList();        for (Iterator it = ids.iterator(); it.hasNext(); ) {            Integer id = (Integer) it.next();            if (id.intValue() > 0)                targets.add(id);        }        if (targets.size() == 0)            return;        Connection conn = mbox.getOperationConnection();        PreparedStatement stmt = null;        for (int i = 0; i < targets.size(); i += IN_CLAUSE_BATCH_SIZE)            try {                int count = Math.min(IN_CLAUSE_BATCH_SIZE, targets.size() - i);                stmt = conn.prepareStatement("DELETE FROM " + getMailItemTableName(mbox) +                        " WHERE id IN" + suitableNumberOfVariables(count));                for (int index = i, attr = 1; index < i + count; index++)                	stmt.setInt(attr++, ((Integer) targets.get(index)).intValue());                stmt.executeUpdate();            } catch (SQLException e) {                throw ServiceException.FAILURE("deleting item(s): " + ids, e);            } finally {                DbPool.closeStatement(stmt);            }    }