public Set<ActionReference> getActionReference(final Stream<ParameterMeta> parameters, final String familyName, final FamilyBundle familyBundle) { return parameters .flatMap(p -> p.getMetadata().entrySet().stream()) .filter(e -> e.getKey().startsWith(ActionParameterEnricher.META_PREFIX)) .map(e -> { final String type = e.getKey().substring(ActionParameterEnricher.META_PREFIX.length()); return new ActionReference(familyName, e.getValue(), type, familyBundle.actionDisplayName(type, e.getValue()).orElse(e.getValue()), null); }) .collect(toSet()); }
private Stream<UiSchema.Trigger> createBuiltInSuggestionTriggers(final SimplePropertyDefinition property) { return ofNullable( property.getMetadata().get("action::built_in_suggestable")) .map(ref -> Stream .of(toTrigger(properties, property, new ActionReference("builtin_client", ref, "built_in_suggestable", null, emptyList()))) .peek(trigger -> { trigger.setOnEvent("focus"); trigger.setRemote(false); })) .orElseGet(Stream::empty); }
private Collection<ActionReference> findActions(final String family, final Set<ActionReference> actions, final Container container, final Locale locale, final FamilyBundle familyBundle) { final ContainerComponentRegistry registry = container.get(ContainerComponentRegistry.class); return registry .getServices() .stream() .flatMap(s -> s.getActions().stream()) .filter(s -> s.getFamily().equals(family)) .filter(s -> actions .stream() .anyMatch(e -> s.getFamily().equals(e.getFamily()) && s.getType().equals(e.getType()) && s.getAction().equals(e.getName()))) .map(s -> new ActionReference(s.getFamily(), s.getAction(), s.getType(), familyBundle.actionDisplayName(s.getType(), s.getAction()).orElse(s.getAction()), propertiesService .buildProperties(s.getParameters(), container.getLoader(), locale, null) .collect(toList()))) .collect(toList()); }