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

com.innovenso.townplan.dsl.concepts.decision.DecisionContextConfigurer.groovy Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.innovenso.townplan.dsl.concepts.decision

import com.innovenso.townplan.api.command.AddDecisionContextCommand
import com.innovenso.townplan.api.value.it.decision.DecisionContextType
import com.innovenso.townplan.domain.TownPlanImpl
import com.innovenso.townplan.dsl.TownPlanConfigurer
import com.innovenso.townplan.dsl.concepts.AbstractConceptConfigurer
import com.innovenso.townplan.dsl.traits.HasDocumentation
import lombok.NonNull

class DecisionContextConfigurer extends AbstractConceptConfigurer implements HasDocumentation {
	private final DecisionContextType contextType
	private final String decisionKey
	final String sortKey

	DecisionContextConfigurer(@NonNull TownPlanConfigurer townPlanConfigurer, @NonNull DecisionContextType contextType, @NonNull String decisionKey, @NonNull String sortKey) {
		super(townPlanConfigurer)
		this.contextType = contextType
		this.decisionKey = decisionKey
		this.sortKey = sortKey
		this.key = UUID.randomUUID().toString()
	}

	def apply(@NonNull TownPlanImpl townPlan) {
		townPlan.execute(AddDecisionContextCommand.builder()
				.key(key)
				.title(title)
				.description(description)
				.decision(decisionKey)
				.contextType(contextType)
				.sortKey(sortKey)
				.build())
	}

	@Override
	String conceptType() {
		return "Decision ${contextType.label}"
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy