code: public static Map<String, PreparedAttachment> prepareAttachments(String attachmentsDir,
                                                                   AttachmentStreamFactory attachmentStreamFactory,
                                                                   Map<String, Attachment> attachments)
          throws AttachmentException {
          Map<String, PreparedAttachment> preparedAttachments = new HashMap<String, PreparedAttachment>();
          for (Map.Entry<String, Attachment> a : attachments.entrySet()) {
              PreparedAttachment pa = AttachmentManager.prepareAttachment(attachmentsDir, attachmentStreamFactory, a.getValue());
              preparedAttachments.put(a.getKey(), pa);
          }
          return preparedAttachments;
      }
docs: Download each attachment in {@code attachments} to a temporary location, and
  return a list of attachments suitable for passing to {@code setAttachments}.
  
  Typically {@code attachments} is found via a call to {@link #findNewAttachments}.
  
  @param attachments Map of attachments to prepare.
  @return Map of attachments prepared for inserting into attachment store.
  @see #findNewAttachments