use of eu.esdihumboldt.hale.ui.service.instance.sample.InstanceViewService in project hale by halestudio.
the class InstanceImportAdvisor method handleResults.
/**
* @see IOAdvisor#handleResults(IOProvider)
*/
@Override
public void handleResults(InstanceReader provider) {
// add instances to instance service
InstanceService is = getService(InstanceService.class);
InstanceCollection instances = provider.getInstances();
ResourceIterator<Instance> it = instances.iterator();
try {
if (!it.hasNext()) {
URI loc = provider.getSource().getLocation();
if (loc != null) {
log.warn(MessageFormat.format("No instances could be imported with the given configuration from {0}", loc.toString()));
} else {
log.warn("No instances could be imported with the given configuration.");
}
}
} finally {
it.close();
}
// apply sampling before adding to the instance service
InstanceViewService ivs = PlatformUI.getWorkbench().getService(InstanceViewService.class);
if (ivs != null) {
instances = ivs.sample(instances);
}
is.addSourceInstances(instances);
super.handleResults(provider);
}
Aggregations