private InitialAttachment getProcessAttachment(final DocumentationManager manager, final ProcessDefinitionUUID processUUID, final AttachmentDefinition attachment) { final List<Document> documents = DocumentService.getDocuments(manager, processUUID, attachment.getName()); byte[] content = null; if (!documents.isEmpty()) { try { content = manager.getContent(documents.get(0)); } catch (final DocumentNotFoundException e) { throw new BonitaRuntimeException(e); } } return new InitialAttachmentImpl(attachment, content); }
@Override public byte[] getDocumentContent(final DocumentUUID documentUUID) throws DocumentNotFoundException { final DocumentationManager manager = EnvTool.getDocumentationManager(); final String documentId = documentUUID.getValue(); final org.ow2.bonita.services.Document document = manager.getDocument(documentId); if (document == null) { throw new DocumentNotFoundException(documentId); } return manager.getContent(document); }
@Override public byte[] getAttachmentValue(final AttachmentInstance attachmentInstance) { final DocumentationManager manager = EnvTool.getDocumentationManager(); try { final org.ow2.bonita.services.Document document = manager.getDocument(attachmentInstance.getUUID().getValue()); return manager.getContent(document); } catch (final DocumentNotFoundException e) { throw new BonitaRuntimeException(e); } }
byte[] attachmentValue; try { attachmentValue = manager.getContent(document); } catch (final DocumentNotFoundException e) { throw new BonitaRuntimeException(e);
final DocumentationManager manager = EnvTool.getDocumentationManager(); final org.ow2.bonita.services.Document document = manager.getDocument(newAttachment.getUUID().getValue()); attachmentValue = manager.getContent(document); } catch (final DocumentNotFoundException e) { throw new BonitaRuntimeException(e);
throw new BonitaRuntimeException("Cannot retrieve document"); final byte[] content = manager.getContent(document); manager.createDocument(attachmentDefinition.getName(), processUUID, instance.getUUID(), attachmentDefinition.getFileName(), DocumentService.DEFAULT_MIME_TYPE, content);