From dc490f47e1bf5c84f17891f472ef3976e66adf71 Mon Sep 17 00:00:00 2001 From: Hoang Vu Huy Date: Tue, 17 Dec 2024 10:24:26 +0700 Subject: [PATCH] Delete deprecated method keepFormFieldsEditableInPdf and update UT --- ...movingWhiteSpaceInPdfEditableFieldsIT.java | 4 ++- .../aspose/MailMergeDataSource.java | 5 --- .../internal/MergeFieldsExtractor.java | 36 ------------------- .../options/DocumentCreationOptions.java | 10 ------ 4 files changed, 3 insertions(+), 52 deletions(-) diff --git a/doc-factory-test/src_test/ch/ivyteam/ivy/addons/docfactory/RemovingWhiteSpaceInPdfEditableFieldsIT.java b/doc-factory-test/src_test/ch/ivyteam/ivy/addons/docfactory/RemovingWhiteSpaceInPdfEditableFieldsIT.java index 81c494db..666b3a11 100644 --- a/doc-factory-test/src_test/ch/ivyteam/ivy/addons/docfactory/RemovingWhiteSpaceInPdfEditableFieldsIT.java +++ b/doc-factory-test/src_test/ch/ivyteam/ivy/addons/docfactory/RemovingWhiteSpaceInPdfEditableFieldsIT.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test; import ch.ivyteam.ivy.addons.docfactory.options.DocumentCreationOptions; +import ch.ivyteam.ivy.addons.docfactory.pdf.PdfOptions; import ch.ivyteam.ivy.environment.IvyTest; @SuppressWarnings("deprecation") @@ -30,9 +31,10 @@ public void setup() throws Exception { @Test public void defaultDoesNotRemoveWhiteSpaceInPdfEditableFields() { + documentTemplate.withDocumentCreationOptions( DocumentCreationOptions.getInstance() - .keepFormFieldsEditableInPdf(true)); + .withPdfOptions(PdfOptions.getInstance())); File resultFile = DocFactoryTest.makeFile( "test/documentTemplate/removingWhiteSpaceInPdfEditableFieldsIT/default_not_remove_fieldSpaces.pdf"); diff --git a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/aspose/MailMergeDataSource.java b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/aspose/MailMergeDataSource.java index bd27004e..660224d1 100644 --- a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/aspose/MailMergeDataSource.java +++ b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/aspose/MailMergeDataSource.java @@ -249,11 +249,6 @@ public void setTableName(String name) { tableName = name; } - @Deprecated - public boolean getValue(String fieldName, Object[] fieldValue) throws Exception { - return getValue(fieldName, new Ref(fieldValue[0])); - } - @Override public boolean getValue(String fieldName, Ref fieldValue) throws Exception { try { diff --git a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/mergefield/internal/MergeFieldsExtractor.java b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/mergefield/internal/MergeFieldsExtractor.java index 9f7e7292..472be6ea 100644 --- a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/mergefield/internal/MergeFieldsExtractor.java +++ b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/mergefield/internal/MergeFieldsExtractor.java @@ -224,40 +224,4 @@ private static Set> getTypesWhichShouldNotBeIntrospected() { private static boolean isCollection(Object obj) { return obj instanceof Collection || obj instanceof Map; } - - /** - * @deprecated Because it is not used in the DocFactory API. As this class is - * not Public API, you should not use it. - */ - @Deprecated - public static Collection getMergeFieldsWithBaseName(Object bean, - String mergeFieldsNamePrefix) { - if (bean == null) { - return Collections.emptyList(); - } - if (StringUtils.isBlank(mergeFieldsNamePrefix)) { - mergeFieldsNamePrefix = EMPTY_MERGEFIELD_PREFIX_NAME; - } else if (!mergeFieldsNamePrefix.endsWith(DOT)) { - mergeFieldsNamePrefix = mergeFieldsNamePrefix + DOT; - } - Map fieldsNameValueMap = getBeanPropertyValues(bean, mergeFieldsNamePrefix); - if (fieldsNameValueMap == null) { - return Collections.emptyList(); - } - Collection result = new ArrayList<>(); - fieldsNameValueMap.forEach((key, value) -> result.add(TemplateMergeField.withName(key).withValue(value))); - return result; - } - - /** - * @deprecated Use - * {@link #getChildrenMergeFieldsOfTemplateMergeField(TemplateMergeField)} - * instead Will be removed in a near future - */ - @Deprecated - public static Collection getChildrenMergeFieldsForObjectMergeField( - TemplateMergeField templateMergeField) { - return getChildrenMergeFieldsOfTemplateMergeField(templateMergeField); - } - } diff --git a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/options/DocumentCreationOptions.java b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/options/DocumentCreationOptions.java index a814c94a..83689201 100644 --- a/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/options/DocumentCreationOptions.java +++ b/doc-factory/src/ch/ivyteam/ivy/addons/docfactory/options/DocumentCreationOptions.java @@ -26,16 +26,6 @@ public DocumentCreationOptions withPdfOptions(PdfOptions options) { return this; } - /** - * @deprecated use {@link #withPdfOptions(PdfOptions)} instead. The - * {@link PdfOptions} contains this option now. - */ - @Deprecated - public DocumentCreationOptions keepFormFieldsEditableInPdf(boolean keepFormFieldsEditable) { - pdfOptions.setKeepFormFieldsEditableInPdf(keepFormFieldsEditable); - return this; - } - /** * @deprecated use {@link #withPdfOptions(PdfOptions)} instead. The * {@link PdfOptions} contains this option now.