Skip to content

Commit

Permalink
Delete deprecated method keepFormFieldsEditableInPdf and update UT
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoang Vu Huy committed Dec 17, 2024
1 parent 4b0c470 commit dc490f4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object>(fieldValue[0]));
}

@Override
public boolean getValue(String fieldName, Ref<Object> fieldValue) throws Exception {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,40 +224,4 @@ private static Set<Class<?>> 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<TemplateMergeField> 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<String, Object> fieldsNameValueMap = getBeanPropertyValues(bean, mergeFieldsNamePrefix);
if (fieldsNameValueMap == null) {
return Collections.emptyList();
}
Collection<TemplateMergeField> 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<TemplateMergeField> getChildrenMergeFieldsForObjectMergeField(
TemplateMergeField templateMergeField) {
return getChildrenMergeFieldsOfTemplateMergeField(templateMergeField);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit dc490f4

Please sign in to comment.