Search in sources :

Example 1 with Ratable

use of org.xwiki.extension.repository.rating.Ratable in project xwiki-platform by xwiki.

the class ExtensionRatingScriptService method getRating.

/**
 * @param extensionId the extension id
 * @param extensionVersion the extension version
 * @return the rating of an extension
 */
public ExtensionRating getRating(String extensionId, String extensionVersion) {
    setError(null);
    Collection<ExtensionRepository> repositories = getRepositories();
    for (ExtensionRepository repository : repositories) {
        if (repository instanceof Ratable) {
            try {
                setError(null);
                return ((Ratable) repository).getRating(extensionId, extensionVersion);
            } catch (ResolveException e) {
                setError(e);
                // Keep looking. Maybe there's another repository with the same extension.
                continue;
            }
        }
    }
    return null;
}
Also used : ResolveException(org.xwiki.extension.ResolveException) ExtensionRepository(org.xwiki.extension.repository.ExtensionRepository) Ratable(org.xwiki.extension.repository.rating.Ratable)

Aggregations

ResolveException (org.xwiki.extension.ResolveException)1 ExtensionRepository (org.xwiki.extension.repository.ExtensionRepository)1 Ratable (org.xwiki.extension.repository.rating.Ratable)1