/**
  * Gets the document as input stream.
  *
  * @param docEntry the doc entry
  * @return the document as input stream
  */
 private InputStream getDocumentAsInputStream(DocumentEntryType docEntry) {
   DocumentRequest documentRequest =
       new DocumentRequest(
           docEntry.getRepositoryUniqueId(),
           affinityDomain.getRepositoryDestination().getUri(),
           docEntry.getEntryUUID());
   ConvenienceCommunicationCh convComm = new ConvenienceCommunicationCh(affinityDomain);
   XDSRetrieveResponseType rrt = convComm.retrieveDocument(documentRequest);
   try {
     if ((rrt.getErrorList() != null)) {
       logger.error(
           "error retriveing doc "
               + docEntry.getEntryUUID()
               + " - "
               + rrt.getErrorList().getHighestSeverity().getName());
     }
     if ((rrt.getAttachments() == null) || rrt.getAttachments().size() != 1) {
       logger.error("document not downloaded or more than one");
       return null;
     }
     return rrt.getAttachments().get(0).getStream();
   } finally {
     convComm.clearDocuments();
   }
 }