Search in sources :

Example 1 with APICountDTO

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

the class AnalyticsMappingUtil method fromAPICountToListDTO.

/**
 * Converts and APICountList to APICountDTO.
 *
 * @param apiCountList list of APICount objects
 * @return corresponding APICountListDTO object
 */
public static APICountListDTO fromAPICountToListDTO(List<APICount> apiCountList, ZoneId zoneId) {
    APICountListDTO apiCountListDTO = new APICountListDTO();
    List<APICountDTO> apiCountDTOList = new ArrayList<>();
    apiCountListDTO.setCount(apiCountList.size());
    for (APICount apiInfo : apiCountList) {
        apiCountDTOList.add(fromAPICountToDTO(apiInfo, zoneId));
    }
    apiCountListDTO.setList(apiCountDTOList);
    return apiCountListDTO;
}
Also used : APICount(org.wso2.carbon.apimgt.core.models.analytics.APICount) APICountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APICountListDTO) ArrayList(java.util.ArrayList) APICountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APICountDTO)

Example 2 with APICountDTO

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

the class AnalyticsMappingUtil method fromAPICountToDTO.

private static APICountDTO fromAPICountToDTO(APICount apiCount, ZoneId zoneId) {
    APICountDTO apiCountDTO = new APICountDTO();
    apiCountDTO.setTime(epochToISO8601DateTime(apiCount.getTimestamp(), zoneId));
    apiCountDTO.setCount(apiCount.getCount());
    return apiCountDTO;
}
Also used : APICountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APICountDTO)

Aggregations

APICountDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.APICountDTO)2 ArrayList (java.util.ArrayList)1 APICount (org.wso2.carbon.apimgt.core.models.analytics.APICount)1 APICountListDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.APICountListDTO)1