Search in sources :

Example 1 with EventCountLimitDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO in project carbon-apimgt by wso2.

the class CommonThrottleMappingUtil method fromDTOToEventCountLimit.

private static EventCountLimit fromDTOToEventCountLimit(EventCountLimitDTO dto) {
    EventCountLimit eventCountLimit = new EventCountLimit();
    eventCountLimit.setTimeUnit(dto.getTimeUnit());
    eventCountLimit.setUnitTime(dto.getUnitTime());
    eventCountLimit.setEventCount(dto.getEventCount());
    return eventCountLimit;
}
Also used : EventCountLimit(org.wso2.carbon.apimgt.api.model.policy.EventCountLimit)

Example 2 with EventCountLimitDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO in project carbon-apimgt by wso2.

the class ThrottlingPolicyMappingUtil method fromSubscriptionToDTO.

public static SubscriptionPolicyDTO fromSubscriptionToDTO(SubscriptionPolicy subscriptionPolicy, int position) {
    SubscriptionPolicyDTO dto = new SubscriptionPolicyDTO();
    dto.setRateLimitCount(subscriptionPolicy.getRateLimitCount());
    dto.setRateLimitTimeUnit(subscriptionPolicy.getRateLimitTimeUnit());
    dto.setStopOnQuotaReach(subscriptionPolicy.isStopOnQuotaReach());
    ThrottleLimitDTO limitDTO = new ThrottleLimitDTO();
    limitDTO.setType(ThrottleLimitDTO.TypeEnum.EVENTCOUNTLIMIT);
    EventCountLimit eventCountLimit = (EventCountLimit) subscriptionPolicy.getDefaultQuotaPolicy().getLimit();
    EventCountLimitDTO eventCountLimitDTO = new EventCountLimitDTO();
    eventCountLimitDTO.setEventCount(eventCountLimit.getEventCount());
    eventCountLimitDTO.setTimeUnit(eventCountLimit.getTimeUnit());
    eventCountLimitDTO.setUnitTime(eventCountLimit.getUnitTime());
    limitDTO.setEventCount(eventCountLimitDTO);
    dto.setDefaultLimit(limitDTO);
    dto.setSubscriberCount(subscriptionPolicy.getSubscriberCount());
    dto.setDisplayName(subscriptionPolicy.getDisplayName());
    dto.setDescription(subscriptionPolicy.getDescription());
    dto.setIsDeployed(subscriptionPolicy.isDeployed());
    dto.setPolicyName(subscriptionPolicy.getPolicyName());
    dto.setBillingPlan(subscriptionPolicy.getBillingPlan());
    dto.setPolicyId(position);
    dto.setUuid(subscriptionPolicy.getUUID());
    dto.setIsDeployed(subscriptionPolicy.isDeployed());
    dto.setTenantDomain(subscriptionPolicy.getTenantDomain());
    dto.setTenantId(subscriptionPolicy.getTenantId());
    return dto;
}
Also used : EventCountLimit(org.wso2.carbon.apimgt.api.model.policy.EventCountLimit) EventCountLimitDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.EventCountLimitDTO) ThrottleLimitDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ThrottleLimitDTO) SubscriptionPolicyDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.SubscriptionPolicyDTO)

Example 3 with EventCountLimitDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO in project carbon-apimgt by wso2.

the class SubscriptionValidationDataUtil method fromEventCountLimitToDTO.

/**
 * Converts a Event Count Limit model object into a Event Count Limit DTO object.
 *
 * @param eventCountLimit Event Count Limit model object
 * @return Event Count Limit DTO object derived from model
 */
private static EventCountLimitDTO fromEventCountLimitToDTO(EventCountLimit eventCountLimit) {
    EventCountLimitDTO dto = new EventCountLimitDTO();
    dto.setTimeUnit(eventCountLimit.getTimeUnit());
    dto.setUnitTime(eventCountLimit.getUnitTime());
    dto.setEventCount(eventCountLimit.getEventCount());
    return dto;
}
Also used : EventCountLimitDTO(org.wso2.carbon.apimgt.internal.service.dto.EventCountLimitDTO)

Example 4 with EventCountLimitDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO in project carbon-apimgt by wso2.

the class CommonThrottleMappingUtil method fromEventCountLimitToDTO.

public static EventCountLimitDTO fromEventCountLimitToDTO(EventCountLimit eventCountLimit) {
    EventCountLimitDTO dto = new EventCountLimitDTO();
    dto.setTimeUnit(eventCountLimit.getTimeUnit());
    dto.setUnitTime(eventCountLimit.getUnitTime());
    dto.setEventCount(eventCountLimit.getEventCount());
    return dto;
}
Also used : EventCountLimitDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO)

Aggregations

EventCountLimit (org.wso2.carbon.apimgt.api.model.policy.EventCountLimit)2 EventCountLimitDTO (org.wso2.carbon.apimgt.internal.service.dto.EventCountLimitDTO)1 EventCountLimitDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.EventCountLimitDTO)1 EventCountLimitDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.EventCountLimitDTO)1 SubscriptionPolicyDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.SubscriptionPolicyDTO)1 ThrottleLimitDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ThrottleLimitDTO)1