package com.sequenceiq.cloudbreak.core.flow2.chain; import static com.sequenceiq.cloudbreak.core.flow2.cluster.provision.ClusterCreationEvent.CLUSTER_INSTALL_EVENT; import static com.sequenceiq.cloudbreak.core.flow2.cluster.reset.ClusterResetEvent.CLUSTER_RESET_EVENT; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import org.springframework.stereotype.Component; import com.sequenceiq.cloudbreak.cloud.event.Selectable; import com.sequenceiq.cloudbreak.reactor.api.event.StackEvent; import com.sequenceiq.cloudbreak.reactor.api.event.cluster.StartAmbariSuccess; @Component public class ResetFlowEventChainFactory implements FlowEventChainFactory<StackEvent> { @Override public String initEvent() { return FlowChainTriggers.CLUSTER_RESET_CHAIN_TRIGGER_EVENT; } @Override public Queue<Selectable> createFlowTriggerEventQueue(StackEvent event) { Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>(); flowEventChain.add(new StackEvent(CLUSTER_RESET_EVENT.event(), event.getStackId(), event.accepted())); flowEventChain.add(new StartAmbariSuccess(CLUSTER_INSTALL_EVENT.event(), event.getStackId())); return flowEventChain; } }