use of org.wso2.carbon.apimgt.persistence.dto.PublisherAPISearchResult in project carbon-apimgt by wso2.
the class AbstractAPIManager method getAllAPIs.
public List<API> getAllAPIs() throws APIManagementException {
List<API> apiSortedList = new ArrayList<API>();
Organization org = new Organization(tenantDomain);
String[] roles = APIUtil.getFilteredUserRoles(username);
Map<String, Object> properties = APIUtil.getUserProperties(username);
UserContext userCtx = new UserContext(username, org, properties, roles);
try {
PublisherAPISearchResult searchAPIs = apiPersistenceInstance.searchAPIsForPublisher(org, "", 0, Integer.MAX_VALUE, userCtx, null, null);
if (searchAPIs != null) {
List<PublisherAPIInfo> list = searchAPIs.getPublisherAPIInfoList();
for (PublisherAPIInfo publisherAPIInfo : list) {
API mappedAPI = APIMapper.INSTANCE.toApi(publisherAPIInfo);
apiSortedList.add(mappedAPI);
}
}
} catch (APIPersistenceException e) {
throw new APIManagementException("Error while searching the api ", e);
}
Collections.sort(apiSortedList, new APINameComparator());
return apiSortedList;
}
Aggregations