Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DocumentObject> {
Expand All @@ -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<String>("skipped") eq "false"))
)
}
Expand Down Expand Up @@ -131,7 +132,7 @@ class InteractiveDeployClient(
}
require(error.isEmpty()) { error }

return documentObjects.filter { it.type != DocumentObjectType.Page }
return documentObjects
}

private fun deployDisplayRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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),
)
}

Expand All @@ -332,7 +329,6 @@ class ProgressReporterImpl(
resourceType = ResourceType.Image,
output = output,
internal = false,
isPage = false
)
}

Expand All @@ -343,7 +339,6 @@ class ProgressReporterImpl(
resourceType = ResourceType.Attachment,
output = output,
internal = false,
isPage = false
)
}

Expand All @@ -352,9 +347,8 @@ class ProgressReporterImpl(
this.id,
ResourceType.DocumentObject,
output,
this.internal ?: false,
documentObjectBuilder.shouldIncludeInternalDependency(this),
nextIcmPath,
this.type == DocumentObjectType.Page
)
}

Expand All @@ -372,7 +366,6 @@ class ProgressReporterImpl(
output: InspireOutput,
internal: Boolean = false,
nextIcmPath: IcmPath?,
isPage: Boolean = false
): DeployKind {
if (internal) {
return DeployKind.Inline
Expand All @@ -386,8 +379,6 @@ class ProgressReporterImpl(
DeployKind.Create
} else if (lastDeployEvent != null) {
DeployKind.Overwrite
} else if (isPage) {
DeployKind.Inline
} else {
DeployKind.Create
}
Expand All @@ -407,7 +398,6 @@ class ProgressReporterImpl(
resourceType = ResourceType.DisplayRule,
output = output,
internal = this.internal,
isPage = false
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Op<Boolean>>()) } 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),
)
Expand All @@ -641,13 +641,13 @@ class InteractiveDeployClientTest {
verify(exactly = 1) { documentObjectRepository.list(any<Op<Boolean>>()) }
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()
Expand All @@ -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<Op<Boolean>>()) } returns listOf(template)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading