Search in sources :

Example 1 with StateMachineSchemeVO

use of io.choerodon.agile.api.vo.StateMachineSchemeVO 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;
}
Also used : StatusMachineSchemeConfigDTO(io.choerodon.agile.infra.dto.StatusMachineSchemeConfigDTO) TypeToken(org.modelmapper.TypeToken) ProjectConfigDTO(io.choerodon.agile.infra.dto.ProjectConfigDTO) ArrayList(java.util.ArrayList) StatusMachineSchemeConfigVO(io.choerodon.agile.api.vo.StatusMachineSchemeConfigVO) StateMachineSchemeVO(io.choerodon.agile.api.vo.StateMachineSchemeVO) ProjectVO(io.choerodon.agile.api.vo.ProjectVO) ModelMapper(org.modelmapper.ModelMapper)

Example 2 with StateMachineSchemeVO

use of io.choerodon.agile.api.vo.StateMachineSchemeVO in project agile-service by open-hand.

the class StateMachineSchemeController method pagingQuery.

@Permission(level = ResourceLevel.ORGANIZATION)
@ApiOperation(value = "查询状态机方案列表")
@CustomPageRequest
@GetMapping
public ResponseEntity<Page<StateMachineSchemeVO>> pagingQuery(@ApiIgnore @SortDefault(value = "id", direction = Sort.Direction.DESC) PageRequest pageRequest, @ApiParam(value = "组织id", required = true) @PathVariable("organization_id") Long organizationId, @ApiParam(value = "名称") @RequestParam(required = false) String name, @ApiParam(value = "描述") @RequestParam(required = false) String description, @ApiParam(value = "模糊查询参数") @RequestParam(required = false) String[] param) {
    StateMachineSchemeVO schemeDTO = new StateMachineSchemeVO();
    schemeDTO.setOrganizationId(organizationId);
    schemeDTO.setName(name);
    schemeDTO.setDescription(description);
    return new ResponseEntity<>(schemeService.pageQuery(organizationId, pageRequest, schemeDTO, ParamUtils.arrToStr(param)), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) StateMachineSchemeVO(io.choerodon.agile.api.vo.StateMachineSchemeVO) Permission(io.choerodon.swagger.annotation.Permission) ApiOperation(io.swagger.annotations.ApiOperation) CustomPageRequest(io.choerodon.swagger.annotation.CustomPageRequest)

Example 3 with StateMachineSchemeVO

use of io.choerodon.agile.api.vo.StateMachineSchemeVO in project agile-service by open-hand.

the class ConvertUtils method convertStateMachineSchemesToVOS.

public static List<StateMachineSchemeVO> convertStateMachineSchemesToVOS(final List<StateMachineSchemeDTO> schemes, final Map<Long, ProjectVO> projectMap) {
    List<StateMachineSchemeVO> list = new ArrayList<>(schemes.size());
    for (StateMachineSchemeDTO scheme : schemes) {
        StateMachineSchemeVO schemeVO = convertStateMachineSchemeToVO(scheme, projectMap);
        list.add(schemeVO);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) StateMachineSchemeDTO(io.choerodon.agile.infra.dto.StateMachineSchemeDTO) StateMachineSchemeVO(io.choerodon.agile.api.vo.StateMachineSchemeVO)

Aggregations

StateMachineSchemeVO (io.choerodon.agile.api.vo.StateMachineSchemeVO)3 ArrayList (java.util.ArrayList)2 ProjectVO (io.choerodon.agile.api.vo.ProjectVO)1 StatusMachineSchemeConfigVO (io.choerodon.agile.api.vo.StatusMachineSchemeConfigVO)1 ProjectConfigDTO (io.choerodon.agile.infra.dto.ProjectConfigDTO)1 StateMachineSchemeDTO (io.choerodon.agile.infra.dto.StateMachineSchemeDTO)1 StatusMachineSchemeConfigDTO (io.choerodon.agile.infra.dto.StatusMachineSchemeConfigDTO)1 CustomPageRequest (io.choerodon.swagger.annotation.CustomPageRequest)1 Permission (io.choerodon.swagger.annotation.Permission)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ModelMapper (org.modelmapper.ModelMapper)1 TypeToken (org.modelmapper.TypeToken)1 ResponseEntity (org.springframework.http.ResponseEntity)1