private List<ConnConfProperty> filterProperties(final Collection<ConnConfProperty> properties) { List<ConnConfProperty> newProperties = new ArrayList<>(); properties.stream().map(property -> { ConnConfProperty prop = new ConnConfProperty(); prop.setSchema(property.getSchema()); prop.setOverridable(property.isOverridable()); final List<Object> parsed = new ArrayList<>(); if (property.getValues() != null) { property.getValues().stream(). filter(obj -> (obj != null && !obj.toString().isEmpty())). forEachOrdered((obj) -> { parsed.add(obj); }); } prop.getValues().addAll(parsed); return prop; }).forEachOrdered(prop -> { newProperties.add(prop); }); return newProperties; }
/** * Get available configuration properties. * * @param instance connector instance. * @return configuration properties. */ @Override protected final List<ConnConfProperty> getConnProperties(final ConnInstanceTO instance) { return ConnectorWizardBuilder.getBundle(instance, bundles).getProperties().stream(). map(key -> { ConnConfProperty property = new ConnConfProperty(); property.setSchema(key); instance.getConf(key.getName()).ifPresent(conf -> { if (conf.getValues() != null) { property.getValues().addAll(conf.getValues()); property.setOverridable(conf.isOverridable()); } }); if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) { property.getValues().addAll(key.getDefaultValues()); } return property; }).collect(Collectors.toList()); } }
connInstanceTO.getConf().add(property.get()); property.get().setSchema(schema); }); Collections.sort(connInstanceTO.getConf());