Search in sources :

Example 1 with OpenNamespaceDTO

use of com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO in project apollo by ctripcorp.

the class OpenApiBeanUtils method transformFromNamespaceBO.

public static OpenNamespaceDTO transformFromNamespaceBO(NamespaceBO namespaceBO) {
    Preconditions.checkArgument(namespaceBO != null);
    OpenNamespaceDTO openNamespaceDTO = BeanUtils.transfrom(OpenNamespaceDTO.class, namespaceBO.getBaseInfo());
    // app namespace info
    openNamespaceDTO.setFormat(namespaceBO.getFormat());
    openNamespaceDTO.setComment(namespaceBO.getComment());
    openNamespaceDTO.setPublic(namespaceBO.isPublic());
    // items
    List<OpenItemDTO> items = new LinkedList<>();
    List<ItemBO> itemBOs = namespaceBO.getItems();
    if (!CollectionUtils.isEmpty(itemBOs)) {
        items.addAll(itemBOs.stream().map(itemBO -> transformFromItemDTO(itemBO.getItem())).collect(Collectors.toList()));
    }
    openNamespaceDTO.setItems(items);
    return openNamespaceDTO;
}
Also used : OpenItemDTO(com.ctrip.framework.apollo.openapi.dto.OpenItemDTO) ItemBO(com.ctrip.framework.apollo.portal.entity.bo.ItemBO) OpenNamespaceDTO(com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO) LinkedList(java.util.LinkedList)

Aggregations

OpenItemDTO (com.ctrip.framework.apollo.openapi.dto.OpenItemDTO)1 OpenNamespaceDTO (com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO)1 ItemBO (com.ctrip.framework.apollo.portal.entity.bo.ItemBO)1 LinkedList (java.util.LinkedList)1