@Override public IBeanValidationConstraint apply(IConfigurationElement input) { return (IBeanValidationConstraint) CoreTerminologyBroker.getInstance().createExecutableExtension(input); } }));
private Collection<IComponentValidationConstraint<IComponent<?>>> getConstraints(final IComponent<?> component) { final String terminologyComponentId = CoreTerminologyBroker.getInstance().getTerminologyComponentId(component); try { return cache.get(terminologyComponentId); } catch (final ExecutionException e) { LOGGER.error("Error while retrieving validation constraints for component: " + component, e); return emptyList(); } } }
public static CoreTerminologyBroker getInstance() { if (instance == null) { synchronized (CoreTerminologyBroker.class) { if (instance == null) instance = new CoreTerminologyBroker(); } } return instance; }
/** * Returns the short value of the terminology component identifier associated with the given terminology component representation class. * @param terminologyComponentClass * @return */ public short getTerminologyComponentIdShort(Class<?> terminologyComponentClass) { return getTerminologyComponentIdAsShort(getTerminologyComponentId(terminologyComponentClass)); }
/**Sugar for {@link #getComponentIconIdProvider(String)}.*/ public <K> IComponentIconIdProvider<K> getComponentIconIdProvider(final short terminologyComponentId) { return getComponentIconIdProvider(getTerminologyComponentId(terminologyComponentId)); }
public ICoreTerminologyComponentInformation getComponentInformation(final Object object) { Preconditions.checkNotNull(object, "Object argument cannot be null."); return getComponentInformation(CoreTerminologyBroker.getInstance().getTerminologyComponentId(object)); }
public ISearchResultProvider<String, IComponent<String>> getSearchResultProvider(final String terminologyComponentId) { return (ISearchResultProvider<String, IComponent<String>>) createExecutableExtension(getTerminologyComponentLevelConfigurationElement(terminologyComponentId, SEARCH_RESULT_PROVIDER_EXTENSION_POINT_ID)); }
/**Returns with the {@link IClientTerminologyBrowserFactory terminology browser factory} for the given terminology component ID argument. *<p>If there are no registered terminology browser factories associated with the given terminology component ID, this method returns with a factory *which creates an {@link ClientTerminologyBrowserAdapter empty terminology browser}. That empty terminology browser instance always returns with {@code true} *for {@link IClientTerminologyBrowser#isTerminologyAvailable()} invocation.*/ public IClientTerminologyBrowserFactory<String, IComponent<String>, IClientTerminologyBrowser<IComponent<String>, String>> getTerminologyBrowserFactory( final String terminologyComponentId) { final IConfigurationElement configurationElement = getTerminologyLevelConfigurationElementUnsafe(getTerminologyId(terminologyComponentId), TERMINOLOGY_BROWSER_FACTORY_EXTENSION_POINT_ID); if (null == configurationElement) { return new IClientTerminologyBrowserFactory<String, IComponent<String>, IClientTerminologyBrowser<IComponent<String>,String>>() { @Override public IClientTerminologyBrowser<IComponent<String>, String> getTerminologyBrowser() { return EMPTY_CLIENT_BROWSER; } @Override public IClientTerminologyBrowser<IComponent<String>, String> getTerminologyBrowser(IBranchPath branchPath) { return EMPTY_CLIENT_BROWSER; } }; } return (IClientTerminologyBrowserFactory<String, IComponent<String>, IClientTerminologyBrowser<IComponent<String>, String>>) createExecutableExtension(configurationElement); }
public ICoreTerminologyComponentInformation getComponentInformation(final short terminologyComponentId) { return getComponentInformation(getTerminologyComponentId(terminologyComponentId)); }
public boolean isHierarchical(final Object object) { return isHierarchical(getTerminologyComponentId(object)); }
/** Returns with the primary component ID for the underlying tooling feature. */ protected String getPrimaryComponentId() { return CoreTerminologyBroker.getInstance().getPrimaryComponentIdByTerminologyId(getToolingId()); }
@Override public String load(final Short key) throws Exception { if (null == key) { return EMPTY_STRING; } final ICoreTerminologyComponentInformation information = // CoreTerminologyBroker.getInstance().getComponentInformation(key.shortValue()); return null == information ? EMPTY_STRING : information.getName(); } });
private String getToolingName() { return CoreTerminologyBroker.getInstance().getTerminologyName(getToolingId()); }
private Collection<IIndexEntry> getUnmodifiableSet(final String terminologyComponentId, final String componentId, MembershipSearchResultProviderStrategy<IMappingSetMembershipLookupService> provider) { Set<IIndexEntry> result = Sets.newHashSet(); Collection<IMappingSetMembershipLookupService> lookupServices = CoreTerminologyBroker.getInstance().getMappingSetMembershipLookupServices(); for (IMappingSetMembershipLookupService service : lookupServices) { result.addAll(provider.getComponents(service, terminologyComponentId, componentId)); } return Collections.unmodifiableSet(result); }
private Collection<IIndexEntry> getUnmodifiableSet(final String codeSystemShortName, final String componentId, MembershipSearchResultProviderStrategy<IValueSetMembershipLookupService> provider) { final Set<IIndexEntry> result = Sets.newHashSet(); final Collection<IValueSetMembershipLookupService> lookupServices = CoreTerminologyBroker.getInstance().getValueSetMembershipLookupServices(); for (final IValueSetMembershipLookupService service : lookupServices) { result.addAll(provider.getComponents(service, codeSystemShortName, componentId)); } return Collections.unmodifiableSet(result); }
@SuppressWarnings("unchecked") public Optional<ITerminologyComponentUriResolver<IComponent<?>>> getUriResolver(String uri) { checkNotNull(uri, "URI must not be null."); if (!UriUtils.isTerminologyUri(uri)) { return Optional.absent(); } List<String> uriSegments = UriUtils.getUriSegments(uri); String terminologyOid = uriSegments.get(UriUtils.TERMINOLOGY_OID_INDEX); String terminologyId = CoreTerminologyBroker.getInstance().getTerminologyIdByOid(terminologyOid); IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(URI_RESOLVER_EXTENSION_ID); for (final IConfigurationElement element : configurationElements) { try { if (terminologyId.equals(element.getAttribute(TERMINOLOGY_ATTRIBUTE_NAME))) { return Optional.of((ITerminologyComponentUriResolver<IComponent<?>>) element.createExecutableExtension(CLASS_ATTRIBUTE_NAME)); } } catch (CoreException e) { throw new RuntimeException("Error when instantiating terminology component URI resolver.", e); } } return Optional.absent(); } }
public synchronized Set<String> getClassesForComponentId(final short terminologyComponentId) { if (UNSPECIFIED_NUMBER_SHORT == terminologyComponentId) { return Collections.emptySet(); } final Set<String> classes = SHORT_TO_CLASS_CACHE.get(terminologyComponentId); if (!CompareUtils.isEmpty(classes)) { return classes; } final Set<String> representationClasses = getClassesForComponentId(getTerminologyComponentId(terminologyComponentId)); for (String representationClass : representationClasses) { SHORT_TO_CLASS_CACHE.put(terminologyComponentId, representationClass); } return SHORT_TO_CLASS_CACHE.get(terminologyComponentId); }
public Collection<IMappingSetMembershipLookupService> getMappingSetMembershipLookupServices() { final Set<IMappingSetMembershipLookupService> searchers = Sets.newHashSet(); final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(MAPPING_SET_MEMBERSHIP_LOOKUP_SERVICE_EXTENSION_POINT_ID); for (final IConfigurationElement element : elements) { searchers.add((IMappingSetMembershipLookupService) createExecutableExtension(element)); } return searchers; }
public String getTerminologyComponentId(final short shortId) { return getTerminologyComponentId((int) shortId); }
@Override public void init(SnowOwlConfiguration configuration, Environment env) { final PreferencesService preferences = env.preferences(); final ClientPreferences cdoClientConfiguration = new ClientPreferences(preferences); env.services().registerService(ClientPreferences.class, cdoClientConfiguration); final LoginConfiguration loginConfiguration = new LoginConfiguration(preferences); env.services().registerService(LoginConfiguration.class, loginConfiguration); env.services().registerService(CoreTerminologyBroker.class, CoreTerminologyBroker.getInstance()); if (configuration.getModuleConfig(MetricsConfiguration.class).isEnabled()) { env.services().registerService(MetricsProvider.class, new DefaultMetricsProvider()); } else { env.services().registerService(MetricsProvider.class, MetricsProvider.NOOP); } env.services().registerService(Metrics.class, Metrics.NOOP); // TODO support initial values for feature toggles env.services().registerService(FeatureToggles.class, new FeatureToggles()); }