public boolean contains(Object o) { if (o instanceof Attachment) { return attachments.containsKey(((Attachment) o).getId()); } return false; }
public boolean removeAll(Collection<?> c) { boolean b = false; for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); if (o instanceof Attachment && attachments.containsKey(((Attachment) o).getId())) { b = true; attachments.remove(((Attachment) o).getId()); cache.remove(((Attachment) o).getId()); } } return b; }
public boolean addAll(Collection<? extends Attachment> c) { boolean b = false; for (Iterator<? extends Attachment> it = c.iterator(); it.hasNext();) { Attachment o = it.next(); if (!attachments.containsKey(o.getId())) { b = true; attachments.put(o.getId(), o.getDataHandler()); cache.put(o.getId(), o); } } return b; }
public boolean containsAll(Collection<?> c) { boolean b = true; for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); if (!(o instanceof Attachment) && attachments.containsKey(((Attachment) o).getId())) { b = false; break; } } return b; }
public boolean retainAll(Collection<?> c) { boolean b = false; Set<String> ids = new HashSet<>(); for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); if (o instanceof Attachment) { ids.add(((Attachment)o).getId()); } } for (Iterator<String> it = attachments.keySet().iterator(); it.hasNext();) { String k = it.next(); if (!ids.contains(k)) { b = true; it.remove(); cache.remove(k); } } return b; }
if (a.getId().startsWith(start)) { DataHandler dh = a.getDataHandler(); String ct = dh.getContentType();
public boolean removeAll(Collection<?> c) { boolean b = false; for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); if (o instanceof Attachment && attachments.containsKey(((Attachment) o).getId())) { b = true; attachments.remove(((Attachment) o).getId()); cache.remove(((Attachment) o).getId()); } } return b; }
public boolean containsAll(Collection<?> c) { boolean b = true; for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); if (!(o instanceof Attachment) && attachments.containsKey(((Attachment) o).getId())) { b = false; break; } } return b; }
public String addMtomAttachment(DataHandler handler, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachmentFromDH(isXop, handler, elementNS, threshold); if (att != null) { atts.add(att); return "cid:" + att.getId(); } return null; }
public String addMtomAttachment(DataHandler handler, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachmentFromDH(isXop, handler, elementNS, threshold); if (att != null) { atts.add(att); lastElementName = new QName(elementNS, elementLocalName); return "cid:" + att.getId(); } return null; }
public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachment( isXop, mimeType, elementNS, data, offset, length, threshold); if (att != null) { atts.add(att); return "cid:" + att.getId(); } return null; }
public boolean containsKey(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return true; } } return false; }
public boolean containsKey(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return true; } } return false; }
public DataHandler get(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { return at.getDataHandler(); } } return null; }
public DataHandler remove(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { collection.remove(at); return at.getDataHandler(); } } return null; } public DataHandler put(String key, DataHandler value) {
public DataHandler remove(Object key) { Iterator<Attachment> it = collection.iterator(); while (it.hasNext()) { Attachment at = it.next(); if (key.equals(at.getId())) { collection.remove(at); return at.getDataHandler(); } } return null; } public DataHandler put(String key, DataHandler value) {