Search in sources :

Example 1 with InstanceViewService

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);
}
Also used : InstanceViewService(eu.esdihumboldt.hale.ui.service.instance.sample.InstanceViewService) Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) InstanceService(eu.esdihumboldt.hale.ui.service.instance.InstanceService) URI(java.net.URI)

Aggregations

Instance (eu.esdihumboldt.hale.common.instance.model.Instance)1 InstanceCollection (eu.esdihumboldt.hale.common.instance.model.InstanceCollection)1 InstanceService (eu.esdihumboldt.hale.ui.service.instance.InstanceService)1 InstanceViewService (eu.esdihumboldt.hale.ui.service.instance.sample.InstanceViewService)1 URI (java.net.URI)1