Search in sources :

Example 1 with APIProductInfoDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductInfoDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method fromAPIProductListtoDTO.

public static APIProductListDTO fromAPIProductListtoDTO(List<APIProduct> productList) {
    APIProductListDTO listDto = new APIProductListDTO();
    List<APIProductInfoDTO> list = new ArrayList<APIProductInfoDTO>();
    for (APIProduct apiProduct : productList) {
        APIProductInfoDTO productDto = new APIProductInfoDTO();
        productDto.setName(apiProduct.getId().getName());
        productDto.setProvider(APIUtil.replaceEmailDomainBack(apiProduct.getId().getProviderName()));
        productDto.setContext(apiProduct.getContext());
        productDto.setDescription(apiProduct.getDescription());
        productDto.setState(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductInfoDTO.StateEnum.valueOf(apiProduct.getState()));
        productDto.setId(apiProduct.getUuid());
        if (apiProduct.getApiSecurity() != null) {
            productDto.setSecurityScheme(Arrays.asList(apiProduct.getApiSecurity().split(",")));
        }
        list.add(productDto);
    }
    listDto.setList(list);
    listDto.setCount(list.size());
    return listDto;
}
Also used : APIProductListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductListDTO) APIProduct(org.wso2.carbon.apimgt.api.model.APIProduct) APIProductInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductInfoDTO) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 APIProduct (org.wso2.carbon.apimgt.api.model.APIProduct)1 APIProductInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductInfoDTO)1 APIProductListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductListDTO)1