class TaskServiceImpl implements TaskService {

	@Override
	public DefAllValid getDefAllValid() throws Exception {
		DefFileSysQuery defFileSysQuery = new DefFileSysQuery();
		defFileSysQuery.setIsValid(1);
		List<DefFileSys> defFileSysList = defFileSysDao.getByDefFileSysQuery(defFileSysQuery);
		if (defFileSysList == null || defFileSysList.isEmpty()) {
			return null;
		}

		DefDependQuery defDependQuery = new DefDependQuery();
		defDependQuery.setIsValid(1);
		List<DefDepend> defDependList = defDependDao.getByDefDependQuery(defDependQuery);

		DefAllValid defAllValid = new DefAllValid();
		for (DefFileSys defFileSys : defFileSysList) {
			AbstractBase abstractBase = ViewDBConverters.buildView(defFileSys);
			if (abstractBase != null) {
				defAllValid.getDefAllMap().put(abstractBase.getFileId(), abstractBase);
				FileType fileType = Enum.valueOf(FileType.class, abstractBase.getFileType());
				if (fileType == FileType.ImportKafka) {
					defAllValid.getImportQueueSet().add(abstractBase.getFileId());
				}
				if (fileType == FileType.Cron) {
					defAllValid.getCronSet().add(abstractBase.getFileId());
				}
			}
		}
		
		if(defDependList != null) {
			for(DefDepend defDepend : defDependList) {
				AbstractTaskDepend forPredependTask = (AbstractTaskDepend) defAllValid.getDefAllMap().get(defDepend.getFileId());
				if(forPredependTask != null) {
					forPredependTask.getPreDependSet().add(defDepend.getPreFileId());
				}
				
				AbstractTaskDepend forPostdependTask = (AbstractTaskDepend) defAllValid.getDefAllMap().get(defDepend.getPreFileId());
				if(forPostdependTask != null) {
					forPostdependTask.getPostDependSet().add(defDepend.getFileId());
				}
			}
		}

		return defAllValid;
	}

}