use of org.eclipse.openvsx.json.SearchEntryJson in project openvsx by eclipse.
the class LocalRegistryService method toSearchEntry.
private SearchEntryJson toSearchEntry(SearchHit<ExtensionSearch> searchHit, String serverUrl, ISearchService.Options options) {
var searchItem = searchHit.getContent();
var extension = entityManager.find(Extension.class, searchItem.id);
if (extension == null || !extension.isActive()) {
extension = new Extension();
extension.setId(searchItem.id);
search.removeSearchEntry(extension);
return null;
}
var extVer = extension.getLatest();
var entry = extVer.toSearchEntryJson();
entry.url = createApiUrl(serverUrl, "api", entry.namespace, entry.name);
entry.files = Maps.newLinkedHashMapWithExpectedSize(2);
storageUtil.addFileUrls(extVer, serverUrl, entry.files, DOWNLOAD, ICON);
if (options.includeAllVersions) {
var allVersions = Lists.newArrayList(repositories.findActiveVersions(extension));
Collections.sort(allVersions, ExtensionVersion.SORT_COMPARATOR);
entry.allVersions = CollectionUtil.map(allVersions, ev -> toVersionReference(ev, entry, serverUrl));
}
return entry;
}
Aggregations