Search in sources :

Example 1 with SubscriptionCountDTO

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

the class AnalyticsMappingUtil method fromSubscriptionCountListToDTO.

/**
 * Converts and SubscriptionInfoList to SubscriptionInfoListDTO.
 *
 * @param subscriptionCountList list of SubscriptionCount objects
 * @return corresponding APIInfoListDTO object
 */
public static SubscriptionCountListDTO fromSubscriptionCountListToDTO(List<SubscriptionCount> subscriptionCountList, ZoneId zoneId) {
    SubscriptionCountListDTO subscriptionCountListDTO = new SubscriptionCountListDTO();
    List<SubscriptionCountDTO> subscriptionCountDTOList = new ArrayList<>();
    subscriptionCountListDTO.setCount(subscriptionCountList.size());
    for (SubscriptionCount subscriptionCount : subscriptionCountList) {
        SubscriptionCountDTO subscriptionCountDTO = new SubscriptionCountDTO();
        subscriptionCountDTO.setTime(epochToISO8601DateTime(subscriptionCount.getTimestamp(), zoneId));
        subscriptionCountDTO.setCount(subscriptionCount.getCount());
        subscriptionCountDTOList.add(subscriptionCountDTO);
    }
    subscriptionCountListDTO.setList(subscriptionCountDTOList);
    return subscriptionCountListDTO;
}
Also used : SubscriptionCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionCountListDTO) APISubscriptionCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountListDTO) ArrayList(java.util.ArrayList) APISubscriptionCount(org.wso2.carbon.apimgt.core.models.analytics.APISubscriptionCount) SubscriptionCount(org.wso2.carbon.apimgt.core.models.analytics.SubscriptionCount) SubscriptionCountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionCountDTO) APISubscriptionCountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountDTO)

Aggregations

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