@Override
public void actionPerformed(ActionEvent event) {
final AnalyzerBeansConfiguration configuration = DCConfiguration.get();
final AnalysisJobBuilder ajb = new AnalysisJobBuilder(configuration);
ajb.setDatastore(_datastore);
final List<InputColumn<?>> booleanColumns = new ArrayList<InputColumn<?>>();
final List<InputColumn<?>> stringColumns = new ArrayList<InputColumn<?>>();
final List<InputColumn<?>> numberColumns = new ArrayList<InputColumn<?>>();
final List<InputColumn<?>> dateTimeColumns = new ArrayList<InputColumn<?>>();
for (Column column : getColumns()) {
ajb.addSourceColumn(column);
InputColumn<?> inputColumn = ajb.getSourceColumnByName(column.getName());
DataTypeFamily dataTypeFamily = inputColumn.getDataTypeFamily();
switch (dataTypeFamily) {
case BOOLEAN:
booleanColumns.add(inputColumn);
break;
case NUMBER:
numberColumns.add(inputColumn);
break;
case DATE:
dateTimeColumns.add(inputColumn);
break;
case STRING:
stringColumns.add(inputColumn);
break;
}
}
if (!booleanColumns.isEmpty()) {
// boolean analyzer contains combination matrices, so all columns
// are added to a single analyzer job.
ajb.addRowProcessingAnalyzer(BooleanAnalyzer.class).addInputColumns(booleanColumns);
}
if (!numberColumns.isEmpty()) {
createAnalyzers(ajb, NumberAnalyzer.class, numberColumns);
}
if (!dateTimeColumns.isEmpty()) {
createAnalyzers(ajb, DateAndTimeAnalyzer.class, dateTimeColumns);
}
if (!stringColumns.isEmpty()) {
createAnalyzers(ajb, StringAnalyzer.class, stringColumns);
}
try {
if (!ajb.isConfigured(true)) {
throw new IllegalStateException("Unknown job configuration issue!");
}
Injector injector = Guice.createInjector(new DCModule(_parentModule, ajb));