use of com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO in project apollo by ctripcorp.
the class ReleaseHistoryController method transformReleaseHistory2DTO.
private ReleaseHistoryDTO transformReleaseHistory2DTO(ReleaseHistory releaseHistory) {
ReleaseHistoryDTO dto = new ReleaseHistoryDTO();
BeanUtils.copyProperties(releaseHistory, dto, "operationContext");
dto.setOperationContext(gson.fromJson(releaseHistory.getOperationContext(), configurationTypeReference));
return dto;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method findLatestByPreviousReleaseIdAndOperation.
public ReleaseHistoryBO findLatestByPreviousReleaseIdAndOperation(Env env, long previousReleaseId, int operation) {
PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByPreviousReleaseIdAndOperation(env, previousReleaseId, operation, 0, 1);
if (pageDTO != null && pageDTO.hasContent()) {
ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0);
ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId());
return transformReleaseHistoryDTO2BO(releaseHistory, release);
}
return null;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method transformReleaseHistoryDTO2BO.
private List<ReleaseHistoryBO> transformReleaseHistoryDTO2BO(List<ReleaseHistoryDTO> source, List<ReleaseDTO> releases) {
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;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method findNamespaceReleaseHistory.
public List<ReleaseHistoryBO> findNamespaceReleaseHistory(String appId, Env env, String clusterName, String namespaceName, int page, int size) {
PageDTO<ReleaseHistoryDTO> result = releaseHistoryAPI.findReleaseHistoriesByNamespace(appId, env, clusterName, namespaceName, page, size);
if (result == null || !result.hasContent()) {
return Collections.emptyList();
}
List<ReleaseHistoryDTO> content = result.getContent();
Set<Long> releaseIds = new HashSet<>();
for (ReleaseHistoryDTO releaseHistoryDTO : content) {
long releaseId = releaseHistoryDTO.getReleaseId();
if (releaseId != 0) {
releaseIds.add(releaseId);
}
}
List<ReleaseDTO> releases = releaseService.findReleaseByIds(env, releaseIds);
return transformReleaseHistoryDTO2BO(content, releases);
}
use of com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method findLatestByReleaseIdAndOperation.
public ReleaseHistoryBO findLatestByReleaseIdAndOperation(Env env, long releaseId, int operation) {
PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByReleaseIdAndOperation(env, releaseId, operation, 0, 1);
if (pageDTO != null && pageDTO.hasContent()) {
ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0);
ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId());
return transformReleaseHistoryDTO2BO(releaseHistory, release);
}
return null;
}
Aggregations