/** * Search installed extensions based of the provided query. * * @param query the extension query used to filter and order the result * @return the found extensions descriptors, empty list if nothing could be found * @throws SearchException error when trying to search provided pattern * @since 8.1RC1 */ default IterableResult<InstalledExtension> searchInstalledExtensions(ExtensionQuery query) throws SearchException { return searchInstalledExtensions((String) null, query); }
/** * Search installed extensions based of the provided query and only in the passed namespaces. * * @param namespaces the namespaces where to search * @param query the extension query used to filter and order the result * @return the found extensions descriptors, empty list if nothing could be found * @throws SearchException error when trying to search provided pattern * @since 8.1RC1 */ default IterableResult<InstalledExtension> searchInstalledExtensions(Collection<String> namespaces, ExtensionQuery query) throws SearchException { return searchInstalledExtensions( namespaces != null && !namespaces.isEmpty() ? namespaces.iterator().next() : null, query); } }
@Override public IterableResult<Extension> search(ExtensionQuery query) throws SearchException { return (IterableResult) (this.namespace != null ? getWrapped().searchInstalledExtensions(this.serializedNamespace, query) : getWrapped().searchInstalledExtensions(query)); } }
@Override public IterableResult<InstalledExtension> searchInstalledExtensions(String namespace, ExtensionQuery query) throws SearchException { return safe(getWrapped().searchInstalledExtensions(namespace, query)); }
@Override public IterableResult<InstalledExtension> searchInstalledExtensions(ExtensionQuery query) throws SearchException { return safe(getWrapped().searchInstalledExtensions(query)); }
@Override public IterableResult<InstalledExtension> searchInstalledExtensions(String pattern, String namespace, int offset, int nb) throws SearchException { return safe(getWrapped().searchInstalledExtensions(pattern, namespace, offset, nb)); }
@Override public IterableResult<InstalledExtension> searchInstalledExtensions(Collection<String> namespaces, ExtensionQuery query) throws SearchException { return safe(getWrapped().searchInstalledExtensions(namespaces, query)); } }
@Override public InstalledExtension getFlavorExtension(Namespace namespace) { try { for (InstalledExtension extension : this.installedRepository .searchInstalledExtensions(namespace.serialize(), new FlavorQuery())) { // Assume there is only one non dependency with the tag "flavor" so return the first one found if (!extension.isDependency(namespace.serialize())) { // There should be only one flavor per wiki return extension; } } } catch (SearchException e) { // It should never happen with the local repository } // If nothing has been found, look for extensions that was not tagged as flavors but that are in the list of // old flavors for (String oldFlavor : getExtensionsConsideredAsFlavors()) { InstalledExtension installedExtension = this.installedRepository.getInstalledExtension(oldFlavor, namespace.serialize()); if (installedExtension != null) { return installedExtension; } } // It seems there is no known UI on this wiki return null; }