private Optional<UiSchema> addUpdate(final PropertyContext<?> root) { final SimplePropertyDefinition property = root.getProperty(); return ofNullable(property.getMetadata().get("action::update")) .flatMap(v -> (actions == null ? Stream.<ActionReference> empty() : actions.stream()) .filter(a -> a.getName().equals(v) && "update".equals(a.getType())) .findFirst()) .map(action -> { final UiSchema.Trigger trigger = toTrigger(properties, root.getProperty(), action); final String path = property.getPath(); trigger .setOptions(singletonList(new UiSchema.Option.Builder() .withPath(path.endsWith("[]") ? path.substring(0, path.length() - "[]".length()) : path) .withType(property.getType().toLowerCase(ROOT)) .build())); final UiSchema button = new UiSchema(); button .setTitle(action.getDisplayName() == null ? action.getName() + " (" + action.getType() + ')' : action.getDisplayName()); button.setWidget("button"); button.setTriggers(singletonList(trigger)); return button; }); }
.setTitle(ref.getDisplayName() == null || ref.getName().equals(ref.getDisplayName()) ? "Guess Schema" : ref.getDisplayName()); button.setWidget("button"); button.setTriggers(singletonList(trigger));
.setTitle(ref.getDisplayName() == null || ref.getName().equals(ref.getDisplayName()) ? "Validate Connection" : ref.getDisplayName()); button.setWidget("button"); button.setTriggers(singletonList(trigger));