this(injector.getInstance(StageDAO.class).findByActionId(actionId), injector);
}
@AssistedInject
public Stage(@Assisted StageEntity stageEntity, Injector injector) {
HostRoleCommandDAO hostRoleCommandDAO = injector.getInstance(HostRoleCommandDAO.class);
HostDAO hostDAO = injector.getInstance(HostDAO.class);
HostRoleCommandFactory hostRoleCommandFactory = injector.getInstance(HostRoleCommandFactory.class);
requestId = stageEntity.getRequestId();
stageId = stageEntity.getStageId();
logDir = stageEntity.getLogInfo();
clusterName = stageEntity.getCluster().getClusterName();
requestContext = stageEntity.getRequestContext();
for (HostEntity hostEntity : hostDAO.findByStage(stageEntity)) {
List<HostRoleCommandEntity> commands = hostRoleCommandDAO.findSortedCommandsByStageAndHost(stageEntity, hostEntity);
commandsToSend.put(hostEntity.getHostName(), new ArrayList<ExecutionCommandWrapper>());
hostRoleCommands.put(hostEntity.getHostName(), new TreeMap<String, HostRoleCommand>());
for (HostRoleCommandEntity command : commands) {
HostRoleCommand hostRoleCommand = hostRoleCommandFactory.createExisting(command);
hostRoleCommands.get(hostEntity.getHostName()).put(hostRoleCommand.getRole().toString(), hostRoleCommand);