Search in sources :

Example 1 with ReleaseHistoryBO

use of com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO in project apollo by ctripcorp.

the class ReleaseHistoryService method transformReleaseHistoryDTO2BO.

private ReleaseHistoryBO transformReleaseHistoryDTO2BO(ReleaseHistoryDTO dto, ReleaseDTO release) {
    ReleaseHistoryBO bo = new ReleaseHistoryBO();
    bo.setId(dto.getId());
    bo.setAppId(dto.getAppId());
    bo.setClusterName(dto.getClusterName());
    bo.setNamespaceName(dto.getNamespaceName());
    bo.setBranchName(dto.getBranchName());
    bo.setReleaseId(dto.getReleaseId());
    bo.setPreviousReleaseId(dto.getPreviousReleaseId());
    bo.setOperator(dto.getDataChangeCreatedBy());
    bo.setOperatorDisplayName(dto.getDataChangeCreatedByDisplayName());
    bo.setOperation(dto.getOperation());
    Date releaseTime = dto.getDataChangeLastModifiedTime();
    bo.setReleaseTime(releaseTime);
    bo.setReleaseTimeFormatted(RelativeDateFormat.format(releaseTime));
    bo.setOperationContext(dto.getOperationContext());
    // set release info
    setReleaseInfoToReleaseHistoryBO(bo, release);
    return bo;
}
Also used : ReleaseHistoryBO(com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO) Date(java.util.Date)

Example 2 with ReleaseHistoryBO

use of com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO in project apollo by ctripcorp.

the class ReleaseHistoryService method transformReleaseHistoryDTO2BO.

private List<ReleaseHistoryBO> transformReleaseHistoryDTO2BO(List<ReleaseHistoryDTO> source, List<ReleaseDTO> releases) {
    if (CollectionUtils.isEmpty(source)) {
        return Collections.emptyList();
    }
    this.additionalUserInfoEnrichService.enrichAdditionalUserInfo(source, BaseDtoUserInfoEnrichedAdapter::new);
    Map<Long, ReleaseDTO> releasesMap = BeanUtils.mapByKey("id", releases);
    List<ReleaseHistoryBO> bos = new ArrayList<>(source.size());
    for (ReleaseHistoryDTO dto : source) {
        ReleaseDTO release = releasesMap.get(dto.getReleaseId());
        bos.add(transformReleaseHistoryDTO2BO(dto, release));
    }
    return bos;
}
Also used : BaseDtoUserInfoEnrichedAdapter(com.ctrip.framework.apollo.portal.enricher.adapter.BaseDtoUserInfoEnrichedAdapter) ReleaseHistoryDTO(com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO) ReleaseHistoryBO(com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO) ArrayList(java.util.ArrayList) ReleaseDTO(com.ctrip.framework.apollo.common.dto.ReleaseDTO)

Aggregations

ReleaseHistoryBO (com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO)2 ReleaseDTO (com.ctrip.framework.apollo.common.dto.ReleaseDTO)1 ReleaseHistoryDTO (com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO)1 BaseDtoUserInfoEnrichedAdapter (com.ctrip.framework.apollo.portal.enricher.adapter.BaseDtoUserInfoEnrichedAdapter)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1