use of org.knime.workbench.workflowcoach.prefs.UpdateJob.UpdateListener in project knime-core by knime.
the class WorkflowCoachView method updateTripleProviders.
/**
* Updates all updatable and enabled triple providers.
*
* @param requiredOnly if only the enabled triple providers should be updated that require an update in order to
* work
* @param updateListener to get feedback of the updating process
* @param block if <code>true</code> the method will block till the update is finished, otherwise it will return
* immediately after triggering the update job
*/
private void updateTripleProviders(final UpdateListener updateListener, final boolean requiredOnly, final boolean block) {
List<UpdatableNodeTripleProvider> toUpdate = NodeRecommendationManager.getInstance().getNodeTripleProviders().stream().filter(ntp -> {
if (!(ntp instanceof UpdatableNodeTripleProvider)) {
return false;
} else {
UpdatableNodeTripleProvider untp = (UpdatableNodeTripleProvider) ntp;
return ntp.isEnabled() && (!requiredOnly || untp.updateRequired());
}
}).map(ntp -> (UpdatableNodeTripleProvider) ntp).collect(Collectors.toList());
UpdateJob.schedule(updateListener, toUpdate, block);
}
Aggregations