From b624d93541ec7ef9dab22b0d5e17bae72552eb66 Mon Sep 17 00:00:00 2001 From: Ivan Gavrilov Date: Tue, 14 Jan 2025 12:57:11 +0400 Subject: [PATCH] Update dependencies --- build.gradle | 8 +++++++- .../src/com/haulmont/reports/ReportImportExport.java | 11 +++++------ .../core/src/com/haulmont/reports/ReportingBean.java | 5 ++--- .../haulmont/reports/converter/XStreamConverter.java | 3 +++ .../global/src/com/haulmont/reports/bom.properties | 2 +- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 86f52383..5a302b23 100644 --- a/build.gradle +++ b/build.gradle @@ -208,6 +208,10 @@ configure(globalModule) { compile(bom['com.haulmont.yarg:yarg-api']) { exclude group: 'org.codehaus.groovy', module: 'groovy-all' } + compile(bom['com.fasterxml.jackson.core:jackson-databind']) + compile(bom['com.fasterxml.jackson.dataformat:jackson-dataformat-yaml']) + compile(bom['com.fasterxml.jackson.dataformat:jackson-dataformat-xml']) + if (!JavaVersion.current().isJava8()) { runtime('javax.xml.bind:jaxb-api:2.3.1') runtime('org.glassfish.jaxb:jaxb-runtime:2.3.1') @@ -252,7 +256,9 @@ configure(coreModule) { exclude group: 'commons-dbcp', module: 'commons-dbcp' } compile(bom['com.fasterxml.jackson.core:jackson-annotations']) // use the same version as BPM - + compile(bom['com.fasterxml.jackson.core:jackson-databind']) + compile(bom['com.fasterxml.jackson.dataformat:jackson-dataformat-yaml']) + testCompile(group: 'com.haulmont.cuba', name: 'cuba-core-tests', version: baseVersion) testCompile(bom['org.apache.commons:commons-dbcp2']) compileOnly(bom['javax.servlet:javax.servlet-api']) diff --git a/modules/core/src/com/haulmont/reports/ReportImportExport.java b/modules/core/src/com/haulmont/reports/ReportImportExport.java index 743a265d..17b1b5ab 100644 --- a/modules/core/src/com/haulmont/reports/ReportImportExport.java +++ b/modules/core/src/com/haulmont/reports/ReportImportExport.java @@ -26,7 +26,6 @@ import com.haulmont.reports.entity.ReportImportResult; import com.haulmont.reports.entity.ReportTemplate; import com.haulmont.reports.exception.ReportingException; -import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; @@ -69,7 +68,7 @@ public byte[] exportReports(Collection reports) { for (Report report : reports) { try { byte[] reportBytes = exportReport(report); - ArchiveEntry singleReportEntry = newStoredEntry(replaceForbiddenCharacters(report.getName()) + ".zip", reportBytes); + ZipArchiveEntry singleReportEntry = newStoredEntry(replaceForbiddenCharacters(report.getName()) + ".zip", reportBytes); zipOutputStream.putArchiveEntry(singleReportEntry); zipOutputStream.write(reportBytes); zipOutputStream.closeArchiveEntry(); @@ -186,7 +185,7 @@ protected byte[] exportReport(Report report) throws IOException { String xml = report.getXml(); byte[] xmlBytes = xml.getBytes(StandardCharsets.UTF_8); - ArchiveEntry zipEntryReportObject = newStoredEntry("report.structure", xmlBytes); + ZipArchiveEntry zipEntryReportObject = newStoredEntry("report.structure", xmlBytes); zipOutputStream.putArchiveEntry(zipEntryReportObject); zipOutputStream.write(xmlBytes); @@ -203,7 +202,7 @@ protected byte[] exportReport(Report report) throws IOException { } if (template != null && template.getContent() != null) { byte[] fileBytes = template.getContent(); - ArchiveEntry zipEntryTemplate = newStoredEntry( + ZipArchiveEntry zipEntryTemplate = newStoredEntry( "templates/" + i + "/" + template.getName(), fileBytes); zipOutputStream.putArchiveEntry(zipEntryTemplate); zipOutputStream.write(fileBytes); @@ -340,7 +339,7 @@ protected byte[] zipContent(Map stringObjectMap) throws IOExcept for (Map.Entry entry : stringObjectMap.entrySet()) { byte[] data = (byte[]) entry.getValue(); - ArchiveEntry archiveEntry = newStoredEntry(entry.getKey(), data); + ZipArchiveEntry archiveEntry = newStoredEntry(entry.getKey(), data); zipOutputStream.putArchiveEntry(archiveEntry); zipOutputStream.write(data); zipOutputStream.closeArchiveEntry(); @@ -350,7 +349,7 @@ protected byte[] zipContent(Map stringObjectMap) throws IOExcept return byteArrayOutputStream.toByteArray(); } - protected ArchiveEntry newStoredEntry(String name, byte[] data) { + protected ZipArchiveEntry newStoredEntry(String name, byte[] data) { ZipArchiveEntry zipEntry = new ZipArchiveEntry(name); zipEntry.setSize(data.length); zipEntry.setCompressedSize(zipEntry.getSize()); diff --git a/modules/core/src/com/haulmont/reports/ReportingBean.java b/modules/core/src/com/haulmont/reports/ReportingBean.java index 6432fd37..867b719c 100644 --- a/modules/core/src/com/haulmont/reports/ReportingBean.java +++ b/modules/core/src/com/haulmont/reports/ReportingBean.java @@ -45,7 +45,6 @@ import com.haulmont.yarg.structure.ReportOutputType; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; -import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.lang3.StringUtils; @@ -304,7 +303,7 @@ public ReportOutputDocument bulkPrint(Report report, String templateCode, com.ha alreadyUsedNames.put(documentName, 1); } - ArchiveEntry singleReportEntry = newStoredEntry(documentName, reportDocument.getContent()); + ZipArchiveEntry singleReportEntry = newStoredEntry(documentName, reportDocument.getContent()); zipOutputStream.putArchiveEntry(singleReportEntry); zipOutputStream.write(reportDocument.getContent()); } @@ -321,7 +320,7 @@ public ReportOutputDocument bulkPrint(Report report, String templateCode, com.ha } } - protected ArchiveEntry newStoredEntry(String name, byte[] data) { + protected ZipArchiveEntry newStoredEntry(String name, byte[] data) { ZipArchiveEntry zipEntry = new ZipArchiveEntry(name); zipEntry.setSize(data.length); zipEntry.setCompressedSize(zipEntry.getSize()); diff --git a/modules/core/src/com/haulmont/reports/converter/XStreamConverter.java b/modules/core/src/com/haulmont/reports/converter/XStreamConverter.java index eb8c9044..d0ab6329 100644 --- a/modules/core/src/com/haulmont/reports/converter/XStreamConverter.java +++ b/modules/core/src/com/haulmont/reports/converter/XStreamConverter.java @@ -16,6 +16,7 @@ package com.haulmont.reports.converter; +import com.haulmont.cuba.core.entity.Entity; import com.haulmont.cuba.core.global.View; import com.haulmont.cuba.core.global.ViewProperty; import com.haulmont.cuba.core.sys.CubaXStream; @@ -101,6 +102,8 @@ public boolean canConvert(Class type) { xStream.aliasField("definedBy", ReportTemplate.class, "customDefinedBy"); xStream.aliasField("uuid", ReportValueFormat.class, "id"); + xStream.allowTypeHierarchy(Entity.class); + return xStream; } diff --git a/modules/global/src/com/haulmont/reports/bom.properties b/modules/global/src/com/haulmont/reports/bom.properties index 98602c7e..db9c09f5 100644 --- a/modules/global/src/com/haulmont/reports/bom.properties +++ b/modules/global/src/com/haulmont/reports/bom.properties @@ -14,7 +14,7 @@ # limitations under the License. # -com.haulmont.yarg = 2.2.19 +com.haulmont.yarg = 2.2.22 com.haulmont.yarg/yarg-api = ${com.haulmont.yarg} com.haulmont.yarg/yarg = ${com.haulmont.yarg}