@Test public void testWithoutParentContext() { SelectorData data = provider.getSelectorData(context); assertNotNull(data); assertNotNull(data.getValues()); assertTrue(data.getValues().isEmpty()); assertNull(data.getSelectedValue()); }
@Override public SelectorData getSelectorData(FormRenderingContext context) { HashMap<String, String> values = new HashMap<>(); if (context instanceof FormEditorRenderingContext && context.getParentContext() != null) { if (context.getParentContext().getModel() instanceof MultipleSubFormFieldDefinition) { FormEditorRenderingContext editorContext = (FormEditorRenderingContext) context; if (context.getParentContext() != null) { MultipleSubFormFieldDefinition subForm = (MultipleSubFormFieldDefinition) context.getParentContext().getModel(); Path path = editorContext.getFormPath(); String typeName = subForm.getStandaloneClassName(); final TableColumnMeta currentMeta = (TableColumnMeta) context.getModel(); Set<String> unavailableProperties = subForm.getColumnMetas().stream().map(TableColumnMeta::getProperty).collect(Collectors.toSet()); if (currentMeta != null && !StringUtils.isEmpty(currentMeta.getProperty())) { unavailableProperties.remove(currentMeta.getProperty()); } modelFinderService.getModel(typeName, path).getProperties().stream() .filter(property -> !unavailableProperties.contains(property.getName())) .forEachOrdered(property -> values.put(property.getName(), property.getName())); } } } return new SelectorData(values,null); }
BeanPropertiesProvider implements SystemSelectorDataProvider { @Override public SelectorData getSelectorData(FormRenderingContext context) { HashMap<String, String> values = new HashMap<>(); if (context instanceof FormEditorRenderingContext && context.getParentContext() != null) { if (context.getParentContext().getModel() instanceof MultipleSubFormFieldDefinition) { FormEditorRenderingContext editorContext = (FormEditorRenderingContext) context; if (context.getParentContext() != null) { MultipleSubFormFieldDefinition subForm = (MultipleSubFormFieldDefinition) context.getParentContext().getModel(); Path path = editorContext.getFormPath(); String typeName = subForm.getStandaloneClassName(); final TableColumnMeta currentMeta = (TableColumnMeta) context.getModel(); Set<String> unavailableProperties = subForm.getColumnMetas().stream().map(TableColumnMeta::getProperty).collect(Collectors.toSet()); if (currentMeta != null && !StringUtils.isEmpty(currentMeta.getProperty())) { unavailableProperties.remove(currentMeta.getProperty()); } modelFinderService.getModel(typeName, path).getProperties().stream() .filter(property -> !unavailableProperties.contains(property.getName())) .forEachOrdered(property -> values.put(property.getName(), property.getName())); } } } return new SelectorData(values,null); } }
BeanPropertiesProvider implements SystemSelectorDataProvider { @Override public SelectorData getSelectorData(FormRenderingContext context) { HashMap<String, String> values = new HashMap<>(); if (context instanceof FormEditorRenderingContext && context.getParentContext() != null) { if (context.getParentContext().getModel() instanceof MultipleSubFormFieldDefinition) { FormEditorRenderingContext editorContext = (FormEditorRenderingContext) context; if (context.getParentContext() != null) { MultipleSubFormFieldDefinition subForm = (MultipleSubFormFieldDefinition) context.getParentContext().getModel(); Path path = editorContext.getFormPath(); String typeName = subForm.getStandaloneClassName(); final TableColumnMeta currentMeta = (TableColumnMeta) context.getModel(); Set<String> unavailableProperties = subForm.getColumnMetas().stream().map(TableColumnMeta::getProperty).collect(Collectors.toSet()); if (currentMeta != null && !StringUtils.isEmpty(currentMeta.getProperty())) { unavailableProperties.remove(currentMeta.getProperty()); } modelFinderService.getModel(typeName, path).getProperties().stream() .filter(property -> !unavailableProperties.contains(property.getName())) .forEachOrdered(property -> values.put(property.getName(), property.getName())); } } } return new SelectorData(values,null); } @Inject  BeanPropertiesProvider(ModelFinderService modelFinderService); }
BeanPropertiesProvider implements SystemSelectorDataProvider { @Override public SelectorData getSelectorData(FormRenderingContext context) { HashMap<String, String> values = new HashMap<>(); if (context instanceof FormEditorRenderingContext && context.getParentContext() != null) { if (context.getParentContext().getModel() instanceof MultipleSubFormFieldDefinition) { FormEditorRenderingContext editorContext = (FormEditorRenderingContext) context; if (context.getParentContext() != null) { MultipleSubFormFieldDefinition subForm = (MultipleSubFormFieldDefinition) context.getParentContext().getModel(); Path path = editorContext.getFormPath(); String typeName = subForm.getStandaloneClassName(); final TableColumnMeta currentMeta = (TableColumnMeta) context.getModel(); Set<String> unavailableProperties = subForm.getColumnMetas().stream().map(TableColumnMeta::getProperty).collect(Collectors.toSet()); if (currentMeta != null && !StringUtils.isEmpty(currentMeta.getProperty())) { unavailableProperties.remove(currentMeta.getProperty()); } modelFinderService.getModel(typeName, path).getProperties().stream() .filter(property -> !unavailableProperties.contains(property.getName())) .forEachOrdered(property -> values.put(property.getName(), property.getName())); } } } return new SelectorData(values,null); } @Inject  BeanPropertiesProvider(ModelFinderService modelFinderService); @Override String getProviderName(); @Override SelectorData getSelectorData(FormRenderingContext context); }
BeanPropertiesProvider implements SystemSelectorDataProvider { @Override public SelectorData getSelectorData(FormRenderingContext context) { HashMap<String, String> values = new HashMap<>(); if (context instanceof FormEditorRenderingContext && context.getParentContext() != null) { if (context.getParentContext().getModel() instanceof MultipleSubFormFieldDefinition) { FormEditorRenderingContext editorContext = (FormEditorRenderingContext) context; if (context.getParentContext() != null) { MultipleSubFormFieldDefinition subForm = (MultipleSubFormFieldDefinition) context.getParentContext().getModel(); Path path = editorContext.getFormPath(); String typeName = subForm.getStandaloneClassName(); final TableColumnMeta currentMeta = (TableColumnMeta) context.getModel(); Set<String> unavailableProperties = subForm.getColumnMetas().stream().map(TableColumnMeta::getProperty).collect(Collectors.toSet()); if (currentMeta != null && !StringUtils.isEmpty(currentMeta.getProperty())) { unavailableProperties.remove(currentMeta.getProperty()); } modelFinderService.getModel(typeName, path).getProperties().stream() .filter(property -> !unavailableProperties.contains(property.getName())) .forEachOrdered(property -> values.put(property.getName(), property.getName())); } } } return new SelectorData(values,null); } @Inject  BeanPropertiesProvider(ModelFinderService modelFinderService); @Override String getProviderName(); @Override SelectorData getSelectorData(FormRenderingContext context);  }