use of org.talend.sdk.component.server.front.model.ComponentId in project component-runtime by Talend.
the class ComponentResource method toComponentIndex.
private ComponentIndex toComponentIndex(final ClassLoader loader, final Locale locale, final String plugin, final ComponentFamilyMeta.BaseMeta meta, final ComponentManager.OriginalId originalId, final boolean includeIcon) {
final String icon = meta.getIcon();
final String familyIcon = meta.getParent().getIcon();
final IconResolver.Icon iconContent = iconResolver.resolve(loader, icon);
final IconResolver.Icon iconFamilyContent = iconResolver.resolve(loader, familyIcon);
return new ComponentIndex(new ComponentId(meta.getId(), meta.getParent().getId(), plugin, ofNullable(originalId).map(ComponentManager.OriginalId::getValue).orElse(plugin), meta.getParent().getName(), meta.getName()), meta.findBundle(loader, locale).displayName().orElse(meta.getName()), meta.getParent().findBundle(loader, locale).displayName().orElse(meta.getParent().getName()), new Icon(icon, iconContent == null ? null : iconContent.getType(), !includeIcon ? null : (iconContent == null ? null : iconContent.getBytes())), new Icon(familyIcon, iconFamilyContent == null ? null : iconFamilyContent.getType(), !includeIcon ? null : (iconFamilyContent == null ? null : iconFamilyContent.getBytes())), meta.getVersion(), meta.getParent().getCategories(), singletonList(new Link("Detail", "/component/details?identifiers=" + meta.getId(), MediaType.APPLICATION_JSON)));
}
Aggregations