public void setContent(final byte[] content) { hasContent = true; this.content = content; checkIfTheFileNameIsFilledForADocumentWithContent(); }
@Override public Document attachDocument(final long processInstanceId, final String documentName, final String fileName, final String mimeType, final String url) throws DocumentAttachmentException { final DocumentValue documentValue = new DocumentValue(url); documentValue.setFileName(fileName); documentValue.setMimeType(mimeType); try { return addDocument(processInstanceId, documentName, null, documentValue); } catch (final BonitaException e) { throw new DocumentAttachmentException(e); } }
/** * @param documentDefinition */ public SDocumentDefinitionImpl(final DocumentDefinition documentDefinition) { super(documentDefinition.getName()); url = documentDefinition.getUrl(); file = documentDefinition.getFile(); description = documentDefinition.getDescription(); mimeType = documentDefinition.getContentMimeType(); fileName = documentDefinition.getFileName(); initialValue = ServerModelConvertor.convertExpression(documentDefinition.getInitialValue()); }
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; }
private SDocument buildSDocument(final DocumentValue documentValue) { if (documentValue.hasContent()) { return buildProcessDocument(documentValue.getFileName(), documentValue.getMimeType(), getUserId(), documentValue.getContent()); } return buildExternalProcessDocumentReference(documentValue.getFileName(), documentValue.getMimeType(), getUserId(), documentValue.getUrl()); }
public SDocumentListDefinitionImpl(DocumentListDefinition documentListDefinition) { super(documentListDefinition.getName()); description = documentListDefinition.getDescription(); expression = ServerModelConvertor.convertExpression(documentListDefinition.getExpression()); }
@Override public Document attachDocument(final long processInstanceId, final String documentName, final String fileName, final String mimeType, final byte[] documentContent) throws DocumentAttachmentException { final DocumentValue documentValue = new DocumentValue(documentContent, mimeType, fileName); try { return addDocument(processInstanceId, documentName, null, documentValue); } catch (final BonitaException e) { throw new DocumentAttachmentException(e); } }
@Override public void deleteContentOfArchivedDocument(final long archivedDocumentId) throws DocumentException, DocumentNotFoundException { final TenantServiceAccessor tenantAccessor = APIUtils.getTenantAccessor(); final DocumentService documentService = tenantAccessor.getDocumentService(); try { documentService.deleteContentOfArchivedDocument(archivedDocumentId); } catch (final SObjectNotFoundException e) { throw new DocumentNotFoundException("The document with id " + archivedDocumentId + " could not be found", e); } catch (final SBonitaException e) { throw new DocumentException("Unable to delete content of all version of the document " + archivedDocumentId, e); } }
/** * Test method for {@link org.bonitasoft.engine.bpm.document.DocumentValue#DocumentValue(byte[], java.lang.String, java.lang.String)}. */ @Test public final void should_be_able_to_construct_DocumentValue_without_content_but_with_mimeType_and_file_name() { new DocumentValue(null, "mimeType", "filename"); }
/** * @param documentDefinition */ public SDocumentDefinitionImpl(final DocumentDefinition documentDefinition) { super(documentDefinition.getName()); url = documentDefinition.getUrl(); file = documentDefinition.getFile(); description = documentDefinition.getDescription(); mimeType = documentDefinition.getContentMimeType(); fileName = documentDefinition.getFileName(); initialValue = ServerModelConvertor.convertExpression(documentDefinition.getInitialValue()); }
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; }
private SDocument buildSDocument(final DocumentValue documentValue) { if (documentValue.hasContent()) { return buildProcessDocument(documentValue.getFileName(), documentValue.getMimeType(), getUserId(), documentValue.getContent()); } return buildExternalProcessDocumentReference(documentValue.getFileName(), documentValue.getMimeType(), getUserId(), documentValue.getUrl()); }
@Override public Document attachDocument(final long processInstanceId, final String documentName, final String fileName, final String mimeType, final String url) throws DocumentAttachmentException { final DocumentValue documentValue = new DocumentValue(url); documentValue.setFileName(fileName); documentValue.setMimeType(mimeType); try { return addDocument(processInstanceId, documentName, null, documentValue); } catch (final BonitaException e) { throw new DocumentAttachmentException(e); } }
public SDocumentListDefinitionImpl(DocumentListDefinition documentListDefinition) { super(documentListDefinition.getName()); description = documentListDefinition.getDescription(); expression = ServerModelConvertor.convertExpression(documentListDefinition.getExpression()); }
@Override public Document attachDocument(final long processInstanceId, final String documentName, final String fileName, final String mimeType, final byte[] documentContent) throws DocumentAttachmentException { final DocumentValue documentValue = new DocumentValue(documentContent, mimeType, fileName); try { return addDocument(processInstanceId, documentName, null, documentValue); } catch (final BonitaException e) { throw new DocumentAttachmentException(e); } }
@Override public void deleteContentOfArchivedDocument(final long archivedDocumentId) throws DocumentException, DocumentNotFoundException { final TenantServiceAccessor tenantAccessor = APIUtils.getTenantAccessor(); final DocumentService documentService = tenantAccessor.getDocumentService(); try { documentService.deleteContentOfArchivedDocument(archivedDocumentId); } catch (final SObjectNotFoundException e) { throw new DocumentNotFoundException("The document with id " + archivedDocumentId + " could not be found", e); } catch (final SBonitaException e) { throw new DocumentException("Unable to delete content of all version of the document " + archivedDocumentId, e); } }
/** * Test method for {@link org.bonitasoft.engine.bpm.document.DocumentValue#DocumentValue(long, byte[], java.lang.String, java.lang.String)}. */ @Test public final void should_be_able_to_construct_DocumentValue_without_content_with_documentId_and_mimeType_and_file_name() { new DocumentValue(1, null, "mimeType", "filename"); }
public void setContent(final byte[] content) { hasContent = true; this.content = content; checkIfTheFileNameIsFilledForADocumentWithContent(); }
public void setFileName(final String fileName) { this.fileName = fileName; checkIfTheFileNameIsFilledForADocumentWithContent(); }
public void setFileName(final String fileName) { this.fileName = fileName; checkIfTheFileNameIsFilledForADocumentWithContent(); }