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

com.innovenso.townplan.dsl.views.FlowViewConfigurer.groovy Maven / Gradle / Ivy

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

import com.innovenso.townplan.api.command.AddFlowViewCommand
import com.innovenso.townplan.api.command.AddFlowViewStepCommand
import com.innovenso.townplan.api.value.RelationshipType
import com.innovenso.townplan.domain.TownPlanImpl
import com.innovenso.townplan.dsl.TownPlanConfigurer
import groovy.transform.NamedDelegate
import groovy.transform.NamedVariant
import lombok.NonNull

import static groovy.lang.Closure.DELEGATE_ONLY

class FlowViewConfigurer extends AbstractViewConfigurer {
	boolean showStepCounter

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

	def showStepCounter(boolean show) {
		this.showStepCounter = show
	}

	@Override
	String viewType() {
		return "Flow"
	}

	FlowViewStepConfigurer request(@DelegatesTo(value = FlowViewStepConfigurer, strategy = DELEGATE_ONLY) Closure configurer) {
		townPlanConfigurer.flowViewStep configureConfigurer(new FlowViewStepConfigurer(townPlanConfigurer, this.getKey(), false), configurer)
	}

	FlowViewStepConfigurer message(@DelegatesTo(value = FlowViewStepConfigurer, strategy = DELEGATE_ONLY) Closure configurer) {
		townPlanConfigurer.flowViewStep configureConfigurer(new FlowViewStepConfigurer(townPlanConfigurer, this.getKey(), false), configurer)
	}

	FlowViewStepConfigurer response(@DelegatesTo(value = FlowViewStepConfigurer, strategy = DELEGATE_ONLY) Closure configurer) {
		townPlanConfigurer.flowViewStep configureConfigurer(new FlowViewStepConfigurer(townPlanConfigurer, this.getKey(), true), configurer)
	}



	@Override
	def apply(@NonNull TownPlanImpl townPlan) {
		townPlan.execute(AddFlowViewCommand.builder()
				.key(this.getKey())
				.title(this.getTitle())
				.description(this.getDescription())
				.showStepCounter(this.getShowStepCounter())
				.build())
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy