Search in sources :

Example 1 with AvailableResourcesProvider

use of org.eclipse.che.multiuser.resource.api.AvailableResourcesProvider in project che-server by eclipse-che.

the class ResourceManager method getAvailableResources.

/**
 * Returns list of resources which are available for usage by given account.
 *
 * @param accountId id of account
 * @return list of resources which are available for usage by given account
 * @throws NotFoundException when account with specified id was not found
 * @throws ServerException when some exception occurred while resources fetching
 */
public List<? extends Resource> getAvailableResources(String accountId) throws NotFoundException, ServerException {
    final Account account = accountManager.getById(accountId);
    final AvailableResourcesProvider availableResourcesProvider = accountTypeToAvailableResourcesProvider.get(account.getType());
    if (availableResourcesProvider == null) {
        return defaultAvailableResourcesProvider.getAvailableResources(accountId);
    }
    return availableResourcesProvider.getAvailableResources(accountId);
}
Also used : Account(org.eclipse.che.account.shared.model.Account) AvailableResourcesProvider(org.eclipse.che.multiuser.resource.api.AvailableResourcesProvider)

Example 2 with AvailableResourcesProvider

use of org.eclipse.che.multiuser.resource.api.AvailableResourcesProvider in project devspaces-images by redhat-developer.

the class ResourceManager method getAvailableResources.

/**
 * Returns list of resources which are available for usage by given account.
 *
 * @param accountId id of account
 * @return list of resources which are available for usage by given account
 * @throws NotFoundException when account with specified id was not found
 * @throws ServerException when some exception occurred while resources fetching
 */
public List<? extends Resource> getAvailableResources(String accountId) throws NotFoundException, ServerException {
    final Account account = accountManager.getById(accountId);
    final AvailableResourcesProvider availableResourcesProvider = accountTypeToAvailableResourcesProvider.get(account.getType());
    if (availableResourcesProvider == null) {
        return defaultAvailableResourcesProvider.getAvailableResources(accountId);
    }
    return availableResourcesProvider.getAvailableResources(accountId);
}
Also used : Account(org.eclipse.che.account.shared.model.Account) AvailableResourcesProvider(org.eclipse.che.multiuser.resource.api.AvailableResourcesProvider)

Aggregations

Account (org.eclipse.che.account.shared.model.Account)2 AvailableResourcesProvider (org.eclipse.che.multiuser.resource.api.AvailableResourcesProvider)2