Search in sources :

Example 1 with APISubscriptionCountDTO

use of org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountDTO in project carbon-apimgt by wso2.

the class AnalyticsMappingUtil method fromAPISubscriptionCountListToDTO.

/**
 * Converts and APISubscriptionCountList to APISubscriptionCountListDTO.
 *
 * @param apiSubscriptionCountList list of APISubscriptionCount objects
 * @return corresponding APISubscriptionCountListDTO object
 */
public static APISubscriptionCountListDTO fromAPISubscriptionCountListToDTO(List<APISubscriptionCount> apiSubscriptionCountList) {
    APISubscriptionCountListDTO apiSubscriptionListDTO = new APISubscriptionCountListDTO();
    List<APISubscriptionCountDTO> apiSubscriptionDTOList = new ArrayList<>();
    apiSubscriptionListDTO.setCount(apiSubscriptionCountList.size());
    for (APISubscriptionCount apiSubscriptionCount : apiSubscriptionCountList) {
        APISubscriptionCountDTO apiSubscriptionDTO = new APISubscriptionCountDTO();
        apiSubscriptionDTO.setId(apiSubscriptionCount.getId());
        apiSubscriptionDTO.setName(apiSubscriptionCount.getName());
        apiSubscriptionDTO.setVersion(apiSubscriptionCount.getVersion());
        apiSubscriptionDTO.setProvider(apiSubscriptionCount.getProvider());
        apiSubscriptionDTO.setCount(apiSubscriptionCount.getCount());
        apiSubscriptionDTOList.add(apiSubscriptionDTO);
    }
    apiSubscriptionListDTO.setList(apiSubscriptionDTOList);
    return apiSubscriptionListDTO;
}
Also used : APISubscriptionCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountListDTO) APISubscriptionCount(org.wso2.carbon.apimgt.core.models.analytics.APISubscriptionCount) APISubscriptionCountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountDTO) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 APISubscriptionCount (org.wso2.carbon.apimgt.core.models.analytics.APISubscriptionCount)1 APISubscriptionCountDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountDTO)1 APISubscriptionCountListDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountListDTO)1