diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e2820..6da1046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,12 +10,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) - Added barcode and QR code support - Cell overflow options +- Templates in Interactive output work directly with areas in its content +- Pages marked as internal are utilized (for Interactive flows) in Interactive output without creating standalone .jld file ### Changed - Shape (line) in Migration Model Example moved to header part of the document to avoid collision with new and dynamic content -- **Breaking** Pages in Interactive output no longer create standalone template .jld file, but are still taken into - account when distributing content to Interactive flows. Templates also work directly with areas in its content. ### Fixed diff --git a/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClient.kt b/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClient.kt index 89d93b3..44430c2 100644 --- a/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClient.kt +++ b/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClient.kt @@ -89,7 +89,7 @@ class InteractiveDeployClient( } override fun shouldIncludeDependency(documentObject: DocumentObject): Boolean { - return documentObject.type != DocumentObjectType.Page && documentObject.internal != true + return documentObject.internal != true } override fun getAllDocumentObjectsToDeploy(): List { @@ -98,7 +98,8 @@ class InteractiveDeployClient( DocumentObjectType.Template.toString(), DocumentObjectType.Block.toString(), DocumentObjectType.Section.toString(), - DocumentObjectType.Snippet.toString() + DocumentObjectType.Snippet.toString(), + DocumentObjectType.Page.toString() ) and DocumentObjectTable.internal.eq(false) and (DocumentObjectTable.skip.extract("skipped") eq "false")) ) } @@ -131,7 +132,7 @@ class InteractiveDeployClient( } require(error.isEmpty()) { error } - return documentObjects.filter { it.type != DocumentObjectType.Page } + return documentObjects } private fun deployDisplayRules( diff --git a/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/utility/ProgressReport.kt b/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/utility/ProgressReport.kt index f96e3f9..d71626f 100644 --- a/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/utility/ProgressReport.kt +++ b/migration-library/src/main/kotlin/com/quadient/migration/service/deploy/utility/ProgressReport.kt @@ -23,7 +23,6 @@ import com.quadient.migration.api.repository.StatusTrackingRepository import com.quadient.migration.data.Active import com.quadient.migration.data.Deployed import com.quadient.migration.service.inspirebuilder.InspireDocumentObjectBuilder -import com.quadient.migration.shared.DocumentObjectType import com.quadient.migration.shared.IcmPath import kotlin.reflect.KClass import kotlin.time.Clock @@ -265,9 +264,8 @@ class ProgressReporterImpl( resourceType: ResourceType, output: InspireOutput, internal: Boolean, - isPage: Boolean ): LastStatus { - if (internal || isPage) return LastStatus.Inlined + if (internal) return LastStatus.Inlined val objectEvents = statusTrackingRepository.findEventsRelevantToOutput(id, resourceType, output) .filter { ev -> lastDeployment?.timestamp?.let { ev.timestamp <= it } ?: true } @@ -320,8 +318,7 @@ class ProgressReporterImpl( lastDeployment = lastDeployment, resourceType = ResourceType.DocumentObject, output = output, - internal = this.internal ?: false, - isPage = this.type == DocumentObjectType.Page + internal = documentObjectBuilder.shouldIncludeInternalDependency(this), ) } @@ -332,7 +329,6 @@ class ProgressReporterImpl( resourceType = ResourceType.Image, output = output, internal = false, - isPage = false ) } @@ -343,7 +339,6 @@ class ProgressReporterImpl( resourceType = ResourceType.Attachment, output = output, internal = false, - isPage = false ) } @@ -352,9 +347,8 @@ class ProgressReporterImpl( this.id, ResourceType.DocumentObject, output, - this.internal ?: false, + documentObjectBuilder.shouldIncludeInternalDependency(this), nextIcmPath, - this.type == DocumentObjectType.Page ) } @@ -372,7 +366,6 @@ class ProgressReporterImpl( output: InspireOutput, internal: Boolean = false, nextIcmPath: IcmPath?, - isPage: Boolean = false ): DeployKind { if (internal) { return DeployKind.Inline @@ -386,8 +379,6 @@ class ProgressReporterImpl( DeployKind.Create } else if (lastDeployEvent != null) { DeployKind.Overwrite - } else if (isPage) { - DeployKind.Inline } else { DeployKind.Create } @@ -407,7 +398,6 @@ class ProgressReporterImpl( resourceType = ResourceType.DisplayRule, output = output, internal = this.internal, - isPage = false ) } } diff --git a/migration-library/src/main/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilder.kt b/migration-library/src/main/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilder.kt index f0b152f..b034e74 100644 --- a/migration-library/src/main/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilder.kt +++ b/migration-library/src/main/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilder.kt @@ -244,7 +244,7 @@ class InteractiveDocumentObjectBuilder( documentObject.content.paragraphIfEmpty().forEach { documentContentPart -> if (documentContentPart is DocumentObjectRef) { val referencedModel = documentObjectRepository.findOrFail(documentContentPart.id) - if (referencedModel.type == DocumentObjectType.Page) { + if (referencedModel.type == DocumentObjectType.Page && referencedModel.internal == true) { referencedModel.content.paragraphIfEmpty().forEach { pageContentPart -> mapContentItemToInteractiveFlow(pageContentPart, currentBaseTemplateData, interactiveFlowsWithContent) } @@ -319,7 +319,7 @@ class InteractiveDocumentObjectBuilder( } override fun shouldIncludeInternalDependency(documentObject: DocumentObject): Boolean { - return documentObject.internal == true || documentObject.type == DocumentObjectType.Page + return documentObject.internal == true } override fun resolveParagraphStyleName(name: String): String = diff --git a/migration-library/src/test/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClientTest.kt b/migration-library/src/test/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClientTest.kt index 21d0ea3..3d2d360 100644 --- a/migration-library/src/test/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClientTest.kt +++ b/migration-library/src/test/kotlin/com/quadient/migration/service/deploy/InteractiveDeployClientTest.kt @@ -624,14 +624,14 @@ class InteractiveDeployClientTest { } @Test - fun `page objects are silently filtered from deploy list`() { + fun `external page objects are included in deploy list`() { val spy = spyk(subject) every { spy.deployDocumentObjectsInternal(any(), any(), any(), any(), any(), any()) } returns DeploymentResult( Uuid.random() ) every { documentObjectRepository.list(any>()) } returns listOf( aBlock(id = "1", type = DocumentObjectType.Block), - aBlock(id = "2", type = DocumentObjectType.Page), + aBlock(id = "2", type = DocumentObjectType.Page, internal = false), aBlock(id = "3", type = DocumentObjectType.Template), aBlock(id = "4", type = DocumentObjectType.Section), ) @@ -641,13 +641,13 @@ class InteractiveDeployClientTest { verify(exactly = 1) { documentObjectRepository.list(any>()) } verify { spy.deployDocumentObjectsInternal(match { docObjects -> - docObjects.size == 3 && docObjects.map { it.id }.containsAll(listOf("1", "3", "4")) + docObjects.size == 4 && docObjects.map { it.id }.containsAll(listOf("1", "2", "3", "4")) }, any(), any(), any(), any(), any()) } } @Test - fun `deploy list of document objects excludes pages but includes their transitive external dependencies`() { + fun `deploy list of document objects excludes internal pages but includes their transitive external dependencies`() { val spy = spyk(subject) every { spy.deployDocumentObjectsInternal(any(), any(), any(), any(), any(), any()) } returns DeploymentResult( Uuid.random() @@ -656,7 +656,7 @@ class InteractiveDeployClientTest { val block3 = aDocObj("block3", DocumentObjectType.Block) val block2 = aDocObj("block2", DocumentObjectType.Block, internal = true, content = listOf(aDocumentObjectRef(block3.id))) val block1 = aDocObj("block1", DocumentObjectType.Block) - val page = aDocObj("page1", DocumentObjectType.Page, content = listOf(aDocumentObjectRef(block1.id), aDocumentObjectRef(block2.id))) + val page = aDocObj("page1", DocumentObjectType.Page, internal = true, content = listOf(aDocumentObjectRef(block1.id), aDocumentObjectRef(block2.id))) val template = aDocObj("template1", DocumentObjectType.Template, content = listOf(aDocumentObjectRef(page.id))) every { documentObjectRepository.list(any>()) } returns listOf(template) diff --git a/migration-library/src/test/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilderTest.kt b/migration-library/src/test/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilderTest.kt index e0ba6a6..c21c8d1 100644 --- a/migration-library/src/test/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilderTest.kt +++ b/migration-library/src/test/kotlin/com/quadient/migration/service/inspirebuilder/InteractiveDocumentObjectBuilderTest.kt @@ -916,7 +916,7 @@ class InteractiveDocumentObjectBuilderTest { ) val template = if (contentType == Page) { - val page = DocumentObjectBuilder("P_1", Page).content(areaContent).build().mock() + val page = DocumentObjectBuilder("P_1", Page).internal(true).content(areaContent).build().mock() DocumentObjectBuilder("T_1", Template).documentObjectRef(page).build() } else { DocumentObjectBuilder("T_1", Template).content(areaContent).build()