io.holunda.camunda.taskpool.urlresolver.PropertyBasedFormUrlResolver.kt Maven / Gradle / Ivy
package io.holunda.camunda.taskpool.urlresolver
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.holunda.camunda.taskpool.view.DataEntry
import io.holunda.camunda.taskpool.view.FormUrlResolver
import io.holunda.camunda.taskpool.view.ProcessDefinition
import io.holunda.camunda.taskpool.view.Task
import org.apache.commons.text.StringSubstitutor
/**
* URL resolver backed with properties from yaml.
*/
class PropertyBasedFormUrlResolver(
private val props: FormUrlResolverProperties,
private val objectMapper: ObjectMapper
) : FormUrlResolver {
companion object {
const val APPLICATION_NAME_ATTRIBUTE = "applicationName"
}
override fun resolveUrl(task: Task): String {
val applicationName = task.sourceReference.applicationName
val appMap = mapOf(APPLICATION_NAME_ATTRIBUTE to applicationName)
val appTemplate = props.getApplicationTemplate(applicationName)
val taskTemplate = props.getTaskUrlTemplate(applicationName, task.taskDefinitionKey)
val taskMap: Map = objectMapper.convertValue(task, object : TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy