use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreDTO 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;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ExternalStoreDTO in project carbon-apimgt by wso2.
the class ExternalStoreMappingUtil method fromExternalStoreToDTO.
/**
* Converts APIStore object into a ExternalStoreDTO.
*
* @param apiStore APIStore object
* @return ExternalStoreDTO object corresponding to APIStore object
*/
public static ExternalStoreDTO fromExternalStoreToDTO(APIStore apiStore) {
ExternalStoreDTO externalStoreDTO = new ExternalStoreDTO();
externalStoreDTO.setDisplayName(apiStore.getDisplayName());
externalStoreDTO.setId(apiStore.getName());
externalStoreDTO.setType(apiStore.getType());
externalStoreDTO.setEndpoint(apiStore.getEndpoint());
return externalStoreDTO;
}
Aggregations