package com.sequenceiq.cloudbreak.service.upgrade.ccm;

import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn;
import com.sequenceiq.flow.api.model.FlowIdentifier;

@Service
public class StackCcmUpgradeService {
    public FlowIdentifier upgradeCcm(NameOrCrn nameOrCrn) {
        return null;
    }
}

@@ -60,293 +60,1623 @@
 ort 
-org.springframework.stereotype.Service;%0A%0Aimport com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn;%0Aimport com.sequenceiq.flow.api.model.FlowIdentifier;%0A%0A@Service%0Apublic class StackCcmUpgradeService %7B%0A    public FlowIdentifier upgradeCcm(NameOrCrn nameOrCrn) %7B%0A        return null
+static com.sequenceiq.cloudbreak.core.flow2.cluster.ccm.upgrade.CcmUpgradeEvent.CCM_UPGRADE_EVENT;%0A%0Aimport javax.inject.Inject;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn;%0Aimport com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier;%0Aimport com.sequenceiq.cloudbreak.domain.stack.Stack;%0Aimport com.sequenceiq.cloudbreak.logger.MDCBuilder;%0Aimport com.sequenceiq.cloudbreak.reactor.api.event.StackEvent;%0Aimport com.sequenceiq.cloudbreak.service.stack.StackService;%0Aimport com.sequenceiq.cloudbreak.structuredevent.CloudbreakRestRequestThreadLocalService;%0Aimport com.sequenceiq.flow.api.model.FlowIdentifier;%0A%0A@Service%0Apublic class StackCcmUpgradeService %7B%0A%0A    private static final Logger LOGGER = LoggerFactory.getLogger(StackCcmUpgradeService.class);%0A%0A    @Inject%0A    private CloudbreakRestRequestThreadLocalService restRequestThreadLocalService;%0A%0A    @Inject%0A    private StackService stackService;%0A%0A    @Inject%0A    private ReactorNotifier reactorNotifier;%0A%0A    public FlowIdentifier upgradeCcm(NameOrCrn nameOrCrn) %7B%0A        Long workspaceId = restRequestThreadLocalService.getRequestedWorkspaceId();%0A        Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId);%0A        MDCBuilder.buildMdcContext(stack);%0A        LOGGER.debug(%22Ccm upgrade has been initiated for stack %7B%7D%22, nameOrCrn.getNameOrCrn());%0A        String selector = CCM_UPGRADE_EVENT.event();%0A        return reactorNotifier.notify(stack.getId(), selector, new StackEvent(selector, stack.getId()))
 ;%0A  

Revert "Revert "CB-14584 triggering ccm upgrade flow through internal call""