/** * Checks if attribute access enabled (if SetupAttributeAccessHandlers exist) */ public boolean isAttributeAccessEnabled() { Map<String, SetupAttributeAccessHandler> handlers = AppBeans.getAll(SetupAttributeAccessHandler.class); return handlers != null && !handlers.isEmpty(); }
protected Collection<PredefinedDateInterval> getPredefinedDateIntervals() { List<PredefinedDateInterval> intervals = new ArrayList<>(AppBeans.getAll(PredefinedDateInterval.class).values()); intervals.sort(new AnnotationAwareOrderComparator()); return intervals; }
protected List<HttpRequestFilter> getHttpRequestFilterBeans() { Map<String, HttpRequestFilter> beanFilters = AppBeans.getAll(HttpRequestFilter.class); List<HttpRequestFilter> availableFilters = new ArrayList<>(beanFilters.values()); AnnotationAwareOrderComparator.sort(availableFilters); return availableFilters; }
@Nullable protected PredefinedDateInterval getIntervalByName(String name) { Optional<PredefinedDateInterval> result = AppBeans.getAll(PredefinedDateInterval.class).values() .stream() .filter(interval -> name.equals(interval.getName())) .findFirst(); return (result.isPresent()) ? result.get() : null; }
@Override public String getSupportedHashMethods() { Map<String, EncryptionModule> encryptionModules = AppBeans.getAll(EncryptionModule.class); Set<String> methods = new HashSet<>(); for (EncryptionModule module : encryptionModules.values()) { methods.add(module.getHashMethod()); } return StringUtils.join(methods, ", "); }
protected EncryptionModule getEncryptionModule(String encryptionMethod) { Map<String, EncryptionModule> encryptionModules = AppBeans.getAll(EncryptionModule.class); return encryptionModules.values().stream() .filter(module -> Objects.equals(module.getHashMethod(), encryptionMethod)) .findFirst() .orElseThrow(UnsupportedHashMethodException::new); } }
public QueryImpl(EntityManagerImpl entityManager, boolean isNative, @Nullable Class resultClass) { this.entityManager = entityManager; this.emDelegate = entityManager.getDelegate(); this.isNative = isNative; this.macroHandlers = AppBeans.getAll(QueryMacroHandler.class).values(); //noinspection unchecked this.resultClass = resultClass; }
protected EncryptionModule getEncryptionModule(String hashMethod) { Map<String, EncryptionModule> encryptionModules = AppBeans.getAll(EncryptionModule.class); for (EncryptionModule module : encryptionModules.values()) { if (Objects.equals(hashMethod, module.getHashMethod())) { return module; } } throw new UnsupportedHashMethodException(); } }
public Component generateAssistanceBeanNameField(Datasource<Dashboard> datasource, String fieldId) { Map<String, DashboardViewAssistant> assistantBeanMap = AppBeans.getAll(DashboardViewAssistant.class); BeanFactory bf = ((AbstractApplicationContext) AppContext.getApplicationContext()).getBeanFactory(); List<String> prototypeBeanNames = assistantBeanMap.keySet().stream() .filter(bn -> bf.isPrototype(bn)) .collect(toList()); LookupField lookupField = componentsFactory.createComponent(LookupField.class); lookupField.setOptionsList(prototypeBeanNames); return lookupField; }
protected void replaceParamsInMacros(Query query) { Collection<QueryMacroHandler> handlers = AppBeans.getAll(QueryMacroHandler.class).values(); String modifiedQuery = query.getQueryString(); for (QueryMacroHandler handler : handlers) { modifiedQuery = handler.replaceQueryParams(modifiedQuery, queryParams); } query.setQueryString(modifiedQuery); }
/** * Checks if attribute access enabled for the current entity type. * It's based on the existence of SetupAttributeAccessHandler for the metaClass. * * @param metaClass - entity metaClass */ public boolean isAttributeAccessEnabled(MetaClass metaClass) { Map<String, SetupAttributeAccessHandler> handlers = AppBeans.getAll(SetupAttributeAccessHandler.class); if (handlers != null) { metaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metaClass); for (SetupAttributeAccessHandler handler : handlers.values()) { if (handler.supports(metaClass.getJavaClass())) { return true; } } } return false; }
SetupAttributeAccessEvent<T> event = new SetupAttributeAccessEvent<>(entity); boolean handled = false; Map<String, SetupAttributeAccessHandler> handlers = AppBeans.getAll(SetupAttributeAccessHandler.class); if (handlers != null) { for (SetupAttributeAccessHandler handler : handlers.values()) {