public DocumentValue toDocumentValue(Document document) throws SOperationExecutionException { DocumentValue documentValue; if (document.hasContent()) { try { byte[] documentContent = documentService.getDocumentContent(document.getContentStorageId()); documentValue = new DocumentValue(documentContent, document.getContentMimeType(), document.getContentFileName()); } catch (SObjectNotFoundException e) { throw new SOperationExecutionException("Unable to execute set document operation because the content of the document to use is not found", e); } } else { documentValue = new DocumentValue(document.getUrl()); } return documentValue; }
public DocumentValue toDocumentValue(Document document) throws SOperationExecutionException { DocumentValue documentValue; if (document.hasContent()) { try { byte[] documentContent = documentService.getDocumentContent(document.getContentStorageId()); documentValue = new DocumentValue(documentContent, document.getContentMimeType(), document.getContentFileName()); } catch (SObjectNotFoundException e) { throw new SOperationExecutionException("Unable to execute set document operation because the content of the document to use is not found", e); } } else { documentValue = new DocumentValue(document.getUrl()); } return documentValue; }