Search in sources :

Example 1 with ApplicationCountDTO

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

the class AnalyticsMappingUtil method fromApplicationCountToListDTO.

/**
 * Converts and ApplicationCountList to ApplicationCountListDTO.
 *
 * @param applicationCountList list of ApplicationCount objects
 * @return corresponding ApplicationCountListDTO object
 */
public static ApplicationCountListDTO fromApplicationCountToListDTO(List<ApplicationCount> applicationCountList, ZoneId zoneId) {
    ApplicationCountListDTO applicationCountListDTO = new ApplicationCountListDTO();
    List<ApplicationCountDTO> applicationCountDTOList = new ArrayList<>();
    applicationCountListDTO.setCount(applicationCountList.size());
    for (ApplicationCount applicationCount : applicationCountList) {
        applicationCountDTOList.add(fromApplicationCountToDTO(applicationCount, zoneId));
    }
    applicationCountListDTO.setList(applicationCountDTOList);
    return applicationCountListDTO;
}
Also used : ApplicationCountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountDTO) ArrayList(java.util.ArrayList) ApplicationCount(org.wso2.carbon.apimgt.core.models.analytics.ApplicationCount) ApplicationCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountListDTO)

Example 2 with ApplicationCountDTO

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

the class AnalyticsMappingUtil method fromApplicationCountToDTO.

private static ApplicationCountDTO fromApplicationCountToDTO(ApplicationCount applicationCount, ZoneId zoneId) {
    ApplicationCountDTO applicationCountDTO = new ApplicationCountDTO();
    applicationCountDTO.setTime(epochToISO8601DateTime(applicationCount.getTimestamp(), zoneId));
    applicationCountDTO.setCount(applicationCount.getCount());
    return applicationCountDTO;
}
Also used : ApplicationCountDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountDTO)

Aggregations

ApplicationCountDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountDTO)2 ArrayList (java.util.ArrayList)1 ApplicationCount (org.wso2.carbon.apimgt.core.models.analytics.ApplicationCount)1 ApplicationCountListDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountListDTO)1