Search in sources :

Example 1 with DefaultTransformationSettings

use of eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings in project hale by halestudio.

the class TransformDataWizard method performFinish.

/**
 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 */
@Override
public boolean performFinish() {
    InstanceCollection rawSources = new MultiInstanceCollection(sourceSelectionPage.getSourceInstances());
    // Create a copy of the current alignment to be independent and run
    // everything in a job.
    AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
    Alignment alignment = new DefaultAlignment(alignmentService.getAlignment());
    // schema service for getting source schema
    SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
    Transformation.transform(rawSources, targetSink, sourceSelectionPage.getExportJob(), sourceSelectionPage.getValidationJob(), alignment, ss.getSchemas(SchemaSpaceID.SOURCE), DefaultReportHandler.getInstance(), HaleUI.getServiceProvider(), null, new DefaultTransformationSettings());
    return true;
}
Also used : MultiInstanceCollection(eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection) DefaultAlignment(eu.esdihumboldt.hale.common.align.model.impl.DefaultAlignment) Alignment(eu.esdihumboldt.hale.common.align.model.Alignment) SchemaService(eu.esdihumboldt.hale.ui.service.schema.SchemaService) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) MultiInstanceCollection(eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) DefaultTransformationSettings(eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings) DefaultAlignment(eu.esdihumboldt.hale.common.align.model.impl.DefaultAlignment)

Example 2 with DefaultTransformationSettings

use of eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings in project hale by halestudio.

the class ExecTransformation method transform.

private int transform() throws InterruptedException, ExecutionException {
    status("Running hale transformation...");
    TransformationSettings settings = new DefaultTransformationSettings();
    // TODO make settings configurable?
    // run transformation
    ListenableFuture<Boolean> res = Transformation.transform(sources, target, env, reportHandler, id, validators, context.getFilters(), settings);
    boolean orgSuccess = res.get();
    // them to complete and file their report (otherwise error may get lost)
    try {
        Thread.sleep(3000);
    } catch (Throwable e) {
    // ignore
    }
    boolean success;
    try {
        success = evaluateSuccess(orgSuccess);
    } catch (Throwable e) {
        error("Success evaluation resulted in an error:\n" + e.getMessage());
        if (context.isLogException()) {
            e.printStackTrace();
        }
        return 2;
    }
    if (success) {
        info("Transformation completed. Please check the reports for more details.");
    } else {
        if (orgSuccess) {
            error("Transformation failed according to the success evaluation script.");
            return 2;
        } else {
            error("Transformation failed, please check the reports for details.");
            return 1;
        }
    }
    // exit OK
    return 0;
}
Also used : DefaultTransformationSettings(eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings) TransformationSettings(eu.esdihumboldt.hale.common.headless.transform.TransformationSettings) DefaultTransformationSettings(eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings)

Aggregations

DefaultTransformationSettings (eu.esdihumboldt.hale.common.headless.transform.DefaultTransformationSettings)2 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)1 DefaultAlignment (eu.esdihumboldt.hale.common.align.model.impl.DefaultAlignment)1 TransformationSettings (eu.esdihumboldt.hale.common.headless.transform.TransformationSettings)1 InstanceCollection (eu.esdihumboldt.hale.common.instance.model.InstanceCollection)1 MultiInstanceCollection (eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection)1 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)1 SchemaService (eu.esdihumboldt.hale.ui.service.schema.SchemaService)1