use of org.wso2.carbon.apimgt.keymgt.model.entity.ApplicationKeyMappingList in project carbon-apimgt by wso2.
the class SubscriptionDataLoaderImpl method getKeyMapping.
@Override
public ApplicationKeyMapping getKeyMapping(String consumerKey, String keymanager, String tenantDomain) throws DataLoadingException {
ApplicationKeyMapping application = null;
String responseString;
String endPoint = null;
try {
keymanager = URLEncoder.encode(keymanager, APIConstants.DigestAuthConstants.CHARSET);
keymanager = keymanager.replace("\\+", "%20");
endPoint = APIConstants.SubscriptionValidationResources.APPLICATION_KEY_MAPPINGS + "?consumerKey=" + consumerKey + "&keymanager=" + keymanager;
responseString = invokeService(endPoint, tenantDomain);
} catch (IOException e) {
String msg = "Error while executing the http client " + endPoint;
log.error(msg, e);
throw new DataLoadingException(msg, e);
}
if (responseString != null && !responseString.isEmpty()) {
ApplicationKeyMappingList list = new Gson().fromJson(responseString, ApplicationKeyMappingList.class);
if (list.getList() != null && !list.getList().isEmpty()) {
application = list.getList().get(0);
}
}
return application;
}
Aggregations