public InsertIntoTableJobBuilderPresenter( AnalyzerComponentBuilder<InsertIntoTableAnalyzer> analyzerJobBuilder, WindowContext windowContext, PropertyWidgetFactory propertyWidgetFactory, DataCleanerConfiguration configuration, DCModule dcModule) { super(analyzerJobBuilder, propertyWidgetFactory); _overriddenPropertyWidgets = new HashMap<ConfiguredPropertyDescriptor, PropertyWidget<?>>(); final AnalyzerDescriptor<InsertIntoTableAnalyzer> descriptor = analyzerJobBuilder.getDescriptor(); assert descriptor.getComponentClass() == InsertIntoTableAnalyzer.class; _datastoreProperty = descriptor.getConfiguredProperty("Datastore"); _schemaNameProperty = descriptor.getConfiguredProperty("Schema name"); _tableNameProperty = descriptor.getConfiguredProperty("Table name"); _inputColumnsProperty = descriptor.getConfiguredProperty("Values"); _columnNamesProperty = descriptor.getConfiguredProperty("Column names"); _bufferSizeProperty = descriptor.getConfiguredProperty("Buffer size"); _truncateTableProperty = descriptor.getConfiguredProperty("Truncate table"); _errorHandlingProperty = descriptor.getConfiguredProperty("How to handle insertion errors?"); _errorFileLocationProperty = descriptor.getConfiguredProperty("Error log file location"); _additionalErrorLogValuesProperty = descriptor.getConfiguredProperty("Additional error log values"); // the Datastore property assert _datastoreProperty != null; assert _datastoreProperty.getType() == Datastore.class; final SingleDatastorePropertyWidget datastorePropertyWidget = new SingleDatastorePropertyWidget( analyzerJobBuilder, _datastoreProperty, configuration.getDatastoreCatalog(), dcModule); datastorePropertyWidget.setOnlyUpdatableDatastores(true); _overriddenPropertyWidgets.put(_datastoreProperty, datastorePropertyWidget); // The schema name (String) property final SchemaNamePropertyWidget schemaNamePropertyWidget = new SchemaNamePropertyWidget(analyzerJobBuilder, _schemaNameProperty); _overriddenPropertyWidgets.put(_schemaNameProperty, schemaNamePropertyWidget); // The table name (String) property final SingleTableNamePropertyWidget tableNamePropertyWidget = new SingleTableNamePropertyWidget(analyzerJobBuilder, _tableNameProperty, windowContext); _overriddenPropertyWidgets.put(_tableNameProperty, tableNamePropertyWidget); // the InputColumn<?>[] property assert _inputColumnsProperty != null; assert _inputColumnsProperty.getType() == InputColumn[].class; final MultipleMappedColumnsPropertyWidget inputColumnsPropertyWidget = new MultipleMappedPrefixedColumnsPropertyWidget( analyzerJobBuilder, _inputColumnsProperty, _columnNamesProperty, " → "); _overriddenPropertyWidgets.put(_inputColumnsProperty, inputColumnsPropertyWidget); // the String[] property assert _columnNamesProperty != null; assert _columnNamesProperty.getType() == String[].class; _overriddenPropertyWidgets.put( _columnNamesProperty, inputColumnsPropertyWidget.getMappedColumnNamesPropertyWidget()); // chain combo boxes datastorePropertyWidget.connectToSchemaNamePropertyWidget(schemaNamePropertyWidget); schemaNamePropertyWidget.connectToTableNamePropertyWidget(tableNamePropertyWidget); tableNamePropertyWidget.addComboListener( new Listener<Table>() { @Override public void onItemSelected(Table item) { // update the column combo boxes when the table is selected inputColumnsPropertyWidget.setTable(item); } }); // initialize schemaNamePropertyWidget.setDatastore(datastorePropertyWidget.getValue()); tableNamePropertyWidget.setSchema( datastorePropertyWidget.getValue(), schemaNamePropertyWidget.getSchema()); inputColumnsPropertyWidget.setTable(tableNamePropertyWidget.getTable()); }
public void testDescriptor() throws Exception { AnalyzerDescriptor<DateGapAnalyzer> descriptor = Descriptors.ofAnalyzer(DateGapAnalyzer.class); assertEquals("Date gap analyzer", descriptor.getDisplayName()); }