use of io.choerodon.agile.api.vo.StatusMachineSchemeConfigVO in project agile-service by open-hand.
the class ConvertUtils method convertStateMachineSchemeToVO.
public static StateMachineSchemeVO convertStateMachineSchemeToVO(final StateMachineSchemeDTO scheme, final Map<Long, ProjectVO> projectMap) {
ModelMapper modelMapper = new ModelMapper();
StateMachineSchemeVO schemeVO = modelMapper.map(scheme, StateMachineSchemeVO.class);
List<StatusMachineSchemeConfigDTO> schemeConfigs = scheme.getSchemeConfigs();
if (null != schemeConfigs && !schemeConfigs.isEmpty()) {
List<StatusMachineSchemeConfigVO> schemeConfigVOS = modelMapper.map(schemeConfigs, new TypeToken<List<StatusMachineSchemeConfigVO>>() {
}.getType());
schemeVO.setConfigVOS(schemeConfigVOS);
}
List<ProjectConfigDTO> projectConfigs = scheme.getProjectConfigs();
if (null != projectConfigs && !projectConfigs.isEmpty()) {
List<ProjectVO> projectVOS = new ArrayList<>(projectConfigs.size());
for (ProjectConfigDTO config : projectConfigs) {
ProjectVO projectVO = projectMap.get(config.getProjectId());
if (projectVO != null) {
projectVOS.add(projectVO);
}
}
schemeVO.setProjectVOS(projectVOS);
}
return schemeVO;
}
Aggregations