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 static byte[] generateContent(final Document doc) { return doc.getName().getBytes(); }
public void buildAndAttachDocument(final ProcessInstance processInstance) throws BonitaException { final String documentName = String.valueOf(System.currentTimeMillis()); final Document doc = BuildTestUtil.buildDocument(documentName); buildAndAttachDocument(processInstance, documentName, doc.getContentFileName()); }
public void buildAndAttachDocument(final ProcessInstance processInstance, final String documentName, final String fileName) throws BonitaException { final Document doc = BuildTestUtil.buildDocument(documentName); getProcessAPI().attachDocument(processInstance.getId(), documentName, fileName, doc.getContentMimeType(), documentName.getBytes()); }
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 String getAttachmentDocumentName(final ProcessInstance processInstance) throws BonitaException { final Document attachment = getAttachmentWithoutItsContent(processInstance); return attachment.getName(); }