All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.camunda.community.rest.adapter.DeploymentAdapter.kt Maven / Gradle / Ivy

package org.camunda.community.rest.adapter

import org.camunda.bpm.engine.repository.*
import org.camunda.community.rest.client.model.*
import java.util.*

class DeploymentAdapter(private val deploymentBean: DeploymentBean) : DeploymentWithDefinitions {

  override fun getId() = deploymentBean.id

  override fun getName() = deploymentBean.name

  override fun getDeploymentTime() = deploymentBean.deploymentTime

  override fun getSource() = deploymentBean.source

  override fun getTenantId() = deploymentBean.tenantId

  override fun getDeployedProcessDefinitions() = deploymentBean.deployedProcessDefinitions

  override fun getDeployedCaseDefinitions() = deploymentBean.deployedCaseDefinitions

  override fun getDeployedDecisionDefinitions() = deploymentBean.deployedDecisionDefinitions

  override fun getDeployedDecisionRequirementsDefinitions() = deploymentBean.deployedDecisionRequirementsDefinitions
}

/**
 * POJO to hold the values of a task.
 */
data class DeploymentBean(
  val id: String,
  val name: String?,
  var deploymentTime: Date?,
  var source: String?,
  var tenantId: String?,
  var deployedProcessDefinitions: List?,
  var deployedCaseDefinitions: List?,
  var deployedDecisionDefinitions: List?,
  var deployedDecisionRequirementsDefinitions: List?,
) {
  companion object {
    /**
     * Factory method to create bean from REST representation.
     */
    @JvmStatic
    fun fromDto(dto: DeploymentWithDefinitionsDto) = DeploymentBean(
      id = dto.id,
      name = dto.name,
      deploymentTime = dto.deploymentTime,
      source = dto.source,
      tenantId = dto.tenantId,
      deployedCaseDefinitions = dto.deployedCaseDefinitions?.map { it.value.toBean() },
      deployedProcessDefinitions = dto.deployedProcessDefinitions?.map { it.value.toBean() },
      deployedDecisionDefinitions = dto.deployedDecisionDefinitions?.map { it.value.toBean() },
      deployedDecisionRequirementsDefinitions = dto.deployedDecisionRequirementsDefinitions?.map { it.value.toBean() }
    )
    /**
     * Factory method to create bean from REST representation.
     */
    @JvmStatic
    fun fromDto(dto: DeploymentDto) = DeploymentBean(
      id = dto.id,
      name = dto.name,
      deploymentTime = dto.deploymentTime,
      source = dto.source,
      tenantId = dto.tenantId,
      deployedCaseDefinitions = null,
      deployedProcessDefinitions = null,
      deployedDecisionDefinitions = null,
      deployedDecisionRequirementsDefinitions = null
    )
  }
}

fun CaseDefinitionDto.toBean() = object : CaseDefinition {
  override fun getId() = [email protected]
  override fun getCategory() = [email protected]
  override fun getName() = [email protected]
  override fun getKey() = [email protected]
  override fun getVersion() = [email protected]
  override fun getResourceName() = [email protected]
  override fun getDeploymentId() = [email protected]
  override fun getDiagramResourceName() = [email protected] //FIXME
  override fun getTenantId() = [email protected]
  override fun getHistoryTimeToLive() = [email protected]
}

fun ProcessDefinitionDto.toBean() = object : ProcessDefinition {
  override fun getId() = [email protected]
  override fun getCategory() = [email protected]
  override fun getName() = [email protected]
  override fun getKey() = [email protected]
  override fun getVersion() = [email protected]
  override fun getResourceName() = [email protected]
  override fun getDeploymentId() = [email protected]
  override fun getDiagramResourceName() = [email protected]
  override fun getTenantId() = [email protected]
  override fun getHistoryTimeToLive() = [email protected]
  override fun getDescription() = [email protected]
  override fun hasStartFormKey() = false //FIXME
  override fun isSuspended() = [email protected]
  override fun getVersionTag() = [email protected]
  override fun isStartableInTasklist() = [email protected]
}

fun DecisionDefinitionDto.toBean() = object : DecisionDefinition {
  override fun getId() = [email protected]
  override fun getCategory() = [email protected]
  override fun getName() = [email protected]
  override fun getKey() = [email protected]
  override fun getVersion() = [email protected]
  override fun getResourceName() = [email protected]
  override fun getDeploymentId() = [email protected]
  override fun getDiagramResourceName() = [email protected] //FIXME
  override fun getTenantId() = [email protected]
  override fun getHistoryTimeToLive() = [email protected]
  override fun getDecisionRequirementsDefinitionId() = [email protected]
  override fun getDecisionRequirementsDefinitionKey() = [email protected]
  override fun getVersionTag() = [email protected]
}

fun DecisionRequirementsDefinitionDto.toBean() = object : DecisionRequirementsDefinition {
  override fun getId() = [email protected]
  override fun getCategory() = [email protected]
  override fun getName() = [email protected]
  override fun getKey() = [email protected]
  override fun getVersion() = [email protected]
  override fun getResourceName() = [email protected]
  override fun getDeploymentId() = [email protected]
  override fun getDiagramResourceName() = [email protected] //FIXME
  override fun getTenantId() = [email protected]
  override fun getHistoryTimeToLive() = null //FIXME
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy