Search in sources :

Example 1 with FlowChainLog

use of com.sequenceiq.cloudbreak.domain.FlowChainLog in project cloudbreak by hortonworks.

the class FlowLogService method saveChain.

public FlowChainLog saveChain(String flowChainId, String parentFlowChainId, Queue<Selectable> chain) {
    String chainJson = JsonWriter.objectToJson(chain);
    FlowChainLog chainLog = new FlowChainLog(flowChainId, parentFlowChainId, chainJson);
    return flowChainLogRepository.save(chainLog);
}
Also used : FlowChainLog(com.sequenceiq.cloudbreak.domain.FlowChainLog)

Example 2 with FlowChainLog

use of com.sequenceiq.cloudbreak.domain.FlowChainLog in project cloudbreak by hortonworks.

the class FlowChainHandler method restoreFlowChain.

public void restoreFlowChain(String flowChainId) {
    FlowChainLog chainLog = flowChainLogRepository.findFirstByFlowChainIdOrderByCreatedDesc(flowChainId);
    if (chainLog != null) {
        Queue<Selectable> chain = (Queue<Selectable>) JsonReader.jsonToJava(chainLog.getChain());
        flowChains.putFlowChain(flowChainId, chainLog.getParentFlowChainId(), chain);
        if (chainLog.getParentFlowChainId() != null) {
            restoreFlowChain(chainLog.getParentFlowChainId());
        }
    }
}
Also used : Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) FlowChainLog(com.sequenceiq.cloudbreak.domain.FlowChainLog) Queue(java.util.Queue)

Aggregations

FlowChainLog (com.sequenceiq.cloudbreak.domain.FlowChainLog)2 Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)1 Queue (java.util.Queue)1