use of org.wso2.carbon.apimgt.keymgt.model.entity.ApplicationList in project carbon-apimgt by wso2.
the class GatewayUtils method generateApplicationList.
public static ApplicationListDTO generateApplicationList(List<Application> applicationList, SubscriptionDataStore subscriptionDataStore) {
ApplicationListDTO applicationListDTO = new ApplicationListDTO();
List<ApplicationInfoDTO> applicationInfoDTOList = new ArrayList<>();
for (Application application : applicationList) {
ApplicationInfoDTO applicationInfoDTO = new ApplicationInfoDTO().id(application.getId()).name(application.getName()).policy(application.getPolicy()).attributes(application.getAttributes()).subName(application.getSubName()).uuid(application.getUUID()).tokenType(application.getTokenType()).keys(convertToApplicationKeyMapping(application.getId(), subscriptionDataStore));
applicationInfoDTOList.add(applicationInfoDTO);
}
applicationListDTO.setList(applicationInfoDTOList);
applicationListDTO.setCount(applicationInfoDTOList.size());
return applicationListDTO;
}
use of org.wso2.carbon.apimgt.keymgt.model.entity.ApplicationList in project carbon-apimgt by wso2.
the class SubscriptionDataLoaderImpl method getApplicationById.
@Override
public Application getApplicationById(int appId) throws DataLoadingException {
String endPoint = APIConstants.SubscriptionValidationResources.APPLICATIONS + "?appId=" + appId;
Application application = null;
String responseString;
try {
responseString = invokeService(endPoint, null);
} 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()) {
ApplicationList list = new Gson().fromJson(responseString, ApplicationList.class);
if (list.getList() != null && !list.getList().isEmpty()) {
application = list.getList().get(0);
}
}
return application;
}
Aggregations