diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java index 4d88362bb9e2..403f826debc2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/analytics/SynapseAnalyticsDataProvider.java @@ -68,6 +68,7 @@ import java.util.Map; import static org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS; +import static org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants.HTTP_METHOD; import static org.wso2.carbon.apimgt.gateway.handlers.analytics.Constants.UNKNOWN_VALUE; public class SynapseAnalyticsDataProvider implements AnalyticsDataProvider { @@ -174,7 +175,7 @@ public API getApi() throws DataNotFoundException { org.wso2.carbon.apimgt.common.analytics.publishers.dto.URITemplate uriTemplateObj = new org.wso2.carbon.apimgt.common.analytics.publishers.dto.URITemplate(); if (uriTemplate.getHttpMethod() != null && uriTemplate.getHttpMethod() - .equals(messageContext.getProperty("api.ut.HTTP_METHOD")) && uriTemplate.getUrlPattern() != null + .equals(messageContext.getProperty(HTTP_METHOD)) && uriTemplate.getUrlPattern() != null && uriTemplate.getUrlPattern().equals(messageContext.getProperty("API_ELECTED_RESOURCE"))) { uriTemplateObj.setResourceURI(uriTemplate.getUrlPattern()); @@ -233,7 +234,7 @@ public Application getApplication() throws DataNotFoundException { @Override public Operation getOperation() throws DataNotFoundException { - String httpMethod = (String) messageContext.getProperty(APIMgtGatewayConstants.HTTP_METHOD); + String httpMethod = (String) messageContext.getProperty(HTTP_METHOD); String apiResourceTemplate = (String) messageContext.getProperty(APIConstants.API_ELECTED_RESOURCE); Operation operation = new Operation(); operation.setApiMethod(httpMethod); diff --git a/components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/utils/SubscriptionValidationDataUtil.java b/components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/utils/SubscriptionValidationDataUtil.java index 4940cad2470a..66e8bc66e2b9 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/utils/SubscriptionValidationDataUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/utils/SubscriptionValidationDataUtil.java @@ -103,7 +103,7 @@ private static APIDTO fromAPItoDTO(API model) { urlMappingDTO.setUrlPattern(urlMapping.getUrlPattern()); urlMappingDTO.setScopes(urlMapping.getScopes()); List operationPolicyDTOList = new ArrayList<>(); - for(OperationPolicy operationPolicy: urlMapping.getOperationPolicies()) { + for (OperationPolicy operationPolicy : urlMapping.getOperationPolicies()) { OperationPolicyDTO operationPolicyDTO = new OperationPolicyDTO(); operationPolicyDTO.setPolicyId(operationPolicy.getPolicyId()); operationPolicyDTO.setPolicyName(operationPolicy.getPolicyName()); @@ -117,7 +117,7 @@ private static APIDTO fromAPItoDTO(API model) { urlMappingsDTO.add(urlMappingDTO); } List apiPolicies = new ArrayList<>(); - for(OperationPolicy apiPolicy: model.getApiPolicies()) { + for (OperationPolicy apiPolicy : model.getApiPolicies()) { OperationPolicyDTO operationPolicyDTO = new OperationPolicyDTO(); operationPolicyDTO.setPolicyId(apiPolicy.getPolicyId()); operationPolicyDTO.setPolicyName(apiPolicy.getPolicyName()); @@ -159,7 +159,7 @@ public static APIListDTO fromAPIToAPIListDTO(API model) { urlMappingDTO.setUrlPattern(urlMapping.getUrlPattern()); urlMappingDTO.setScopes(urlMapping.getScopes()); List operationPolicyDTOList = new ArrayList<>(); - for(OperationPolicy operationPolicy: urlMapping.getOperationPolicies()) { + for (OperationPolicy operationPolicy : urlMapping.getOperationPolicies()) { OperationPolicyDTO operationPolicyDTO = new OperationPolicyDTO(); operationPolicyDTO.setPolicyId(operationPolicy.getPolicyId()); operationPolicyDTO.setPolicyName(operationPolicy.getPolicyName()); @@ -173,7 +173,7 @@ public static APIListDTO fromAPIToAPIListDTO(API model) { urlMappingsDTO.add(urlMappingDTO); } List apiPolicies = new ArrayList<>(); - for(OperationPolicy apiPolicy: model.getApiPolicies()) { + for (OperationPolicy apiPolicy : model.getApiPolicies()) { OperationPolicyDTO operationPolicyDTO = new OperationPolicyDTO(); operationPolicyDTO.setPolicyId(apiPolicy.getPolicyId()); operationPolicyDTO.setPolicyName(apiPolicy.getPolicyName());