public static StageInstanceModel toStageInstanceModel(Stage stage) { StageInstanceModel stageInstanceModel = new StageInstanceModel(stage.getName(), String.valueOf(stage.getCounter()), stage.getResult(), stage.getIdentifier()); stageInstanceModel.setApprovalType(stage.getApprovalType()); stageInstanceModel.setApprovedBy(stage.getApprovedBy()); stageInstanceModel.setRerunOfCounter(stage.getRerunOfCounter()); JobHistory jobHistory = new JobHistory(); for (JobInstance jobInstance : stage.getJobInstances()) { jobHistory.addJob(jobInstance.getName(), jobInstance.getState(), jobInstance.getResult(), jobInstance.getScheduledDate()); } stageInstanceModel.setBuildHistory(jobHistory); return stageInstanceModel; }