use of org.eclipse.che.multiuser.resource.api.ResourcesProvider in project che-server by eclipse-che.
the class ResourceManager method getResourceDetails.
/**
* Returns detailed information about resources which given account can use.
*
* @param accountId account id
* @return detailed information about resources which can be used by given account
* @throws NotFoundException when account with specified id was not found
* @throws ServerException when some exception occurs
*/
public ResourcesDetails getResourceDetails(String accountId) throws NotFoundException, ServerException {
final List<ProvidedResources> resources = new ArrayList<>();
for (ResourcesProvider resourcesProvider : resourcesProviders) {
resources.addAll(resourcesProvider.getResources(accountId));
}
final List<Resource> allResources = resources.stream().flatMap(providedResources -> providedResources.getResources().stream()).collect(Collectors.toList());
return new ResourcesDetailsImpl(accountId, resources, new ArrayList<>(resourceAggregator.aggregateByType(allResources).values()));
}
use of org.eclipse.che.multiuser.resource.api.ResourcesProvider in project devspaces-images by redhat-developer.
the class ResourceManager method getResourceDetails.
/**
* Returns detailed information about resources which given account can use.
*
* @param accountId account id
* @return detailed information about resources which can be used by given account
* @throws NotFoundException when account with specified id was not found
* @throws ServerException when some exception occurs
*/
public ResourcesDetails getResourceDetails(String accountId) throws NotFoundException, ServerException {
final List<ProvidedResources> resources = new ArrayList<>();
for (ResourcesProvider resourcesProvider : resourcesProviders) {
resources.addAll(resourcesProvider.getResources(accountId));
}
final List<Resource> allResources = resources.stream().flatMap(providedResources -> providedResources.getResources().stream()).collect(Collectors.toList());
return new ResourcesDetailsImpl(accountId, resources, new ArrayList<>(resourceAggregator.aggregateByType(allResources).values()));
}
Aggregations