Source:
<code>public Response applicationPoliciesGet(String xWSO2Tenant, String policyName, MessageContext messageContext) { SubscriptionValidationDAO subscriptionValidationDAO = new SubscriptionValidationDAO(); String validatedTenantDomain = InternalServiceDataUtil.validateTenantDomain(xWSO2Tenant); if (StringUtils.isNotEmpty(xWSO2Tenant)) { if (StringUtils.isNotEmpty(policyName)) { if (InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { List<ApplicationPolicy> model = new ArrayList<>(); ApplicationPolicy applicationPolicy = subscriptionValidationDAO. getApplicationPolicyByNameForTenant(policyName, validatedTenantDomain); if (applicationPolicy != null) { model.add(applicationPolicy); } return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(model)).build(); } } else { if (InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(subscriptionValidationDAO. getAllApplicationPolicies(validatedTenantDomain))).build(); } } } else { if (StringUtils.isNotEmpty(policyName)) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode(), <START> "X-WSo2-Tenant header is missing.").build(); <END> } else { if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(validatedTenantDomain) && InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(subscriptionValidationDAO. getAllApplicationPolicies())).build(); } else { InternalServiceDataUtil.handleUnauthorizedError(); } } } return null; }</code><technical_language>WSO2</technical_language>

Target:
public Response applicationPoliciesGet(String xWSO2Tenant, String policyName, MessageContext messageContext) { SubscriptionValidationDAO subscriptionValidationDAO = new SubscriptionValidationDAO(); String validatedTenantDomain = InternalServiceDataUtil.validateTenantDomain(xWSO2Tenant); if (StringUtils.isNotEmpty(xWSO2Tenant)) { if (StringUtils.isNotEmpty(policyName)) { if (InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { List<ApplicationPolicy> model = new ArrayList<>(); ApplicationPolicy applicationPolicy = subscriptionValidationDAO. getApplicationPolicyByNameForTenant(policyName, validatedTenantDomain); if (applicationPolicy != null) { model.add(applicationPolicy); } return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(model)).build(); } } else { if (InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(subscriptionValidationDAO. getAllApplicationPolicies(validatedTenantDomain))).build(); } } } else { if (StringUtils.isNotEmpty(policyName)) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode(), "X-WSO2-Tenant header is missing.").build(); } else { if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(validatedTenantDomain) && InternalServiceDataUtil.isUserAuthorizedToTenant(validatedTenantDomain)) { return Response.ok().entity(InternalServiceDataUtil. fromApplicationPolicyToApplicationPolicyListDTO(subscriptionValidationDAO. getAllApplicationPolicies())).build(); } else { InternalServiceDataUtil.handleUnauthorizedError(); } } } return null; }