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;
}
Aggregations