use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.APIDTO in project carbon-apimgt by wso2.
the class ApisApiServiceImpl method apisApiIdSubscriptionPoliciesGet.
@Override
public Response apisApiIdSubscriptionPoliciesGet(String apiId, String xWSO2Tenant, String ifNoneMatch, MessageContext messageContext) throws APIManagementException {
String organization = RestApiUtil.getValidatedOrganization(messageContext);
APIDTO apiInfo = getAPIByAPIId(apiId, organization);
List<Tier> availableThrottlingPolicyList = new ThrottlingPoliciesApiServiceImpl().getThrottlingPolicyList(ThrottlingPolicyDTO.PolicyLevelEnum.SUBSCRIPTION.toString(), organization);
if (apiInfo != null) {
List<APITiersDTO> apiTiers = apiInfo.getTiers();
if (apiTiers != null && !apiTiers.isEmpty()) {
List<Tier> apiThrottlingPolicies = new ArrayList<>();
for (Tier policy : availableThrottlingPolicyList) {
for (APITiersDTO apiTier : apiTiers) {
if (apiTier.getTierName().equalsIgnoreCase(policy.getName())) {
apiThrottlingPolicies.add(policy);
}
}
}
return Response.ok().entity(apiThrottlingPolicies).build();
}
}
return null;
}
Aggregations