@Test public void testNewFlatValue2Document() { marshaller.init(null, field, form, context); DocumentData data = new DocumentData(DOCUMENT_ID, 1024, null); data.setContentId("content"); Document doc = marshaller.toRawValue(data); verify(documentStorage).getContent(anyString()); verify(documentStorage).removeContent(anyString()); assertNotNull("Document cannot be null!", doc); assertEquals("Names are not equal", data.getFileName(), doc.getName()); assertEquals("Sizes are not equal", data.getSize(), doc.getSize()); }
@Override public Document toRawValue(DocumentData documentData) { if (documentData == null) { return null; } if (documentData.getStatus().equals(DocumentStatus.STORED)) { return originalValue; } return toDocument(documentData, documentStorage); }
DocumentFieldValueMarshaller extends AbstractFieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition> { @Override public Document toRawValue(DocumentData documentData) { if (documentData == null) { return null; } if (documentData.getStatus().equals(DocumentStatus.STORED)) { return originalValue; } return toDocument(documentData, documentStorage); } }
DocumentFieldValueMarshaller extends AbstractFieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition> { @Override public Document toRawValue(DocumentData documentData) { if (documentData == null) { return null; } if (documentData.getStatus().equals(DocumentStatus.STORED)) { return originalValue; } return toDocument(documentData, documentStorage); } @Inject  DocumentFieldValueMarshaller(UploadedDocumentStorage documentStorage); }
DocumentFieldValueMarshaller extends AbstractFieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition> { @Override public Document toRawValue(DocumentData documentData) { if (documentData == null) { return null; } if (documentData.getStatus().equals(DocumentStatus.STORED)) { return originalValue; } return toDocument(documentData, documentStorage); } @Inject  DocumentFieldValueMarshaller(UploadedDocumentStorage documentStorage); @Override Class<DocumentFieldDefinition> getSupportedField(); @Override Supplier<FieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition>> newInstanceSupplier(); @Override DocumentData toFlatValue(); @Override Document toRawValue(DocumentData documentData); }
DocumentFieldValueMarshaller extends AbstractFieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition> { @Override public Document toRawValue(DocumentData documentData) { if (documentData == null) { return null; } if (documentData.getStatus().equals(DocumentStatus.STORED)) { return originalValue; } return toDocument(documentData, documentStorage); } @Inject  DocumentFieldValueMarshaller(UploadedDocumentStorage documentStorage); @Override Class<DocumentFieldDefinition> getSupportedField(); @Override Supplier<FieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition>> newInstanceSupplier(); @Override DocumentData toFlatValue(); @Override Document toRawValue(DocumentData documentData); static final String SERVER_TEMPLATE_ID; }