diff --git a/backend/app/.env.properties b/backend/app/.env.properties new file mode 100644 index 0000000..c6f5749 --- /dev/null +++ b/backend/app/.env.properties @@ -0,0 +1,34 @@ +# This file with secrets has been made public for demonstration purposes. + +VALTIMO_PLUGIN_ENCRYPTION-SECRET=abcdefghijklmnop +VALTIMO_CONNECTOR-ENCRYPTION_SECRET=0123456789101112 + +SPRING_DATASOURCE_PASSWORD=password +SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAKAPI_CLIENT-SECRET=6ef6ca16-6b86-482a-a3d9-0561704c1db9 + +VALTIMO_API_URL=http://host.docker.internal:8080/api/v1/ +ZAKEN_API_URL=http://localhost:8001/zaken/api/v1/ +BESLUITEN_API_URL=http://localhost:8001/besluiten/api/v1/ +CATALOGI_API_URL=http://localhost:8001/catalogi/api/v1/ +DOCUMENTEN_API_URL=http://localhost:8001/documenten/api/v1/ +NOTIFICATIES_API_URL=http://localhost:8002/api/v1/ +OBJECTEN_API_URL=http://localhost:8010/api/v2/ +OBJECTTYPEN_API_URL=http://localhost:8011/api/v1/ + +OPEN_ZAAK_CLIENT_ID=valtimo_client +OPEN_ZAAK_CLIENT_SECRET=e09b8bc5-5831-4618-ab28-41411304309d + +OPEN_NOTIFICATIES_CLIENT_ID=valtimo +OPEN_NOTIFICATIES_CLIENT_SECRET=zZ!xRP&$qTn4A9ETa^ZMKepDm^8egjPz + +OBJECTEN_API_TOKEN=182c13e2209161852c53cef53a879f7a2f923430 +OBJECTTYPEN_API_TOKEN=cd63e158f3aca276ef284e3033d020a22899c728 + +SMART_DOCUMENTS_URL=https://example.com/ +SMART_DOCUMENTS_USERNAME=test-user +SMART_DOCUMENTS_PASSWORD=test-password + +VALTIMO_OPENKLANT_SECRET=e09b8bc5-5831-4618-ab28-41411304309d +#org.openapitools.client.baseUrl=${BASEURL} +org.openapitools.client.baseUrl=wdwwer + diff --git a/backend/app/build.gradle b/backend/app/build.gradle index f731534..c7a4669 100644 --- a/backend/app/build.gradle +++ b/backend/app/build.gradle @@ -45,6 +45,8 @@ dependencies { implementation "com.ritense.valtimo:process-document:${valtimoVersion}" implementation "com.ritense.valtimo:plugin:${valtimoVersion}" implementation "com.ritense.valtimo:plugin-valtimo:${valtimoVersion}" + implementation "com.ritense.valtimo:objecten-api-authentication:${valtimoVersion}" + implementation "com.ritense.valtimo:zgw:${valtimoVersion}" implementation "com.ritense.valtimo:web:${valtimoVersion}" implementation "io.github.microutils:kotlin-logging:3.0.5" @@ -55,3 +57,18 @@ dependencies { test { useJUnitPlatform() } + +bootRun { + doFirst { + File f = file(".env.properties") + if (f.isFile()) { + def props = new Properties() + f.withInputStream { props.load(it) } + props.each { key, value -> + environment key.toString(), value.toString() + } + } + } + args("-Peeen=eeen") + args("-Dtwee=twee") +} diff --git a/backend/app/src/main/resources/config/application.yml b/backend/app/src/main/resources/config/application.yml index a6ad729..bcf96bc 100644 --- a/backend/app/src/main/resources/config/application.yml +++ b/backend/app/src/main/resources/config/application.yml @@ -118,3 +118,8 @@ keycloak: resource: valtimo-user-m2m-client credentials: secret: 6ef6ca16-6b86-482a-a3d9-0561704c1db9 + + +plugin: + xential: + baseurl: http://localhost:1080 diff --git a/backend/app/src/main/resources/config/plugin-configurations/app.pluginconfig.json b/backend/app/src/main/resources/config/plugin-configurations/app.pluginconfig.json new file mode 100644 index 0000000..559780e --- /dev/null +++ b/backend/app/src/main/resources/config/plugin-configurations/app.pluginconfig.json @@ -0,0 +1,65 @@ +[ + { + "id": "b609a0a3-886e-4b3d-ae0d-c01effb311ee", + "title": "OpenZaak Authentication", + "pluginDefinitionKey": "openzaak", + "properties": { + "clientId": "${OPEN_ZAAK_CLIENT_ID}", + "clientSecret": "${OPEN_ZAAK_CLIENT_SECRET}" + } + }, + { + "id": "3079d6fe-42e3-4f8f-a9db-52ce2507b7ee", + "title": "Zaken API", + "pluginDefinitionKey": "zakenapi", + "properties": { + "url": "${ZAKEN_API_URL}", + "authenticationPluginConfiguration": "b609a0a3-886e-4b3d-ae0d-c01effb311ee" + } + }, + { + "id": "5474fe57-532a-4050-8d89-32e62ca3e895", + "title": "Documenten API", + "pluginDefinitionKey": "documentenapi", + "properties": { + "url": "${DOCUMENTEN_API_URL}", + "bronorganisatie": "051845623", + "authenticationPluginConfiguration": "b609a0a3-886e-4b3d-ae0d-c01effb311ee", + "apiVersion": "1.4.3" + } + }, + { + "id": "21a006f9-7833-4cdf-a6b7-1927705dd543", + "title": "Objecten API Authentication", + "pluginDefinitionKey": "objecttokenauthentication", + "properties": { + "token": "${OBJECTEN_API_TOKEN}" + } + }, + { + "id": "b6d83348-97e7-4660-bd35-2e5fcc9629b4", + "title": "Objecten API", + "pluginDefinitionKey": "objectenapi", + "properties": { + "url": "${OBJECTEN_API_URL}", + "authenticationPluginConfiguration": "21a006f9-7833-4cdf-a6b7-1927705dd543" + } + }, + { + "id": "acb0687a-075e-4435-923b-e6cb01d4d5db", + "title": "Objecttypen API Authentication", + "pluginDefinitionKey": "objecttokenauthentication", + "properties": { + "token": "${OBJECTTYPEN_API_TOKEN}" + } + }, + { + "id": "4021bb75-18c8-4ca5-8658-b9f9c728bba0", + "title": "Objecttypen API", + "pluginDefinitionKey": "objecttypenapi", + "properties": { + "url": "${OBJECTTYPEN_API_URL}", + "authenticationPluginConfiguration": "acb0687a-075e-4435-923b-e6cb01d4d5db" + } + } +] diff --git a/backend/plugin/build.gradle b/backend/plugin/build.gradle index 857fc45..3003da8 100644 --- a/backend/plugin/build.gradle +++ b/backend/plugin/build.gradle @@ -49,7 +49,10 @@ dependencies { implementation "com.ritense.valtimo:plugin-valtimo:${valtimoVersion}" implementation "com.ritense.valtimo:temporary-resource-storage:${valtimoVersion}" implementation "com.ritense.valtimo:value-resolver:${valtimoVersion}" - + implementation "com.ritense.valtimo:openzaak-plugin-authentication:${valtimoVersion}" + implementation "com.ritense.valtimo:zaken-api:${valtimoVersion}" + implementation "com.ritense.valtimo:documenten-api:${valtimoVersion}" + implementation "com.ritense.valtimo:zgw:${valtimoVersion}" implementation "org.springframework.boot:spring-boot-starter-webflux:${springVersion}" implementation "org.springframework.boot:spring-boot-starter-data-jpa:${springVersion}" @@ -119,7 +122,8 @@ test { useJUnitPlatform() } -java.sourceCompatibility = JavaVersion.VERSION_22 +sourceCompatibility = 21 +targetCompatibility = 21 apply plugin: "com.avast.gradle.docker-compose" diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/autoconfiguration/XentialAutoConfiguration.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/autoconfiguration/XentialAutoConfiguration.kt index cb752a7..a2afdcb 100644 --- a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/autoconfiguration/XentialAutoConfiguration.kt +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/autoconfiguration/XentialAutoConfiguration.kt @@ -16,17 +16,23 @@ package com.ritense.valtimo.xential.autoconfiguration +import com.ritense.documentenapi.client.DocumentenApiClient import com.ritense.plugin.service.PluginService import com.ritense.valtimo.contract.config.LiquibaseMasterChangeLogLocation import com.ritense.valtimo.xential.plugin.XentialPluginFactory import com.ritense.valtimo.xential.repository.XentialTokenRepository import com.ritense.valtimo.xential.service.DocumentGenerationService +import com.ritense.valueresolver.ValueResolverService +import com.ritense.zakenapi.ZaakUrlProvider +import com.ritense.zakenapi.client.ZakenApiClient import com.rotterdam.xential.api.DefaultApi +import org.camunda.bpm.engine.RuntimeService import org.openapitools.client.infrastructure.ApiClient import org.springframework.beans.factory.annotation.Value import org.springframework.boot.autoconfigure.AutoConfiguration import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.context.ApplicationEventPublisher import org.springframework.context.annotation.Bean import org.springframework.data.jpa.repository.config.EnableJpaRepositories import org.springframework.web.reactive.function.client.WebClient @@ -60,21 +66,35 @@ class XentialAutoConfiguration { return DefaultApi() } +// @Value("\${plugin.xential.baseurl: }") baseUrl: String + @Bean @ConditionalOnMissingBean fun apiClient( - @Value("plugin.xential.baseurl") - baseUrl: String, - ) = ApiClient(baseUrl) + ) = ApiClient("http://localhost:1080") @Bean @ConditionalOnMissingBean fun documentGenerationService( defaultApi: DefaultApi, - xentialTokenRepository: XentialTokenRepository + xentialTokenRepository: XentialTokenRepository, + pluginService: PluginService, + documentenApiClient: DocumentenApiClient, + applicationEventPublisher: ApplicationEventPublisher, + zaakUrlProvider: ZaakUrlProvider, + zakenApiClient: ZakenApiClient, + runtimeService: RuntimeService, + valueResolverService: ValueResolverService ) = DocumentGenerationService( defaultApi, xentialTokenRepository, + pluginService, + documentenApiClient, + applicationEventPublisher, + zaakUrlProvider, + zakenApiClient, + runtimeService, + valueResolverService ) } diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/DocumentCreatedMessage.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/DocumentCreatedMessage.kt new file mode 100644 index 0000000..563dcef --- /dev/null +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/DocumentCreatedMessage.kt @@ -0,0 +1,10 @@ +package com.ritense.valtimo.xential.domain + +data class DocumentCreatedMessage( + val taakapplicatie: String, + val gebruiker: String, + val documentCreatieSessieId: String, + val formaat: FileFormat, + val documentkenmerk: String, + val data: String, +) diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/FileFormat.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/FileFormat.kt new file mode 100644 index 0000000..a976592 --- /dev/null +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/FileFormat.kt @@ -0,0 +1,5 @@ +package com.ritense.valtimo.xential.domain + +enum class FileFormat { + WORD, PDF +} diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/GenerateDocumentProperties.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/GenerateDocumentProperties.kt index 606a0e9..67e776f 100644 --- a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/GenerateDocumentProperties.kt +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/GenerateDocumentProperties.kt @@ -1,14 +1,12 @@ package com.ritense.valtimo.xential.domain +import com.ritense.valtimo.xential.plugin.TemplateDataEntry import java.util.UUID data class GenerateDocumentProperties( val templateId: UUID, val fileFormat: FileFormat, val documentId: String, - val templateData: Map + val messageName: String, + val templateData: Array ) - -enum class FileFormat { - WORD, PDF -} diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/XentialToken.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/XentialToken.kt index 2ec93ec..dd9eabd 100644 --- a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/XentialToken.kt +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/XentialToken.kt @@ -15,6 +15,8 @@ data class XentialToken ( val token: UUID, @Column(name = "process_id", nullable = false, updatable = false) val processId: UUID, + @Column(name = "message_name", nullable = false, updatable = false) + val messageName: String, @Column(name = "resume_url", nullable = true, updatable = false) val resumeUrl: URI?, ) diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/TemplateDataEntry.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/TemplateDataEntry.kt new file mode 100644 index 0000000..466ac0f --- /dev/null +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/TemplateDataEntry.kt @@ -0,0 +1,6 @@ +package com.ritense.valtimo.xential.plugin + +data class TemplateDataEntry( + val key: String, + val value: String, +) diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/XentialPlugin.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/XentialPlugin.kt index df2e19d..5b34cb2 100644 --- a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/XentialPlugin.kt +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/plugin/XentialPlugin.kt @@ -16,21 +16,22 @@ package com.ritense.valtimo.xential.plugin +import com.ritense.documentenapi.DocumentenApiPlugin import com.ritense.plugin.annotation.Plugin import com.ritense.plugin.annotation.PluginAction +import com.ritense.plugin.annotation.PluginActionProperty import com.ritense.plugin.annotation.PluginProperty import com.ritense.processlink.domain.ActivityTypeWithEventName +import com.ritense.valtimo.xential.domain.FileFormat import com.ritense.valtimo.xential.domain.GenerateDocumentProperties -import com.ritense.valtimo.xential.domain.XentialToken -import com.ritense.valtimo.xential.repository.XentialTokenRepository +import com.ritense.valtimo.xential.plugin.XentialPlugin.Companion.PLUGIN_KEY import com.ritense.valtimo.xential.service.DocumentGenerationService -import com.rotterdam.xential.api.DefaultApi -import com.rotterdam.xential.model.Sjabloondata +import com.ritense.zakenapi.ZakenApiPlugin import org.camunda.bpm.engine.delegate.DelegateExecution import java.util.UUID @Plugin( - key = "xential", + key = PLUGIN_KEY, title = "Xential Plugin", description = "" ) @@ -44,19 +45,45 @@ class XentialPlugin( @PluginProperty(key = "clientPassword", secret = true) private lateinit var clientPassword: String + @PluginProperty(key = "documentenApiPluginConfiguration", secret = false) + lateinit var documentenApiPluginConfiguration: DocumentenApiPlugin + + @PluginProperty(key = "zakenApiPluginConfiguration", secret = false) + lateinit var zakenApiPluginConfiguration: ZakenApiPlugin + + @PluginAction( key = "generate-document", title = "Generate document", description = "Generate a document using xential.", activityTypes = [ActivityTypeWithEventName.SERVICE_TASK_START] ) - fun generateDocument(execution: DelegateExecution, generateDocumentProperties: GenerateDocumentProperties) { + fun generateDocument( + @PluginActionProperty templateId: UUID, + @PluginActionProperty fileFormat: FileFormat, + @PluginActionProperty documentId: String, + @PluginActionProperty messageName: String, + @PluginActionProperty templateData: Array, + execution: DelegateExecution + ) { + val generateDocumentProperties = GenerateDocumentProperties( + templateId, + fileFormat, + documentId, + messageName, + templateData + ) documentGenerationService.generateDocument( UUID.fromString(execution.processInstanceId), generateDocumentProperties, clientId, - clientPassword + clientPassword, + execution ) } + companion object { + const val PLUGIN_KEY = "xential" + } + } diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationService.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationService.kt index bc987a3..505b3b3 100644 --- a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationService.kt +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationService.kt @@ -1,16 +1,41 @@ package com.ritense.valtimo.xential.service +import com.ritense.documentenapi.client.CreateDocumentRequest +import com.ritense.documentenapi.client.DocumentStatusType +import com.ritense.documentenapi.client.DocumentenApiClient +import com.ritense.documentenapi.event.DocumentCreated +import com.ritense.plugin.service.PluginService +import com.ritense.valtimo.xential.domain.DocumentCreatedMessage import com.ritense.valtimo.xential.domain.GenerateDocumentProperties import com.ritense.valtimo.xential.domain.XentialToken +import com.ritense.valtimo.xential.plugin.TemplateDataEntry +import com.ritense.valtimo.xential.plugin.XentialPlugin import com.ritense.valtimo.xential.repository.XentialTokenRepository +import com.ritense.valueresolver.ValueResolverService +import com.ritense.zakenapi.ZaakUrlProvider +import com.ritense.zakenapi.client.LinkDocumentRequest +import com.ritense.zakenapi.client.ZakenApiClient import com.rotterdam.xential.api.DefaultApi import com.rotterdam.xential.model.Sjabloondata +import org.camunda.bpm.engine.RuntimeService +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openapitools.client.infrastructure.ApiClient +import org.springframework.context.ApplicationEventPublisher +import java.io.ByteArrayInputStream +import java.time.LocalDate +import java.util.Base64 import java.util.UUID class DocumentGenerationService( val defaultApi: DefaultApi, val xentialTokenRepository: XentialTokenRepository, + val pluginService: PluginService, + val documentenApiClient: DocumentenApiClient, + val applicationEventPublisher: ApplicationEventPublisher, + val zaakUrlProvider: ZaakUrlProvider, + val zakenApiClient: ZakenApiClient, + val runtimeService: RuntimeService, + val valueResolverService: ValueResolverService ) { fun generateDocument( @@ -18,8 +43,11 @@ class DocumentGenerationService( generateDocumentProperties: GenerateDocumentProperties, clientId: String, clientPassword: String, + execution: DelegateExecution, ) { - val sjabloonVulData = generateDocumentProperties.templateData.entries.map { "<${it.key}>${it.value}" }.joinToString() + + val resolvedMap = resolveTemplateData(generateDocumentProperties.templateData,execution) + val sjabloonVulData = resolvedMap.map { "<${it.key}>${it.value}" }.joinToString() ApiClient.username = clientId ApiClient.password = clientPassword @@ -37,9 +65,90 @@ class DocumentGenerationService( val xentialToken = XentialToken( token = UUID.fromString(result.documentCreatieSessieId), processId = processId, + messageName = generateDocumentProperties.messageName, resumeUrl = result.resumeUrl ) xentialTokenRepository.save(xentialToken) } + + fun onDocumentGenerated(message: DocumentCreatedMessage) { + val plugin = getXentialPlugin(message) + val documentenApiPlugin = plugin.documentenApiPluginConfiguration + val zakenApiPlugin = plugin.zakenApiPluginConfiguration + + val bytes = Base64.getDecoder().decode(message.data) + + val xentialToken = xentialTokenRepository.findById(UUID.fromString(message.documentCreatieSessieId)) + .orElseThrow { NoSuchElementException("Could not find Xential Token ${message.documentCreatieSessieId}") } + + ByteArrayInputStream(bytes).use { inputStream -> + val createDocumentRequest = CreateDocumentRequest( + bronorganisatie = documentenApiPlugin.bronorganisatie, + creatiedatum = LocalDate.now(), + titel = message.documentkenmerk, + vertrouwelijkheidaanduiding = null, + auteur = message.gebruiker, + status = DocumentStatusType.DEFINITIEF, + taal = "nld", + bestandsnaam = message.documentkenmerk, + bestandsomvang = bytes.size.toLong(), + inhoud = inputStream, + beschrijving = "", + ontvangstdatum = LocalDate.now(), + verzenddatum = LocalDate.now(), + informatieobjecttype = null, + formaat = message.formaat.name, + ) + + val documentCreateResult = documentenApiClient.storeDocument( + documentenApiPlugin.authenticationPluginConfiguration, + documentenApiPlugin.url, + createDocumentRequest + ) + val event = DocumentCreated( + documentCreateResult.url, + documentCreateResult.auteur, + documentCreateResult.bestandsnaam, + documentCreateResult.bestandsomvang, + documentCreateResult.beginRegistratie + ) + applicationEventPublisher.publishEvent(event) + + val zaakUrl = zaakUrlProvider.getZaakUrl(xentialToken.processId) + zakenApiClient.linkDocument( + zakenApiPlugin.authenticationPluginConfiguration, + zakenApiPlugin.url, + LinkDocumentRequest( + documentCreateResult.url, + zaakUrl.toString(), + message.documentkenmerk, + "" + ) + ) + + runtimeService.createMessageCorrelation(xentialToken.messageName) + .processInstanceId(xentialToken.processId.toString()) + .correlate() + } + } + + private fun resolveTemplateData( + templateData: Array, + execution: DelegateExecution + ): Map { + val placeHolderValueMap = valueResolverService.resolveValues( + execution.processInstanceId, + execution, + templateData.map { it.value }.toList() + ) + return templateData.associate { it.key to placeHolderValueMap.getOrDefault(it.value, null) } + } + + private fun getXentialPlugin(message: DocumentCreatedMessage): XentialPlugin { + //FIXME needs a way of determining the right plugin + val pluginConfig = pluginService.findPluginConfiguration(XentialPlugin.PLUGIN_KEY) { _ -> true} + ?: throw NoSuchElementException("Could not find Xential plugin") + return pluginService.createInstance(pluginConfig) as XentialPlugin + } } diff --git a/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/web/rest/DocumentResource.kt b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/web/rest/DocumentResource.kt new file mode 100644 index 0000000..e2ad871 --- /dev/null +++ b/backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/web/rest/DocumentResource.kt @@ -0,0 +1,31 @@ +package com.ritense.valtimo.xential.web.rest + +import com.fasterxml.jackson.databind.JsonNode +import com.ritense.valtimo.contract.annotation.SkipComponentScan +import com.ritense.valtimo.contract.domain.ValtimoMediaType +import com.ritense.valtimo.xential.domain.DocumentCreatedMessage +import com.ritense.valtimo.xential.service.DocumentGenerationService +import org.springframework.http.ResponseEntity +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.RestController +import java.util.UUID + +@RestController +@SkipComponentScan +@RequestMapping("/api/xential", produces = [ValtimoMediaType.APPLICATION_JSON_UTF8_VALUE]) +class DocumentResource( + val documentGenerationService: DocumentGenerationService +) { + + @PostMapping("/v1/document") + fun handleSubmission( + @RequestBody message: DocumentCreatedMessage + ) { + documentGenerationService.onDocumentGenerated(message) + } + +} diff --git a/backend/plugin/src/main/resources/config/bpmn/xential-test.bpmn b/backend/plugin/src/main/resources/config/bpmn/xential-test.bpmn new file mode 100644 index 0000000..7c9d5fd --- /dev/null +++ b/backend/plugin/src/main/resources/config/bpmn/xential-test.bpmn @@ -0,0 +1,66 @@ + + + + + + + + + Flow_1iic9b3 + + + Flow_12ouxh8 + + + Flow_0z4j34w + Flow_12ouxh8 + + + + Flow_1iic9b3 + Flow_0z4j34w + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/plugin/src/main/resources/config/case/definition/xential-test.json b/backend/plugin/src/main/resources/config/case/definition/xential-test.json new file mode 100644 index 0000000..fedda40 --- /dev/null +++ b/backend/plugin/src/main/resources/config/case/definition/xential-test.json @@ -0,0 +1,3 @@ +{ + "canHaveAssignee": true +} \ No newline at end of file diff --git a/backend/plugin/src/main/resources/config/case/list/xential-test.json b/backend/plugin/src/main/resources/config/case/list/xential-test.json new file mode 100644 index 0000000..b0efa81 --- /dev/null +++ b/backend/plugin/src/main/resources/config/case/list/xential-test.json @@ -0,0 +1,52 @@ +[ + { + "title": "", + "key": "zaaknummer", + "path": "doc:openzaak.identificatie", + "displayType": { + "type": "string", + "displayTypeParameters": {} + }, + "sortable": true, + "defaultSort": null, + "order": 0 + }, + { + "title": "", + "key": "createdOn", + "path": "case:createdOn", + "displayType": { + "type": "date", + "displayTypeParameters": { + "dateFormat": "DD-MM-yyyy" + } + }, + "sortable": true, + "defaultSort": "DESC", + "order": 1 + }, + { + "title": "", + "key": "assigneeFullName", + "path": "case:assigneeFullName", + "displayType": { + "type": "string", + "displayTypeParameters": {} + }, + "sortable": true, + "defaultSort": null, + "order": 2 + }, + { + "title": "", + "key": "zaakstatus", + "path": "doc:openzaak.statusOmschrijving", + "displayType": { + "type": "string", + "displayTypeParameters": {} + }, + "sortable": true, + "defaultSort": null, + "order": 3 + } +] diff --git a/backend/plugin/src/main/resources/config/document/definition/reference/adres-v1.schema.json b/backend/plugin/src/main/resources/config/document/definition/reference/adres-v1.schema.json new file mode 100644 index 0000000..d8bcb38 --- /dev/null +++ b/backend/plugin/src/main/resources/config/document/definition/reference/adres-v1.schema.json @@ -0,0 +1,37 @@ +{ + "$id": "adres.schema", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Adres definition", + "definitions": { + "adres": { + "type": "object", + "properties": { + "straatnaam": { + "type": "string" + }, + "huisnummer": { + "type": "number" + }, + "huisletter": { + "type": "string" + }, + "huisnummertoevoeging": { + "type": "string" + }, + "postcode": { + "type": "string" + }, + "woonplaatsnaam": { + "type": "string" + }, + "aanduidingBijHuisnummer": { + "type": "string" + }, + "locatieomschrijving": { + "type": "string" + } + } + } + } +} + diff --git a/backend/plugin/src/main/resources/config/document/definition/reference/person-v1.schema.json b/backend/plugin/src/main/resources/config/document/definition/reference/person-v1.schema.json new file mode 100644 index 0000000..21af106 --- /dev/null +++ b/backend/plugin/src/main/resources/config/document/definition/reference/person-v1.schema.json @@ -0,0 +1,1003 @@ +{ + "$id": "person.schema", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Person", + "definitions": { + "person": { + "type": "object", + "properties": { + "voorletters": { + "type": "string" + }, + "voornamen": { + "type": "string" + }, + "voorvoegsel": { + "type": "string" + }, + "achternaam": { + "type": "string" + }, + "volledigeNaam": { + "type": "string" + }, + "geboortedatum": { + "type": "string" + }, + "communicatievoorkeur": { + "type": "string", + "enum": [ + "portaal", + "post" + ] + }, + "bsn": { + "$ref": "#/bsn" + }, + "contactgegevens": { + "type": "object", + "properties": { + "email": { + "$ref": "#/eMail" + }, + "telefoon": { + "type": "string" + } + }, + "additionalProperties": false + }, + "adresBrp": { + "$ref": "adres-v1.schema.json#/definitions/adres" + }, + "postadresBrp": { + "$ref": "adres-v1.schema.json#/definitions/adres" + }, + "verblijfadres": { + "$ref": "adres-v1.schema.json#/definitions/adres" + }, + "nationaliteiten": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/cdNationaliteit" + } + }, + "nationaliteitOfVerblijfsstatus": { + "type": "string", + "enum": [ + "NEDERLANDSE_NATIONALITEIT", + "EU_ONDERDAAN", + "GELDIGE_VERBLIJFSVERGUNNING", + "GEEN_VERBLIJFSVERGUNNING", + "VERLOPEN_VERBLIJFSVERGUNNING" + ] + }, + "actiesVerblijfstatus": { + "type": "string", + "enum": [ + "VERLENGING_VERBLIJFSDOCUMENT_AANGEVRAAGD", + "BEZWAAR_AFWIJZING", + "GEEN" + ] + }, + "kinderen": { + "type": "array", + "items": { + "type": "string" + } + }, + "partner": { + "type": "string" + }, + "datumOverlijden": { + "type": "string" + }, + "verblijfstitel": { + "$ref": "#/verblijfstitel" + } + } + } + }, + "guid": { + "type": "string", + "pattern": "^(\\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\\}{0,1})$" + }, + "bsn": { + "type": "string", + "pattern": "^[0-9]{9}$" + }, + "eMail": { + "type": "string", + "pattern": "^[A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)*@[A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)*[.][A-Za-z0-9]+$" + }, + "verblijfstitel": { + "type": "object", + "properties": { + "verblijfstitelId": { + "description": "Uniek nummer toegekend door het systeem, zodat een verblijfstitel kan wroden geidentificeerd.", + "$ref": "#/guid" + }, + "codeVerblijfstitel": { + "description": "

Code die een aanduiding geeft van de juridische grondslag op basis waarvan een persoon als bedoeld in de Vreemdelingenwet in Nederland verblijft.


Bron: SGR 16.0, gebaseerd op NEN 1888:2002 - Verblijfstitel.

Tabel 56 - Verblijfstiteltabel (RVIG landelijke tabellen).


Opmerking :

", + "type": "object" + }, + "datumAanvangVerblijfstitel": { + "description": "

De datum van de eerste dag waarop de VERBLIJFSTITEL van toepassing is.


Norminstantie: UGR

", + "type": "string" + }, + "datumEindeVerblijfstitel": { + "description": "

De datum van de laatste dag waarop de VERBLIJFSTITEL van toepassing is.


Norminstantie: UGR

", + "type": "string" + } + } + }, + "cdNationaliteit": { + "type": "object", + "enum": [ + { + "code": "0", + "name": "Onbekend" + }, + { + "code": "1", + "name": "Nederlandse" + }, + { + "code": "2", + "name": "Behandeld als Nederlander" + }, + { + "code": "27", + "name": "Slowaakse" + }, + { + "code": "28", + "name": "Tsjechische" + }, + { + "code": "29", + "name": "Burger van Bosnië-Herzegovina" + }, + { + "code": "30", + "name": "Georgische" + }, + { + "code": "31", + "name": "Turkmeense" + }, + { + "code": "32", + "name": "Tadzjiekse" + }, + { + "code": "33", + "name": "Oezbeekse" + }, + { + "code": "34", + "name": "Oekraïense" + }, + { + "code": "35", + "name": "Kirgizische" + }, + { + "code": "36", + "name": "Moldavische" + }, + { + "code": "37", + "name": "Kazachse" + }, + { + "code": "38", + "name": "Belarussische" + }, + { + "code": "39", + "name": "Azerbeidzjaanse" + }, + { + "code": "40", + "name": "Armeense" + }, + { + "code": "41", + "name": "Russische" + }, + { + "code": "42", + "name": "Sloveense" + }, + { + "code": "43", + "name": "Kroatische" + }, + { + "code": "44", + "name": "Letse" + }, + { + "code": "45", + "name": "Estische" + }, + { + "code": "46", + "name": "Litouwse" + }, + { + "code": "47", + "name": "Marshalleilandse" + }, + { + "code": "48", + "name": "Myanmarese" + }, + { + "code": "49", + "name": "Namibische" + }, + { + "code": "50", + "name": "Albanese" + }, + { + "code": "51", + "name": "Andorrese" + }, + { + "code": "52", + "name": "Belgische" + }, + { + "code": "53", + "name": "Bulgaarse" + }, + { + "code": "54", + "name": "Deense" + }, + { + "code": "55", + "name": "Burger van de Bondsrepubliek Duitsland" + }, + { + "code": "56", + "name": "Finse" + }, + { + "code": "57", + "name": "Franse" + }, + { + "code": "58", + "name": "Jemenitische" + }, + { + "code": "59", + "name": "Griekse" + }, + { + "code": "60", + "name": "Brits burger" + }, + { + "code": "61", + "name": "Hongaarse" + }, + { + "code": "62", + "name": "Ierse" + }, + { + "code": "63", + "name": "IJslandse" + }, + { + "code": "64", + "name": "Italiaanse" + }, + { + "code": "65", + "name": "Joegoslavische" + }, + { + "code": "66", + "name": "Liechtensteinse" + }, + { + "code": "67", + "name": "Luxemburgse" + }, + { + "code": "68", + "name": "Maltese" + }, + { + "code": "69", + "name": "Monegaskische" + }, + { + "code": "70", + "name": "Noorse" + }, + { + "code": "71", + "name": "Oostenrijkse" + }, + { + "code": "72", + "name": "Poolse" + }, + { + "code": "73", + "name": "Portugese" + }, + { + "code": "74", + "name": "Roemeense" + }, + { + "code": "75", + "name": "Burger van de Sovjet-Unie" + }, + { + "code": "76", + "name": "San Marinese" + }, + { + "code": "77", + "name": "Spaanse" + }, + { + "code": "78", + "name": "Tsjecho-Slowaakse" + }, + { + "code": "79", + "name": "Vaticaanse" + }, + { + "code": "80", + "name": "Zweedse" + }, + { + "code": "81", + "name": "Zwitserse" + }, + { + "code": "82", + "name": "Oost-Duitse" + }, + { + "code": "83", + "name": "Brits onderdaan" + }, + { + "code": "84", + "name": "Eritrese" + }, + { + "code": "85", + "name": "Brits overzees burger" + }, + { + "code": "86", + "name": "Macedonische" + }, + { + "code": "87", + "name": "Kosovaarse" + }, + { + "code": "100", + "name": "Algerijnse" + }, + { + "code": "101", + "name": "Angolese" + }, + { + "code": "104", + "name": "Burundese" + }, + { + "code": "105", + "name": "Botswaanse" + }, + { + "code": "106", + "name": "Burkinese" + }, + { + "code": "108", + "name": "Centraal-Afrikaanse" + }, + { + "code": "109", + "name": "Comorese" + }, + { + "code": "110", + "name": "Burger van Congo" + }, + { + "code": "111", + "name": "Beninse" + }, + { + "code": "112", + "name": "Egyptische" + }, + { + "code": "113", + "name": "Equatoriaal-Guinese" + }, + { + "code": "114", + "name": "Ethiopische" + }, + { + "code": "115", + "name": "Djiboutiaanse" + }, + { + "code": "116", + "name": "Gabonese" + }, + { + "code": "117", + "name": "Gambiaanse" + }, + { + "code": "118", + "name": "Ghanese" + }, + { + "code": "119", + "name": "Guinese" + }, + { + "code": "120", + "name": "Ivoriaanse" + }, + { + "code": "121", + "name": "Kaapverdische" + }, + { + "code": "122", + "name": "Kameroense" + }, + { + "code": "123", + "name": "Kenyaanse" + }, + { + "code": "124", + "name": "Za�rese" + }, + { + "code": "125", + "name": "Lesothaanse" + }, + { + "code": "126", + "name": "Liberiaanse" + }, + { + "code": "127", + "name": "Libische" + }, + { + "code": "128", + "name": "Malagassische" + }, + { + "code": "129", + "name": "Malawische" + }, + { + "code": "130", + "name": "Malinese" + }, + { + "code": "131", + "name": "Marokkaanse" + }, + { + "code": "132", + "name": "Mauritaanse" + }, + { + "code": "133", + "name": "Mauritiaanse" + }, + { + "code": "134", + "name": "Mozambikaanse" + }, + { + "code": "135", + "name": "Swazische" + }, + { + "code": "136", + "name": "Nigerese" + }, + { + "code": "137", + "name": "Nigeriaanse" + }, + { + "code": "138", + "name": "Ugandese" + }, + { + "code": "139", + "name": "Guinee-Bissause" + }, + { + "code": "140", + "name": "Zuid-Afrikaanse" + }, + { + "code": "142", + "name": "Zimbabwaanse" + }, + { + "code": "143", + "name": "Rwandese" + }, + { + "code": "144", + "name": "Burger van Sáo Tomé en Principe" + }, + { + "code": "145", + "name": "Senegalese" + }, + { + "code": "147", + "name": "Sierra Leoonse" + }, + { + "code": "148", + "name": "Soedanese" + }, + { + "code": "149", + "name": "Somalische" + }, + { + "code": "151", + "name": "Tanzaniaanse" + }, + { + "code": "152", + "name": "Togolese" + }, + { + "code": "154", + "name": "Tsjadische" + }, + { + "code": "155", + "name": "Tunesische" + }, + { + "code": "156", + "name": "Zambiaanse" + }, + { + "code": "157", + "name": "Zuid-Soedanese" + }, + { + "code": "200", + "name": "Bahamaanse" + }, + { + "code": "202", + "name": "Belizaanse" + }, + { + "code": "204", + "name": "Canadese" + }, + { + "code": "205", + "name": "Costa Ricaanse" + }, + { + "code": "206", + "name": "Cubaanse" + }, + { + "code": "207", + "name": "Dominicaanse" + }, + { + "code": "208", + "name": "Salvadoraanse" + }, + { + "code": "211", + "name": "Guatemalaanse" + }, + { + "code": "212", + "name": "Haïtiaanse" + }, + { + "code": "213", + "name": "Hondurese" + }, + { + "code": "214", + "name": "Jamaicaanse" + }, + { + "code": "216", + "name": "Mexicaanse" + }, + { + "code": "218", + "name": "Nicaraguaanse" + }, + { + "code": "219", + "name": "Panamese" + }, + { + "code": "222", + "name": "Burger van Trinidad en Tobago" + }, + { + "code": "223", + "name": "Amerikaans burger" + }, + { + "code": "250", + "name": "Argentijnse" + }, + { + "code": "251", + "name": "Barbadaanse" + }, + { + "code": "252", + "name": "Boliviaanse" + }, + { + "code": "253", + "name": "Braziliaanse" + }, + { + "code": "254", + "name": "Chileense" + }, + { + "code": "255", + "name": "Colombiaanse" + }, + { + "code": "256", + "name": "Ecuadoraanse" + }, + { + "code": "259", + "name": "Guyaanse" + }, + { + "code": "261", + "name": "Paraguayaanse" + }, + { + "code": "262", + "name": "Peruaanse" + }, + { + "code": "263", + "name": "Surinaamse" + }, + { + "code": "264", + "name": "Uruguayaanse" + }, + { + "code": "265", + "name": "Venezolaanse" + }, + { + "code": "267", + "name": "Grenadaanse" + }, + { + "code": "268", + "name": "Burger van Saint Kitts en Nevis" + }, + { + "code": "300", + "name": "Afghaanse" + }, + { + "code": "301", + "name": "Bahreinse" + }, + { + "code": "302", + "name": "Bhutaanse" + }, + { + "code": "303", + "name": "Burmaanse" + }, + { + "code": "304", + "name": "Bruneise" + }, + { + "code": "305", + "name": "Cambodjaanse" + }, + { + "code": "306", + "name": "Sri Lankaanse" + }, + { + "code": "307", + "name": "Chinese" + }, + { + "code": "308", + "name": "Cyprische" + }, + { + "code": "309", + "name": "Filipijnse" + }, + { + "code": "310", + "name": "Taiwanese" + }, + { + "code": "312", + "name": "Indiase" + }, + { + "code": "313", + "name": "Indonesische" + }, + { + "code": "314", + "name": "Iraakse" + }, + { + "code": "315", + "name": "Iraanse" + }, + { + "code": "316", + "name": "Isra�lische" + }, + { + "code": "317", + "name": "Japanse" + }, + { + "code": "318", + "name": "Noord-Jemenitische" + }, + { + "code": "319", + "name": "Jordaanse" + }, + { + "code": "320", + "name": "Koeweitse" + }, + { + "code": "321", + "name": "Laotiaanse" + }, + { + "code": "322", + "name": "Libanese" + }, + { + "code": "324", + "name": "Maldivische" + }, + { + "code": "325", + "name": "Maleisische" + }, + { + "code": "326", + "name": "Mongolische" + }, + { + "code": "327", + "name": "Omaanse" + }, + { + "code": "328", + "name": "Nepalese" + }, + { + "code": "329", + "name": "Noord-Koreaanse" + }, + { + "code": "331", + "name": "Pakistaanse" + }, + { + "code": "333", + "name": "Qatarese" + }, + { + "code": "334", + "name": "Saoedi-Arabische" + }, + { + "code": "335", + "name": "Singaporese" + }, + { + "code": "336", + "name": "Syrische" + }, + { + "code": "337", + "name": "Thaise" + }, + { + "code": "338", + "name": "Burger van de Verenigde Arabische Emiraten" + }, + { + "code": "339", + "name": "Turkse" + }, + { + "code": "340", + "name": "Zuid-Jemenitische" + }, + { + "code": "341", + "name": "Zuid-Koreaanse" + }, + { + "code": "342", + "name": "Vietnamese" + }, + { + "code": "345", + "name": "Bengalese" + }, + { + "code": "400", + "name": "Australische" + }, + { + "code": "401", + "name": "Papoea-Nieuw-Guinese" + }, + { + "code": "402", + "name": "Nieuw-Zeelandse" + }, + { + "code": "404", + "name": "West-Samoaanse" + }, + { + "code": "405", + "name": "Samoaanse" + }, + { + "code": "421", + "name": "Burger van Antigua en Barbuda" + }, + { + "code": "424", + "name": "Vanuatuaanse" + }, + { + "code": "425", + "name": "Fijische" + }, + { + "code": "429", + "name": "Burger van Britse afhankelijke gebieden" + }, + { + "code": "430", + "name": "Tongaanse" + }, + { + "code": "431", + "name": "Nauruaanse" + }, + { + "code": "432", + "name": "Palause" + }, + { + "code": "437", + "name": "Amerikaans onderdaan" + }, + { + "code": "442", + "name": "Salomonseilandse" + }, + { + "code": "443", + "name": "Micronesische" + }, + { + "code": "444", + "name": "Seychelse" + }, + { + "code": "445", + "name": "Kiribatische" + }, + { + "code": "446", + "name": "Tuvaluaanse" + }, + { + "code": "447", + "name": "Saint Luciaanse" + }, + { + "code": "448", + "name": "Burger van Dominica" + }, + { + "code": "449", + "name": "Burger van Saint Vincent en de Grenadines" + }, + { + "code": "450", + "name": "British National (overseas)" + }, + { + "code": "451", + "name": "Burger van Democratische Republiek Congo" + }, + { + "code": "452", + "name": "Burger van Timor Leste" + }, + { + "code": "453", + "name": "Burger van Servië en Montenegro" + }, + { + "code": "454", + "name": "Servische" + }, + { + "code": "455", + "name": "Montenegrijnse" + }, + { + "code": "499", + "name": "Staatloos" + }, + { + "code": "500", + "name": "Vastgesteld niet-Nederlander" + }, + { + "code": "86", + "name": "Burger van de Republiek Noord-Macedonië" + } + ] + } +} \ No newline at end of file diff --git a/backend/plugin/src/main/resources/config/document/definition/xential-test.schema.json b/backend/plugin/src/main/resources/config/document/definition/xential-test.schema.json new file mode 100644 index 0000000..6032565 --- /dev/null +++ b/backend/plugin/src/main/resources/config/document/definition/xential-test.schema.json @@ -0,0 +1,9 @@ +{ + "$id": "xential-test.schema", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Xential Test", + "type": "object", + "properties": {}, + "additionalProperties": false, + "definitions": {} +} diff --git a/backend/plugin/src/main/resources/config/form/xential-test.start.json b/backend/plugin/src/main/resources/config/form/xential-test.start.json new file mode 100644 index 0000000..ab1f42b --- /dev/null +++ b/backend/plugin/src/main/resources/config/form/xential-test.start.json @@ -0,0 +1,22 @@ +{ + "components": [ + { + "label": "HTML", + "content": "

Xential test

", + "refreshOnChange": false, + "key": "html", + "type": "htmlelement", + "input": false, + "tableView": false + }, + { + "type": "button", + "label": "Indienen", + "showValidations": false, + "disableOnInvalid": true, + "tableView": false, + "key": "submit", + "input": true + } + ] +} diff --git a/backend/plugin/src/main/resources/config/form/xential-test.summary.json b/backend/plugin/src/main/resources/config/form/xential-test.summary.json new file mode 100644 index 0000000..4ac066f --- /dev/null +++ b/backend/plugin/src/main/resources/config/form/xential-test.summary.json @@ -0,0 +1,98 @@ +{ + "display": "form", + "components": [ + { + "label": "Columns", + "columns": [ + { + "components": [ + { + "tableView": false, + "key": "openzaak", + "type": "container", + "input": true, + "components": [ + { + "label": "HTML", + "content": "

OpenZaak informatie

\n
\n
\n
OpenZaak ID
\n
{{{ data.openzaak.identificatie || '-'}}}
\n
\n
\n
Zaakstatus
\n
{{{ data.openzaak.statusOmschrijving || '-'}}}
\n
\n
\n
Zaakresultaat
\n
{{{ data.openzaak.resultaatOmschrijving || '-' }}}
\n
\n
", + "tableView": false, + "tag": "div", + "customClass": "no-border-around-formio-container", + "key": "html", + "type": "htmlelement", + "input": true + } + ], + "label": "Container" + } + ], + "width": 6, + "offset": 0, + "push": 0, + "pull": 0, + "size": "md", + "currentWidth": 6 + }, + { + "components": [ + { + "tableView": false, + "key": "gegevens", + "type": "container", + "input": true, + "components": [ + { + "label": "HTML", + "content": "

Aanmelder

\n
\n
\n
Naam
\n
{{{\n (\n data.aanmelder?.gegevensAanmelder?.persoonsgegevens?.voornaam + ' ' + data.aanmelder?.gegevensAanmelder?.persoonsgegevens?.voorvoegsels +\n ( data.aanmelder?.gegevensAanmelder?.persoonsgegevens?.voorvoegsels != '' ? ' ' : '' ) +\n data.aanmelder?.gegevensAanmelder?.persoonsgegevens?.achternaam\n )\n }}}\n
\n
\n
\n
In dienst van de Gemeente Den Haag?
\n
{{{ data.aanmelder?.inDienstBijGemeente ? _.upperFirst((data.aanmelder?.inDienstBijGemeente)?.toLowerCase()) : '-' }}}
\n
\n
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' ? 'Werkzaam bij dienst' : '' }}
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' ? (data.aanmelder?.welkeDienst || '-') : '' }}
\n
\n
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' && data.aanmelder?.welkeDienst === 'ANDERS' ? 'Toelichting' : '' }}
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' && data.aanmelder?.welkeDienst === 'ANDERS' ? (data.aanmelder?.dienstToelichting || '-') : '' }}
\n
\n
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' ? 'Afdeling' : '' }}
\n
{{ data.aanmelder?.inDienstBijGemeente === 'JA' ? (data.aanmelder?.welkeAfdeling || '-') : '' }}
\n
\n
\n
{{ data.aanmelder?.inDienstBijGemeente === 'NEE' ? 'Werkzaam voor organisatie' : '' }}
\n
{{ data.aanmelder?.inDienstBijGemeente === 'NEE' ? (data.aanmelder?.welkeOrganisatie || '-') : '' }}
\n
\n
\n
Functie
\n
{{{ data.aanmelder?.functie || '-' }}}\n
\n
\n
\n
Telefoonnummer
\n
{{{ data.aanmelder?.gegevensAanmelder?.contactgegevens?.telefoonnummer || '-' }}}\n
\n
\n
\n
E-mailadres
\n
{{{ data.aanmelder?.gegevensAanmelder?.contactgegevens?.emailadres || '-' }}}\n
\n
\n
", + "tableView": false, + "tag": "div", + "customClass": "no-border-around-formio-container", + "key": "html", + "type": "htmlelement", + "input": true + } + ], + "label": "Container" + } + ], + "width": 6, + "offset": 0, + "push": 0, + "pull": 0, + "size": "md", + "currentWidth": 6 + } + ], + "key": "columns", + "type": "columns", + "input": false, + "tableView": false + }, + { + "tableView": false, + "key": "casus", + "type": "container", + "input": true, + "components": [ + { + "label": "HTML", + "tag": "div", + "attrs": [ + { + "attr": "", + "value": "" + } + ], + "content": "

Casus

\n
\n
\n
Stadsdeel inwoner
\n
{{{ data.inwoner.stadsdeel || '-'}}}
\n
\n
\n
Situatie van de inwoner
\n
\n {{{ (data.inwoner.watIsDeSituatie && data.inwoner.watIsDeSituatie.length > 500)\n ? data.inwoner.watIsDeSituatie.substring(0, 1000) + '...'\n : (data.inwoner.watIsDeSituatie || '-') }}}\n
\n
\n
\n
Waar loopt de inwoner tegenaan?
\n
\n {{{ (data.inwoner.waarLooptUTegenaan && data.inwoner.waarLooptUTegenaan.length > 500)\n ? data.inwoner.waarLooptUTegenaan.substring(0, 500) + '...'\n : (data.inwoner.waarLooptUTegenaan || '-') }}}\n
\n
\n
\n
Vraag aan Doorbraaklab
\n
\n {{{ (data.inwoner.vraagAanDoorbraaklab && data.inwoner.vraagAanDoorbraaklab.length > 500)\n ? data.inwoner.vraagAanDoorbraaklab.substring(0, 500) + '...'\n : (data.inwoner.vraagAanDoorbraaklab || '-') }}}\n
\n
\n
", + "refreshOnChange": false, + "customClass": "no-border-around-formio-container", + "key": "html", + "type": "htmlelement", + "tableView": false, + "input": true + } + ], + "label": "Container" + } + ] +} diff --git a/backend/plugin/src/main/resources/config/liquibase/changelog/20241010-add-xential_tokens.xml b/backend/plugin/src/main/resources/config/liquibase/changelog/20241010-add-xential_tokens.xml index 0b9992f..1c6e952 100644 --- a/backend/plugin/src/main/resources/config/liquibase/changelog/20241010-add-xential_tokens.xml +++ b/backend/plugin/src/main/resources/config/liquibase/changelog/20241010-add-xential_tokens.xml @@ -26,6 +26,7 @@ + diff --git a/backend/plugin/src/main/resources/config/pbac/all.permission.json b/backend/plugin/src/main/resources/config/pbac/all.permission.json new file mode 100644 index 0000000..7ccad29 --- /dev/null +++ b/backend/plugin/src/main/resources/config/pbac/all.permission.json @@ -0,0 +1,125 @@ +{ + "changesetId": "permissions-v1", + "permissions": [ + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaExecution", + "action": "create", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.case.domain.CaseTab", + "action": "view", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "view", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "view_list", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "create", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "modify", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "delete", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "claim", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "assignable", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument", + "action": "assign", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition", + "action": "delete", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition", + "action": "view_list", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition", + "action": "create", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition", + "action": "modify", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition", + "action": "view", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.searchfield.SearchField", + "action": "view_list", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.snapshot.JsonSchemaDocumentSnapshot", + "action": "view", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.document.domain.impl.snapshot.JsonSchemaDocumentSnapshot", + "action": "view_list", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "assign", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "assignable", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "claim", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "complete", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "view_list", + "roleKey": "ROLE_ADMIN" + }, + { + "resourceType": "com.ritense.valtimo.camunda.domain.CamundaTask", + "action": "view", + "roleKey": "ROLE_ADMIN" + } + ] +} diff --git a/backend/plugin/src/main/resources/config/pbac/all.role.json b/backend/plugin/src/main/resources/config/pbac/all.role.json new file mode 100644 index 0000000..01b7252 --- /dev/null +++ b/backend/plugin/src/main/resources/config/pbac/all.role.json @@ -0,0 +1,7 @@ +{ + "changesetId": "roles-v1", + "roles": [ + "ROLE_USER", + "ROLE_ADMIN" + ] +} diff --git a/backend/plugin/src/main/resources/config/plugin/common.pluginconfig.json b/backend/plugin/src/main/resources/config/plugin/common.pluginconfig.json new file mode 100644 index 0000000..2d3d8cf --- /dev/null +++ b/backend/plugin/src/main/resources/config/plugin/common.pluginconfig.json @@ -0,0 +1,13 @@ +[ + { + "id": "6e034748-8ed5-43de-a5f2-f80e1a4b60dd", + "title": "Xential", + "properties": { + "clientId": "test", + "clientPassword": "pwd", + "documentenApiPluginConfiguration": "5474fe57-532a-4050-8d89-32e62ca3e895", + "zakenApiPluginConfiguration": "3079d6fe-42e3-4f8f-a9db-52ce2507b7ee" + }, + "pluginDefinitionKey": "xential" + } +] diff --git a/backend/plugin/src/main/resources/config/process-document-link/xential-test.json b/backend/plugin/src/main/resources/config/process-document-link/xential-test.json new file mode 100644 index 0000000..70aa489 --- /dev/null +++ b/backend/plugin/src/main/resources/config/process-document-link/xential-test.json @@ -0,0 +1,7 @@ +[ + { + "processDefinitionKey": "xential-test", + "canInitializeDocument": true, + "startableByUser": false + } +] diff --git a/backend/plugin/src/main/resources/config/process-link/xential-test.processlink.json b/backend/plugin/src/main/resources/config/process-link/xential-test.processlink.json new file mode 100644 index 0000000..9c6f2ec --- /dev/null +++ b/backend/plugin/src/main/resources/config/process-link/xential-test.processlink.json @@ -0,0 +1,35 @@ +[ + { + "activityId": "XentialTestStartEvent", + "activityType": "bpmn:StartEvent:start", + "processLinkType": "form", + "formDefinitionName": "xential-test.start" + }, + { + "activityId": "MaakDocumentTask", + "activityType": "bpmn:ServiceTask:start", + "processLinkType": "plugin", + "pluginConfigurationId": "6e034748-8ed5-43de-a5f2-f80e1a4b60dd", + "pluginActionDefinitionKey": "generate-document", + "actionProperties": { + "templateId": "e0a8ace5-06df-4ef7-bcbb-9d694d25e03b", + "fileFormat": "PDF", + "documentId": "docId", + "messageName": "messageName", + "templateData": [ + { + "key": "voornaam", + "value": "piet" + }, + { + "key": "achternaam", + "value": "klaasen" + }, + { + "key": "email", + "value": "piet@klaasen.nl" + } + ] + } + } +] diff --git a/backend/plugin/src/test/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationServiceTest.kt b/backend/plugin/src/test/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationServiceTest.kt index 92983d7..b5e77c6 100644 --- a/backend/plugin/src/test/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationServiceTest.kt +++ b/backend/plugin/src/test/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationServiceTest.kt @@ -14,7 +14,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.any import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -import org.openapitools.client.infrastructure.ApiClient import java.util.UUID class DocumentGenerationServiceTest { @@ -56,6 +55,7 @@ class DocumentGenerationServiceTest { generateDocumentProperties, "client-id", "client-password", + execution, ) verify(xentialTokenRepository).save(XentialToken( diff --git a/docker-compose.yml b/docker-compose.yml index bfc6959..e376b7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,3 +41,382 @@ services: environment: - POSTGRES_USER=${DB_USER:-keycloak} - POSTGRES_PASSWORD=${DB_PASSWORD:-keycloak} + + gzac-rabbitmq: + image: rabbitmq:3-management + container_name: gzac-rabbitmq-xential + volumes: + - ./imports/gzac-rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro + - ./imports/gzac-rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro + ports: + - "5672:5672" + - "15672:15672" + + # ZGW + + openzaak: + image: openzaak/open-zaak:1.13.0 + container_name: openzaak + platform: linux/amd64 + profiles: + - zgw + - openzaak + environment: + - DB_HOST=openzaak-database + - DB_POST=5433 + - SECRET_KEY=veryRestrictedSecretKey + - DB_USER=openzaak + - DB_PASSWORD=openzaak + - DB_NAME=openzaak + - CACHE_DEFAULT=openzaak-redis:6379/0 + - CACHE_AXES=openzaak-redis:6379/0 + - DEBUG=true + - ALLOWED_HOSTS=localhost,host.docker.internal,172.17.0.1,openzaak + - OPENZAAK_SUPERUSER_USERNAME=admin + - OPENZAAK_SUPERUSER_EMAIL=admin@admin.org + - DJANGO_SUPERUSER_PASSWORD=admin + - SENDFILE_BACKEND=django_sendfile.backends.simple + - NOTIFICATIONS_DISABLED=true + ports: + - "8001:8000" + depends_on: + - openzaak-database + - openzaak-redis + + openzaak-database: + image: postgis/postgis:13-3.1 + container_name: openzaak-database + platform: linux/amd64 + profiles: + - zgw + - openzaak + environment: + - POSTGRES_USER=openzaak + - POSTGRES_PASSWORD=openzaak + - POSTGRES_DB=openzaak + ports: + - "5433:5432" + volumes: + - ./imports/open-zaak:/docker-entrypoint-initdb.d + + openzaak-redis: + image: redis:6.2.6 + container_name: openzaak-redis + profiles: + - zgw + - openzaak + + objecten-api: + image: maykinmedia/objects-api:2.1.1 + container_name: objecten-api + platform: linux/amd64 + profiles: + - zgw + - objecten + ports: + - "8010:8000" + environment: &objects-env + - CORS_ALLOW_ALL_ORIGINS=true + - SECRET_KEY=${SECRET_KEY:-1(@f(-6s_u(5fd&1sg^uvu2s(c-9sapw)1era8q&)g)h@cwxxg} + - DJANGO_SETTINGS_MODULE=objects.conf.docker + - DB_HOST=objecten-api-database + - DEBUG=true + - TWO_FACTOR_FORCE_OTP_ADMIN=False # this is not available yet in this version + - TWO_FACTOR_PATCH_ADMIN=False + depends_on: + - objecten-api-database + + objecten-api-database: + image: postgis/postgis:13-3.1 + container_name: objecten-api-database + platform: linux/amd64 + profiles: + - zgw + - objecten + ports: + - "54321:5432" + environment: + - POSTGRES_USER=objects + - POSTGRES_PASSWORD=objects + - POSTGRES_DB=objects + + objecten-api-import: + image: maykinmedia/objects-api:2.1.1 + container_name: objects-api-import + platform: linux/amd64 + profiles: + - zgw + - objecten + environment: *objects-env + # in the current version of django it is not possible to create a new user with password without user interaction by using the createsuperuser command + command: sh init/init.sh + volumes: + - ./imports/objects-api/fixtures:/app/src/objects/fixtures + - ./imports/objects-api/init:/app/init + depends_on: + - objecten-api + + objecttypen-api: + image: maykinmedia/objecttypes-api:2.1.0 + container_name: objecttypen-api + platform: linux/amd64 + profiles: + - zgw + - objecten + ports: + - "8011:8000" + environment: &objecttypes-env + - CORS_ALLOW_ALL_ORIGINS=true + - SECRET_KEY=${SECRET_KEY:-fgv=c0hz&tl*8*3m3893@m+1pstrvidc9e^5@fpspmg%cy$$15d} + - DJANGO_SETTINGS_MODULE=objecttypes.conf.docker + - DB_HOST=objecttypen-api-database + - DEBUG=true + - TWO_FACTOR_FORCE_OTP_ADMIN=False # this is not available yet in this version + - TWO_FACTOR_PATCH_ADMIN=False + depends_on: + - objecttypen-api-database + + objecttypen-api-database: + image: postgres:14.1 + container_name: objecttypen-api-database + profiles: + - zgw + - objecten + ports: + - "54324:5432" + environment: + - POSTGRES_USER=objecttypes + - POSTGRES_PASSWORD=objecttypes + - POSTGRES_DB=objecttypes + + objecttypen-api-import: + image: maykinmedia/objecttypes-api:2.1.0 + container_name: objecttypen-api-import + platform: linux/amd64 + profiles: + - zgw + - objecten + environment: *objecttypes-env + command: sh init/init.sh + volumes: + - ./imports/objecttypes-api/fixtures:/app/src/objecttypes/fixtures + - ./imports/objecttypes-api/init:/app/init + depends_on: + - objecttypen-api + + open-notificaties-rabbitmq: + image: rabbitmq:3.9-management + container_name: open-notificaties-rabbitmq + profiles: + - zgw + ports: + - "5673:5672" + - "15673:15672" + + open-notificaties-celery: + image: openzaak/open-notificaties:1.4.3 + container_name: open-notificaties + platform: linux/amd64 + profiles: + - zgw + environment: ¬ificaties-env + - DJANGO_SETTINGS_MODULE=nrc.conf.docker + - SECRET_KEY=${SECRET_KEY:-4wHY2Cp5`4(q%)]cuWxPQJRp5kN?g+`.Xah>%6Fsq6+)R>p_} + - ALLOWED_HOSTS=* + - CACHE_DEFAULT=open-notificaties-redis:6379/0 + - CACHE_AXES=open-notificaties-redis:6379/1 + - DB_PORT=5432 + - DB_HOST=open-notificaties-database + - DB_NAME=notifications + - DB_USER=notifications + - DB_PASSWORD=notifications + - DEBUG=true + - RABBITMQ_HOST=open-notificaties-rabbitmq + - PUBLISH_BROKER_URL=redis://open-notificaties-redis:6379/0 + - CELERY_BROKER_URL=redis://open-notificaties-redis:6379/0 + - CELERY_RESULT_BACKEND=redis://open-notificaties-redis:6379/0 + - CELERY_LOGLEVEL=DEBUG + - CELERY_WORKER_CONCURRENCY=${CELERY_WORKER_CONCURRENCY:-4} + - SUBPATH=${SUBPATH:-/} + command: /celery_worker.sh + depends_on: + - open-notificaties-database + - open-notificaties-rabbitmq + - open-notificaties-redis + + open-notificaties: + image: openzaak/open-notificaties:1.4.3 + container_name: open-notificaties-celery + platform: linux/amd64 + profiles: + - zgw + ports: + - "8002:8000" + environment: *notificaties-env + depends_on: + - open-notificaties-database + - open-notificaties-rabbitmq + - open-notificaties-redis + + open-notificaties-database: + image: postgres:13.5 # open-notificaties doesn't work with postgres 14. + container_name: open-notificaties-database + profiles: + - zgw + ports: + - "54319:5432" + environment: + - POSTGRES_USER=${DB_USER:-notifications} + - POSTGRES_PASSWORD=${DB_PASSWORD:-notifications} + - POSTGRES_DB=notifications + volumes: + - ./imports/open-notificaties:/docker-entrypoint-initdb.d + + open-notificaties-redis: + image: redis:6.2.6 + container_name: open-notificaties-redis + profiles: + - zgw + + open-forms-database: + image: postgres:14.1 + container_name: open-forms-database + profiles: + - openformulieren + ports: + - "54322:5432" + environment: + - POSTGRES_USER=${DB_USER:-openforms} + - POSTGRES_PASSWORD=${DB_PASSWORD:-openforms} + volumes: + - ./imports/open-formulieren:/docker-entrypoint-initdb.d + + open-forms-redis: + image: redis:6.2.6 + container_name: open-forms-redis + profiles: + - openformulieren + + open-forms-web: + image: openformulieren/open-forms:2.0.3 + container_name: open-forms-web + platform: linux/amd64 + profiles: + - openformulieren + environment: &web_env + - CORS_ALLOW_ALL_ORIGINS=true + - DJANGO_SETTINGS_MODULE=openforms.conf.docker + - SECRET_KEY=${SECRET_KEY:-@r0w-0(&apjfde5fl6h23!vn)r1ldkp1c_d2#!$$did4z5hun4a} + - DB_NAME=openforms + - DB_USER=openforms + - DB_PASSWORD=openforms + - DB_HOST=open-forms-database + - CACHE_DEFAULT=open-forms-redis:6379/0 + - CACHE_AXES=open-forms-redis:6379/0 + - ALLOWED_HOSTS=* + - CELERY_BROKER_URL=redis://open-forms-redis:6379/0 + - CELERY_RESULT_BACKEND=redis://open-forms-redis:6379/0 + - CELERY_LOGLEVEL=DEBUG + - OPENFORMS_LOCATION_CLIENT=${OPENFORMS_LOCATION_CLIENT:-openforms.contrib.bag.client.BAGClient} + # Needed for Celery Flower to match the TIME_ZONE configured in the + # settings used by workers and beat containers. + - TZ=Europe/Amsterdam + - TWO_FACTOR_FORCE_OTP_ADMIN=False + - TWO_FACTOR_PATCH_ADMIN=False + volumes: + - ./imports/open-formulieren/private_media:/app/private_media + ports: + - "8003:8000" + depends_on: + - open-forms-database + + open-forms-celery: + image: openformulieren/open-forms:2.0.3 + container_name: open-forms-celery + platform: linux/amd64 + profiles: + - openformulieren + environment: *web_env + command: /celery_worker.sh + volumes: + - ./imports/open-formulieren/private_media:/app/private_media + depends_on: + - open-forms-database + - open-forms-redis + + open-forms-celery-beat: + image: openformulieren/open-forms:2.0.3 + container_name: open-forms-celery-beat + platform: linux/amd64 + profiles: + - openformulieren + environment: *web_env + command: /celery_beat.sh + depends_on: + - open-forms-database + - open-forms-redis + + open-forms-celery-flower: + image: mher/flower:0.9.7 + container_name: open-forms-celery-flower + platform: linux/amd64 + profiles: + - openformulieren + environment: *web_env + ports: + - "5555:5555" + depends_on: + - open-forms-redis + - open-forms-celery + + open-forms-busybox: + image: busybox:1.34.1 + container_name: open-forms-busybox + profiles: + - openformulieren + command: /bin/chown -R 1000 /private_media + volumes: + - ./imports/open-formulieren/private_media:/private_media + + open-klant: + image: maykinmedia/open-klant:latest + container_name: open-klant + platform: linux/amd64 + profiles: + - openklantv1 + environment: + - DJANGO_SETTINGS_MODULE=openklant.conf.docker + - SECRET_KEY=${SECRET_KEY:-django-insecure-$$8s@b*ds4t84-q_2#c0j0506@!l2q6r5_pq5e!vm^_9c*#^66b} + - DB_NAME=openklant + - DB_USER=openklant + - DB_PASSWORD=openklant + - DB_HOST=open-klant-database + - CACHE_DEFAULT=open-klant-redis:6379/0 + - CACHE_AXES=open-klant-redis:6379/0 + - ALLOWED_HOSTS=* + ports: + - "8006:8000" + depends_on: + - open-klant-database + + open-klant-database: + image: postgres:14.1 + container_name: open-klant-database + profiles: + - openklantv1 + ports: + - "54323:5432" + environment: + - POSTGRES_USER=${DB_USER:-openklant} + - POSTGRES_PASSWORD=${DB_PASSWORD:-openklant} + volumes: + - ./imports/open-klanten:/docker-entrypoint-initdb.d + + open-klant-redis: + image: redis:6.2.6 + container_name: open-klant-redis + profiles: + - openklantv1 + +volumes: + gzac-xential-data: diff --git a/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.html b/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.html index a0a4fa1..2a4c57c 100644 --- a/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.html +++ b/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.html @@ -44,4 +44,32 @@ [defaultValue]="obs.prefill?.clientPassword" [title]="'clientPassword' | pluginTranslate: pluginId | async"> +
+ + + + diff --git a/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.ts b/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.ts index 9447c80..b2f9e2f 100644 --- a/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.ts +++ b/frontend/projects/valtimo/xential/src/lib/components/xential-configuration/xential-configuration.component.ts @@ -15,60 +15,103 @@ */ import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; -import {PluginConfigurationComponent, PluginConfigurationData} from '@valtimo/plugin'; -import {BehaviorSubject, combineLatest, Observable, Subscription, take} from 'rxjs'; +import { + PluginConfigurationComponent, + PluginConfigurationData, + PluginManagementService, + PluginTranslationService +} from '@valtimo/plugin'; +import {BehaviorSubject, combineLatest, map, Observable, Subscription, take} from 'rxjs'; import {XentialConfig} from '../../models'; +import {TranslateService} from "@ngx-translate/core"; @Component({ - selector: 'valtimo-xential-configuration', - templateUrl: './xential-configuration.component.html', + selector: 'valtimo-xential-configuration', + templateUrl: './xential-configuration.component.html', }) export class XentialConfigurationComponent - implements PluginConfigurationComponent, OnInit, OnDestroy -{ - @Input() save$!: Observable; - @Input() disabled$!: Observable; - @Input() pluginId!: string; - @Input() prefillConfiguration$!: Observable; - @Output() valid: EventEmitter = new EventEmitter(); - @Output() configuration: EventEmitter = new EventEmitter(); + implements PluginConfigurationComponent, OnInit, OnDestroy { + @Input() save$!: Observable; + @Input() disabled$!: Observable; + @Input() pluginId!: string; + @Input() prefillConfiguration$!: Observable; + @Output() valid: EventEmitter = new EventEmitter(); + @Output() configuration: EventEmitter = new EventEmitter(); - constructor( - ) {} + private saveSubscription!: Subscription; + private readonly formValue$ = new BehaviorSubject(null); + private readonly valid$ = new BehaviorSubject(false); - private saveSubscription!: Subscription; - private readonly formValue$ = new BehaviorSubject(null); - private readonly valid$ = new BehaviorSubject(false); + readonly zakenApiPluginSelectItems$: Observable> = + combineLatest([ + this.pluginManagementService.getPluginConfigurationsByPluginDefinitionKey('zakenapi'), + this.translateService.stream('key'), + ]).pipe( + map(([configurations]) => + configurations.map(configuration => ({ + id: configuration.id, + text: `${configuration.title} - ${this.pluginTranslationService.instant( + 'title', + configuration.pluginDefinition.key + )}`, + })) + ) + ); - ngOnInit(): void { - this.openSaveSubscription(); - } - ngOnDestroy() { - this.saveSubscription?.unsubscribe(); - } + readonly documentenApiPluginSelectItems$: Observable> = + combineLatest([ + this.pluginManagementService.getPluginConfigurationsByPluginDefinitionKey('documentenapi'), + this.translateService.stream('key'), + ]).pipe( + map(([configurations]) => + configurations.map(configuration => ({ + id: configuration.id, + text: `${configuration.title} - ${this.pluginTranslationService.instant( + 'title', + configuration.pluginDefinition.key + )}`, + })) + ) + ); - formValueChange(formValue: XentialConfig): void { - this.formValue$.next(formValue); - this.handleValid(formValue); - } + constructor( + private readonly pluginManagementService: PluginManagementService, + private readonly translateService: TranslateService, + private readonly pluginTranslationService: PluginTranslationService + ) { + } - private handleValid(formValue: XentialConfig): void { - const valid = !!(formValue); - this.valid$.next(valid); - this.valid.emit(valid); - } + ngOnInit(): void { + this.openSaveSubscription(); + } - private openSaveSubscription(): void { - this.saveSubscription = this.save$?.subscribe(save => { - combineLatest([this.formValue$, this.valid$]) - .pipe(take(1)) - .subscribe(([formValue, valid]) => { - if (valid) { - this.configuration.emit(formValue!); - } + ngOnDestroy() { + this.saveSubscription?.unsubscribe(); + } + + formValueChange(formValue: XentialConfig): void { + this.formValue$.next(formValue); + this.handleValid(formValue); + } + + private handleValid(formValue: XentialConfig): void { + const valid = !!(formValue); + + this.valid$.next(valid); + this.valid.emit(valid); + } + + private openSaveSubscription(): void { + this.saveSubscription = this.save$?.subscribe(save => { + combineLatest([this.formValue$, this.valid$]) + .pipe(take(1)) + .subscribe(([formValue, valid]) => { + if (valid) { + this.configuration.emit(formValue!); + } + }); }); - }); - } + } } diff --git a/frontend/projects/valtimo/xential/src/lib/models/config.ts b/frontend/projects/valtimo/xential/src/lib/models/config.ts index 34a3245..b8e92fb 100644 --- a/frontend/projects/valtimo/xential/src/lib/models/config.ts +++ b/frontend/projects/valtimo/xential/src/lib/models/config.ts @@ -19,6 +19,16 @@ import {PluginConfigurationData} from '@valtimo/plugin'; interface XentialConfig extends PluginConfigurationData { clientId: string; clientPassword: string; + zakenApiPluginConfiguration: string; + documentenApiPluginConfiguration: string +} + +interface SendMailConfig { + mailSendTaskFrom: string; + mailSendTaskTemplate: string; + mailSendTaskSubject: string; + mailSendTaskTo: string; + templateData: Array<{key: string; value: string}>; } export {XentialConfig}; diff --git a/frontend/projects/valtimo/xential/src/lib/xential-plugin.specification.ts b/frontend/projects/valtimo/xential/src/lib/xential-plugin.specification.ts index 539f741..2eda4c2 100644 --- a/frontend/projects/valtimo/xential/src/lib/xential-plugin.specification.ts +++ b/frontend/projects/valtimo/xential/src/lib/xential-plugin.specification.ts @@ -40,6 +40,8 @@ const XentialPluginSpecification: PluginSpecification = { fileFormat: 'Bestandsformaat', documentId: 'Document kenmerk', templateData: 'Sjabloon vuldata', + zakenApiPluginConfiguration: "Zaken API plugin", + documentenApiPluginConfiguration: "documenten API plugin", }, en: { title: 'Xential', @@ -52,6 +54,8 @@ const XentialPluginSpecification: PluginSpecification = { fileFormat: 'File format', documentId: 'Document ID', templateData: 'Template data', + zakenApiPluginConfiguration: "Zaken API plugin", + documentenApiPluginConfiguration: "documenten API plugin", }, de: { title: 'Xential', @@ -64,6 +68,8 @@ const XentialPluginSpecification: PluginSpecification = { fileFormat: 'Dateiformat', documentId: 'Dokument-ID', templateData: 'Vorlagendaten', + zakenApiPluginConfiguration: "Zaken API plugin", + documentenApiPluginConfiguration: "documenten API plugin", }, }, };