Search in sources :

Example 1 with ExternalStoreListDTO

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

the class ExternalStoreMappingUtil method fromExternalStoreCollectionToDTO.

/**
 * Converts a list of APIStore objects into a ExternalStoreListDTO.
 *
 * @param externalStoreCollection a collection of APIStore objects
 * @return ExternalStoreListDTO object containing ExternalStoreDTOs
 */
public static ExternalStoreListDTO fromExternalStoreCollectionToDTO(Collection<APIStore> externalStoreCollection) {
    ExternalStoreListDTO externalStoreListDTO = new ExternalStoreListDTO();
    List<ExternalStoreDTO> externalStoreDTOS = externalStoreListDTO.getList();
    if (externalStoreCollection == null) {
        externalStoreCollection = new HashSet<>();
    }
    for (APIStore externalStore : externalStoreCollection) {
        externalStoreDTOS.add(fromExternalStoreToDTO(externalStore));
    }
    externalStoreListDTO.setList(externalStoreDTOS);
    externalStoreListDTO.setCount(externalStoreDTOS.size());
    return externalStoreListDTO;
}
Also used : APIExternalStoreListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreListDTO) ExternalStoreListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreListDTO) ExternalStoreDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreDTO) APIExternalStoreDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreDTO) APIStore(org.wso2.carbon.apimgt.api.model.APIStore)

Aggregations

APIStore (org.wso2.carbon.apimgt.api.model.APIStore)1 APIExternalStoreDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreDTO)1 APIExternalStoreListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreListDTO)1 ExternalStoreDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreDTO)1 ExternalStoreListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreListDTO)1