diff --git a/CHANGELOG.md b/CHANGELOG.md index ae648f48..e464b1da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Added +- layout/index.html that visualizes csv data of `Export Areas` script. It calculates similarity, suggests merged areas + and groups similar templates and pages together as potential based template candidates. Has several options to adjust + the results. + ### Changed - Unify dependency version under a single catalogue diff --git a/migration-examples/layout/index.html b/migration-examples/layout/index.html new file mode 100644 index 00000000..aa6801f4 --- /dev/null +++ b/migration-examples/layout/index.html @@ -0,0 +1,1997 @@ + + + + + + Layout Analysis + + + + +
+ + + +
+ +
+ + + +
+ +
+
+ + + + + + diff --git a/migration-examples/src/main/groovy/com/quadient/migration/example/common/mapping/AreasExport.groovy b/migration-examples/src/main/groovy/com/quadient/migration/example/common/mapping/AreasExport.groovy index a5faf85a..241126aa 100644 --- a/migration-examples/src/main/groovy/com/quadient/migration/example/common/mapping/AreasExport.groovy +++ b/migration-examples/src/main/groovy/com/quadient/migration/example/common/mapping/AreasExport.groovy @@ -13,6 +13,7 @@ import com.quadient.migration.api.repository.DocumentObjectRepository import com.quadient.migration.example.common.util.Csv import com.quadient.migration.example.common.util.Mapping import com.quadient.migration.shared.DocumentObjectType +import com.quadient.migration.shared.PageOptions import groovy.transform.Field import java.nio.file.Path @@ -42,6 +43,8 @@ static void run(Migration migration, Path path) { Mapping.displayHeader("templateName", true), Mapping.displayHeader("pageId", false), Mapping.displayHeader("pageName", true), + Mapping.displayHeader("pageWidth", true), + Mapping.displayHeader("pageHeight", true), Mapping.displayHeader("interactiveFlowName", false), Mapping.displayHeader("flowToNextPage", false), Mapping.displayHeader("x", true), @@ -90,6 +93,9 @@ static String buildArea(Migration migration, Number idx, Area area, DocumentObje builder.append(Csv.serialize(template?.name) + ",") builder.append(Csv.serialize(page?.id) + ",") builder.append(Csv.serialize(page?.name) + ",") + def pageOptions = page?.options instanceof PageOptions ? page.options as PageOptions : null + builder.append(Csv.serialize(pageOptions?.width) + ",") + builder.append(Csv.serialize(pageOptions?.height) + ",") builder.append(Csv.serialize(area.interactiveFlowName) + ",") builder.append(Csv.serialize(area.flowToNextPage) + ",") builder.append(Csv.serialize(area.position.x) + ",") @@ -103,21 +109,11 @@ static String buildArea(Migration migration, Number idx, Area area, DocumentObje builder.append(Csv.serialize(area.content.collect { switch (it) { case DocumentObjectRef: - def id = it.id - def name = documentObjectIdsToNames.get(id) - if (name == null) { - return "DocumentObjectRef(id=$id)" - } else { - return "DocumentObjectRef(id=$id name=$name)" - } + def name = documentObjectIdsToNames.get(it.id) + return name ? "DocObjRef($name)" : "DocObjRef(${it.id})" case ImageRef: - def id = it.id - def name = imageIdsToNames.get(id) - if (name == null) { - return "ImageRef(id=$id)" - } else { - return "ImageRef(id=$id name=$name)" - } + def name = imageIdsToNames.get(it.id) + return name ? "ImageRef($name)" : "ImageRef(${it.id})" default: return it.toString() } diff --git a/migration-examples/src/test/groovy/AreasExportTest.groovy b/migration-examples/src/test/groovy/AreasExportTest.groovy index ba4a53c5..5ece5a7d 100644 --- a/migration-examples/src/test/groovy/AreasExportTest.groovy +++ b/migration-examples/src/test/groovy/AreasExportTest.groovy @@ -45,12 +45,12 @@ class AreasExportTest { AreasExport.run(migration, mappingFile) def expected = """\ - templateId,templateName (read-only),pageId,pageName (read-only),interactiveFlowName,flowToNextPage,x (read-only),y (read-only),width (read-only),height (read-only),contentPreview (read-only) - full tmpl,,full page,,test flow2,false,0mm,0mm,0mm,0mm, - full tmpl,,full page,,test flow3,true,0mm,0mm,0mm,0mm, - full tmpl,,full page,,,false,0mm,0mm,0mm,0mm, - full tmpl,,full page,,test flow5,false,0mm,0mm,0mm,0mm, - ,,unreferenced page,,test flow,true,0mm,0mm,0mm,0mm, + templateId,templateName (read-only),pageId,pageName (read-only),pageWidth (read-only),pageHeight (read-only),interactiveFlowName,flowToNextPage,x (read-only),y (read-only),width (read-only),height (read-only),contentPreview (read-only) + full tmpl,,full page,,,,test flow2,false,0mm,0mm,0mm,0mm, + full tmpl,,full page,,,,test flow3,true,0mm,0mm,0mm,0mm, + full tmpl,,full page,,,,,false,0mm,0mm,0mm,0mm, + full tmpl,,full page,,,,test flow5,false,0mm,0mm,0mm,0mm, + ,,unreferenced page,,,,test flow,true,0mm,0mm,0mm,0mm, """.stripIndent() Assertions.assertEquals(expected, mappingFile.toFile().text.replaceAll("\\r\\n|\\r", "\n")) } @@ -68,10 +68,10 @@ class AreasExportTest { AreasExport.run(migration, mappingFile) def expected = """\ - templateId,templateName (read-only),pageId,pageName (read-only),interactiveFlowName,flowToNextPage,x (read-only),y (read-only),width (read-only),height (read-only),contentPreview (read-only) - tmpl with areas,,,,Address Content,false,0mm,0mm,0mm,0mm, - tmpl with areas,,,,,true,0mm,0mm,0mm,0mm, - tmpl with areas,,,,Footer,false,0mm,0mm,0mm,0mm, + templateId,templateName (read-only),pageId,pageName (read-only),pageWidth (read-only),pageHeight (read-only),interactiveFlowName,flowToNextPage,x (read-only),y (read-only),width (read-only),height (read-only),contentPreview (read-only) + tmpl with areas,,,,,,Address Content,false,0mm,0mm,0mm,0mm, + tmpl with areas,,,,,,,true,0mm,0mm,0mm,0mm, + tmpl with areas,,,,,,Footer,false,0mm,0mm,0mm,0mm, """.stripIndent() Assertions.assertEquals(expected, mappingFile.toFile().text.replaceAll("\\r\\n|\\r", "\n")) }