@Test void triggerArrayParameters() throws Exception { try (final Jsonb jsonb = JsonbBuilder.create(); final InputStream stream = Thread .currentThread() .getContextClassLoader() .getResourceAsStream("object-array-in-parameter.json")) { final ComponentDetail details = jsonb.fromJson(stream, ComponentDetail.class); final AtomicReference<UiSchema.Trigger> trigger = new AtomicReference<>(); new AbstractWidgetConverter(new ArrayList<>(), details.getProperties(), emptyList(), new JsonSchema(), "en") { @Override public CompletionStage<PropertyContext<?>> convert(final CompletionStage<PropertyContext<?>> context) { throw new UnsupportedOperationException(); } { trigger .set(toTrigger(details.getProperties(), details .getProperties() .stream() .filter(it -> it.getName().equals("filterAdvancedValueWrapper")) .findFirst() .orElseThrow(IllegalArgumentException::new), details .getActions() .stream() .filter(it -> it.getName().equals("updatableFilterAdvanced")) .findFirst() .orElseThrow(IllegalArgumentException::new))); } }; final UiSchema.Parameter parameter = trigger .get() .getParameters() .stream() .filter(it -> it.getPath().equals("configuration.selectionFilter.filterLines")) .findFirst() .orElseThrow(IllegalStateException::new); assertEquals("filterLines", parameter.getKey()); } }
protected UiSchema.Trigger toTrigger(final Collection<SimplePropertyDefinition> properties, final SimplePropertyDefinition prop, final ActionReference ref) { final UiSchema.Trigger trigger = new UiSchema.Trigger(); trigger .setAction(prop .getMetadata() .entrySet() .stream() .filter(it -> matchAction(it, ref)) .findFirst() .map(Map.Entry::getValue) .orElseGet(ref::getName)); trigger.setFamily(ref.getFamily()); trigger.setType(ref.getType()); trigger .setParameters(toParams(properties, prop, ref, prop.getMetadata().get("action::" + ref.getType() + "::parameters"))); return trigger; }
AbstractWidgetConverter implements PropertyConverter { protected UiSchema.Trigger toTrigger(final Collection<SimplePropertyDefinition> properties, final SimplePropertyDefinition prop, final ActionReference ref) { final UiSchema.Trigger trigger = new UiSchema.Trigger(); trigger .setAction(prop .getMetadata() .entrySet() .stream() .filter(it -> matchAction(it, ref)) .findFirst() .map(Map.Entry::getValue) .orElseGet(ref::getName)); trigger.setFamily(ref.getFamily()); trigger.setType(ref.getType()); trigger .setParameters(toParams(properties, prop, ref, prop.getMetadata().get("action::" + ref.getType() + "::parameters"))); return trigger; } }
AbstractWidgetConverter implements PropertyConverter { protected UiSchema.Trigger toTrigger(final Collection<SimplePropertyDefinition> properties, final SimplePropertyDefinition prop, final ActionReference ref) { final UiSchema.Trigger trigger = new UiSchema.Trigger(); trigger .setAction(prop .getMetadata() .entrySet() .stream() .filter(it -> matchAction(it, ref)) .findFirst() .map(Map.Entry::getValue) .orElseGet(ref::getName)); trigger.setFamily(ref.getFamily()); trigger.setType(ref.getType()); trigger .setParameters(toParams(properties, prop, ref, prop.getMetadata().get("action::" + ref.getType() + "::parameters"))); return trigger; }  }
AbstractWidgetConverter implements PropertyConverter { protected UiSchema.Trigger toTrigger(final Collection<SimplePropertyDefinition> properties, final SimplePropertyDefinition prop, final ActionReference ref) { final UiSchema.Trigger trigger = new UiSchema.Trigger(); trigger .setAction(prop .getMetadata() .entrySet() .stream() .filter(it -> matchAction(it, ref)) .findFirst() .map(Map.Entry::getValue) .orElseGet(ref::getName)); trigger.setFamily(ref.getFamily()); trigger.setType(ref.getType()); trigger .setParameters(toParams(properties, prop, ref, prop.getMetadata().get("action::" + ref.getType() + "::parameters"))); return trigger; }   }
AbstractWidgetConverter implements PropertyConverter { protected UiSchema.Trigger toTrigger(final Collection<SimplePropertyDefinition> properties, final SimplePropertyDefinition prop, final ActionReference ref) { final UiSchema.Trigger trigger = new UiSchema.Trigger(); trigger .setAction(prop .getMetadata() .entrySet() .stream() .filter(it -> matchAction(it, ref)) .findFirst() .map(Map.Entry::getValue) .orElseGet(ref::getName)); trigger.setFamily(ref.getFamily()); trigger.setType(ref.getType()); trigger .setParameters(toParams(properties, prop, ref, prop.getMetadata().get("action::" + ref.getType() + "::parameters"))); return trigger; }    }