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

com.innovenso.townplan.dsl.timemachine.KeyPointInTimeConfigurer.groovy Maven / Gradle / Ivy

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

import com.innovenso.townplan.api.command.AddKeyPointInTimeCommand
import com.innovenso.townplan.domain.TownPlanImpl
import com.innovenso.townplan.dsl.AbstractConfigurer
import com.innovenso.townplan.dsl.TownPlanConfigurer
import com.innovenso.townplan.dsl.traits.HasRequiredKey
import com.innovenso.townplan.dsl.traits.HasRequiredTitle
import jakarta.validation.constraints.NotNull
import lombok.NonNull

import java.time.LocalDate

class KeyPointInTimeConfigurer extends AbstractConfigurer implements HasRequiredTitle, HasRequiredKey {
	private boolean diagramsNeeded

	@NotNull
	private LocalDate date;

	KeyPointInTimeConfigurer(@NonNull TownPlanConfigurer townPlanConfigurer) {
		super(townPlanConfigurer)
	}

	void date(LocalDate date) {
		this.date = date
	}

	void render(boolean value) {
		this.diagramsNeeded = value
	}

	@Override
	def apply(@NonNull TownPlanImpl townPlan) {
		return townPlan.execute(AddKeyPointInTimeCommand.builder()
				.title(this.title)
				.date(this.date)
				.diagramsNeeded(this.diagramsNeeded)
				.build())
	}

	@Override
	String configurerDescription() {
		return "Point in Time"
	}

	@Override
	List getDefaultKeyComponents() {
		return ["pointintime", title]
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy