use of org.wso2.carbon.apimgt.persistence.exceptions.OASPersistenceException in project carbon-apimgt by wso2.
the class APIConsumerImpl method getAPIorAPIProductByUUIDWithoutPermissionCheck.
/**
* Used to retrieve API/API Products without performing the visibility permission checks
* @param uuid
* @param organization
* @return
* @throws APIManagementException
*/
private ApiTypeWrapper getAPIorAPIProductByUUIDWithoutPermissionCheck(String uuid, String organization) throws APIManagementException {
try {
Organization org = new Organization(organization);
DevPortalAPI devPortalApi = apiPersistenceInstance.getDevPortalAPI(org, uuid);
if (devPortalApi != null) {
if (APIConstants.API_PRODUCT.equalsIgnoreCase(devPortalApi.getType())) {
APIProduct apiProduct = APIMapper.INSTANCE.toApiProduct(devPortalApi);
apiProduct.setID(new APIProductIdentifier(devPortalApi.getProviderName(), devPortalApi.getApiName(), devPortalApi.getVersion()));
populateAPIProductInformation(uuid, organization, apiProduct);
return new ApiTypeWrapper(apiProduct);
} else {
API api = APIMapper.INSTANCE.toApi(devPortalApi);
populateDevPortalAPIInformation(uuid, organization, api);
populateDefaultVersion(api);
api = addTiersToAPI(api, organization);
return new ApiTypeWrapper(api);
}
} else {
String msg = "Failed to get API. API artifact corresponding to artifactId " + uuid + " does not exist";
throw new APIMgtResourceNotFoundException(msg);
}
} catch (APIPersistenceException | OASPersistenceException | ParseException e) {
String msg = "Failed to get API";
throw new APIManagementException(msg, e);
}
}
Aggregations