private PlanTrainCMD searchPrePlanTrain( String trainName, int trainSort, PlanTrainCMD train, List<PlanTrainCMD> tempTrainList) { if (train.getTrainNbr().equals(trainName) && train.getTrainSort().intValue() == trainSort) { return train; } else { if (train.getPreTrainId() != null && !train.getPreTrainId().equals("")) { PlanTrainCMD preTrain = null; for (PlanTrainCMD planTrain : tempTrainList) { if (planTrain .getPlanTrainId() .equals(train.getPreTrainId())) { // abce5a47-48bd-40e4-acd7-df7420339c79 preTrain = planTrain; break; } } if (preTrain == null) { preTrain = cmdPlanDao.findPlanTrainListByPlanTrainId(train.getPreTrainId()); tempTrainList.add(preTrain); } return searchPrePlanTrain(trainName, trainSort, preTrain, tempTrainList); } else { return null; } } }
private PlanTrainCMD searchNextPlanTrain(PlanTrainCMD train, List<PlanTrainCMD> planTrainList) { PlanTrainCMD nextTrain = null; if (train.getNextTrainId() != null && !train.getNextTrainId().equals("")) { for (PlanTrainCMD planTrain : planTrainList) { if (planTrain.getPlanTrainId().equals(train.getNextTrainId())) { nextTrain = planTrain; break; } } if (nextTrain == null) { nextTrain = cmdPlanDao.findPlanTrainListByPlanTrainId(train.getNextTrainId()); } } return nextTrain; }