Search in sources :

Example 1 with SubscriptionInfoDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.SubscriptionInfoDTO in project carbon-apimgt by wso2.

the class AnalyticsMappingUtil method fromSubscriptionInfoListToDTO.

public static SubscriptionInfoListDTO fromSubscriptionInfoListToDTO(List<SubscriptionInfo> subscriptionInfoList, ZoneId zoneId) {
    SubscriptionInfoListDTO subscriptionCountListDTO = new SubscriptionInfoListDTO();
    List<SubscriptionInfoDTO> subscriptionInfoDTOList = new ArrayList<>();
    subscriptionCountListDTO.setCount(subscriptionInfoList.size());
    for (SubscriptionInfo subscriptionInfo : subscriptionInfoList) {
        SubscriptionInfoDTO subscriptionInfoDTO = new SubscriptionInfoDTO();
        subscriptionInfoDTO.setId(subscriptionInfo.getId());
        subscriptionInfoDTO.setName(subscriptionInfo.getName());
        subscriptionInfoDTO.setVersion(subscriptionInfo.getVersion());
        subscriptionInfoDTO.setAppName(subscriptionInfo.getAppName());
        subscriptionInfoDTO.setDescription(subscriptionInfo.getDescription());
        subscriptionInfoDTO.setCreatedTime(epochToISO8601DateTime(subscriptionInfo.getCreatedTime(), zoneId));
        subscriptionInfoDTO.setSubscriptionStatus(subscriptionInfo.getSubscriptionStatus());
        subscriptionInfoDTO.setSubscriptionTier(subscriptionInfo.getSubscriptionTier());
        subscriptionInfoDTOList.add(subscriptionInfoDTO);
    }
    subscriptionCountListDTO.setList(subscriptionInfoDTOList);
    return subscriptionCountListDTO;
}
Also used : SubscriptionInfoDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionInfoDTO) SubscriptionInfoListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionInfoListDTO) ArrayList(java.util.ArrayList) SubscriptionInfo(org.wso2.carbon.apimgt.core.models.analytics.SubscriptionInfo)

Example 2 with SubscriptionInfoDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.SubscriptionInfoDTO in project carbon-apimgt by wso2.

the class GatewayUtils method convertSubscriptionsToSubscriptionInfo.

private static List<SubscriptionInfoDTO> convertSubscriptionsToSubscriptionInfo(List<Subscription> subscriptions, SubscriptionDataStore subscriptionDataStore) {
    List<SubscriptionInfoDTO> subscriptionInfoDTOList = new ArrayList<>();
    for (Subscription subscription : subscriptions) {
        SubscriptionInfoDTO subscriptionInfoDTO = new SubscriptionInfoDTO();
        subscriptionInfoDTO.setStatus(subscription.getSubscriptionState());
        subscriptionInfoDTO.setSubscriptionUUID(subscription.getSubscriptionUUId());
        subscriptionInfoDTO.setSubscriptionPolicy(subscription.getPolicyId());
        subscriptionInfoDTO.setApplication(convertToApplicationDto(subscription.getAppId(), subscriptionDataStore));
        subscriptionInfoDTOList.add(subscriptionInfoDTO);
    }
    return subscriptionInfoDTOList;
}
Also used : SubscriptionInfoDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.SubscriptionInfoDTO) ArrayList(java.util.ArrayList) Subscription(org.wso2.carbon.apimgt.keymgt.model.entity.Subscription)

Aggregations

ArrayList (java.util.ArrayList)2 SubscriptionInfo (org.wso2.carbon.apimgt.core.models.analytics.SubscriptionInfo)1 Subscription (org.wso2.carbon.apimgt.keymgt.model.entity.Subscription)1 SubscriptionInfoDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionInfoDTO)1 SubscriptionInfoListDTO (org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionInfoListDTO)1 SubscriptionInfoDTO (org.wso2.carbon.apimgt.rest.api.gateway.dto.SubscriptionInfoDTO)1