Skip to content

Commit

Permalink
Merge pull request #4 from valtimo-platform/feature/add-case
Browse files Browse the repository at this point in the history
Feature/add case
  • Loading branch information
paul-ritense authored Nov 13, 2024
2 parents f664d31 + 6bc4637 commit fd57f30
Show file tree
Hide file tree
Showing 34 changed files with 2,339 additions and 62 deletions.
34 changes: 34 additions & 0 deletions backend/app/.env.properties
Original file line number Diff line number Diff line change
@@ -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

17 changes: 17 additions & 0 deletions backend/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
}
5 changes: 5 additions & 0 deletions backend/app/src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@ keycloak:
resource: valtimo-user-m2m-client
credentials:
secret: 6ef6ca16-6b86-482a-a3d9-0561704c1db9


plugin:
xential:
baseurl: http://localhost:1080
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
8 changes: 6 additions & 2 deletions backend/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -119,7 +122,8 @@ test {
useJUnitPlatform()
}

java.sourceCompatibility = JavaVersion.VERSION_22
sourceCompatibility = 21
targetCompatibility = 21

apply plugin: "com.avast.gradle.docker-compose"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)

}
Original file line number Diff line number Diff line change
@@ -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,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.ritense.valtimo.xential.domain

enum class FileFormat {
WORD, PDF
}
Original file line number Diff line number Diff line change
@@ -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<String, String>
val messageName: String,
val templateData: Array<TemplateDataEntry>
)

enum class FileFormat {
WORD, PDF
}
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ritense.valtimo.xential.plugin

data class TemplateDataEntry(
val key: String,
val value: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
)
Expand All @@ -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<TemplateDataEntry>,
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"
}

}
Loading

0 comments on commit fd57f30

Please sign in to comment.