use of au.gov.asd.tac.constellation.views.analyticview.utilities.AnalyticException in project constellation by constellation-app.
the class AnalyticConfigurationPane method answerCurrentQuestion.
/**
* Answer the question which is currently selected in this pane.
*
* @return the answered {@link AnalyticQuestion}.
*/
protected final AnalyticQuestion<?> answerCurrentQuestion() throws AnalyticException {
// build question
final AnalyticQuestion<?> question = new AnalyticQuestion<>(currentQuestion);
// retrieve and set any global parameters in the question
final AnalyticAggregatorParameterValue aggregatorParameterValue = (AnalyticAggregatorParameterValue) globalAnalyticParameters.getSingleChoice(AGGREGATOR_PARAMETER_ID);
if (aggregatorParameterValue == null) {
throw new AnalyticException("You must select an aggregation method!");
}
final AnalyticAggregator aggregator = (AnalyticAggregator<?>) aggregatorParameterValue.getObjectValue();
question.setAggregator(aggregator);
// add and set parameters for each plugin in the question
final List<SelectableAnalyticPlugin> selectedPlugins = new ArrayList<>();
pluginList.getItems().forEach(selectablePlugin -> {
if (selectablePlugin.checkbox.isSelected()) {
selectedPlugins.add(selectablePlugin);
question.addPlugin(selectablePlugin.plugin, selectablePlugin.getPluginSpecificParameters());
}
});
if (selectedPlugins.isEmpty()) {
throw new AnalyticException("You must select at least one analytic!");
}
final Graph currentGraph = GraphManager.getDefault().getActiveGraph();
// update the analytic view state
PluginExecution.withPlugin(new AnalyticViewStateWriter(currentQuestion, selectedPlugins)).executeLater(currentGraph);
// answer the question
return question.answer(currentGraph);
}
use of au.gov.asd.tac.constellation.views.analyticview.utilities.AnalyticException in project constellation by constellation-app.
the class AppendScoreAggregator method aggregate.
@Override
public ScoreResult aggregate(final List<ScoreResult> results) throws AnalyticException {
final ScoreResult aggregateResult = new ScoreResult();
if (CollectionUtils.isEmpty(results)) {
return aggregateResult;
}
aggregateResult.setIgnoreNullResults(results.stream().anyMatch(result -> result.isIgnoreNullResults()));
results.forEach(scoreResult -> aggregateResult.combine(scoreResult));
return aggregateResult;
}
Aggregations