Search in sources :

Example 1 with UnsupportedTransformationException

use of eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException in project hale by halestudio.

the class AppSchemaMappingTest method processJoinAlignment.

private void processJoinAlignment(Alignment alignment, FeatureChaining chainingConf) {
    AppSchemaMappingContext context = new AppSchemaMappingContext(mappingWrapper, alignment, targetTypes, chainingConf, null);
    Cell joinCell = alignment.getTypeCells().iterator().next();
    JoinHandler handler = new JoinHandler();
    handler.handleTypeTransformation(joinCell, context);
    for (Cell propertyCell : alignment.getPropertyCells(joinCell)) {
        String propertyTransformId = propertyCell.getTransformationIdentifier();
        PropertyTransformationHandler propertyTransformHandler;
        try {
            propertyTransformHandler = PropertyTransformationHandlerFactory.getInstance().createPropertyTransformationHandler(propertyTransformId);
            propertyTransformHandler.handlePropertyTransformation(joinCell, propertyCell, context);
        } catch (UnsupportedTransformationException e) {
            Assert.fail("Unsupported transformation was found");
        }
    }
}
Also used : UnsupportedTransformationException(eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException) AppSchemaMappingContext(eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingContext) PropertyTransformationHandler(eu.esdihumboldt.hale.io.appschema.writer.internal.PropertyTransformationHandler) JoinHandler(eu.esdihumboldt.hale.io.appschema.writer.internal.JoinHandler) DefaultCell(eu.esdihumboldt.hale.common.align.model.impl.DefaultCell) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 2 with UnsupportedTransformationException

use of eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException in project hale by halestudio.

the class AppSchemaMappingGenerator method createTypeMappings.

private void createTypeMappings(AppSchemaMappingContext context, IOReporter reporter) {
    Collection<? extends Cell> typeCells = alignment.getTypeCells();
    for (Cell typeCell : typeCells) {
        String typeTransformId = typeCell.getTransformationIdentifier();
        TypeTransformationHandler typeTransformHandler = null;
        try {
            typeTransformHandler = TypeTransformationHandlerFactory.getInstance().createTypeTransformationHandler(typeTransformId);
            FeatureTypeMapping ftMapping = typeTransformHandler.handleTypeTransformation(typeCell, context);
            if (ftMapping != null) {
                Collection<? extends Cell> propertyCells = alignment.getPropertyCells(typeCell);
                for (Cell propertyCell : propertyCells) {
                    String propertyTransformId = propertyCell.getTransformationIdentifier();
                    PropertyTransformationHandler propertyTransformHandler = null;
                    try {
                        propertyTransformHandler = PropertyTransformationHandlerFactory.getInstance().createPropertyTransformationHandler(propertyTransformId);
                        propertyTransformHandler.handlePropertyTransformation(typeCell, propertyCell, context);
                    } catch (UnsupportedTransformationException e) {
                        String errMsg = MessageFormat.format("Error processing property cell {0}", propertyCell.getId());
                        log.warn(errMsg, e);
                        if (reporter != null) {
                            reporter.warn(new IOMessageImpl(errMsg, e));
                        }
                    }
                }
            }
        } catch (UnsupportedTransformationException e) {
            String errMsg = MessageFormat.format("Error processing type cell{0}", typeCell.getId());
            log.warn(errMsg, e);
            if (reporter != null) {
                reporter.warn(new IOMessageImpl(errMsg, e));
            }
        }
    }
}
Also used : UnsupportedTransformationException(eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException) IOMessageImpl(eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl) PropertyTransformationHandler(eu.esdihumboldt.hale.io.appschema.writer.internal.PropertyTransformationHandler) FeatureTypeMapping(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.TypeMappingsPropertyType.FeatureTypeMapping) Cell(eu.esdihumboldt.hale.common.align.model.Cell) TypeTransformationHandler(eu.esdihumboldt.hale.io.appschema.writer.internal.TypeTransformationHandler)

Aggregations

Cell (eu.esdihumboldt.hale.common.align.model.Cell)2 PropertyTransformationHandler (eu.esdihumboldt.hale.io.appschema.writer.internal.PropertyTransformationHandler)2 UnsupportedTransformationException (eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException)2 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)1 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 FeatureTypeMapping (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.TypeMappingsPropertyType.FeatureTypeMapping)1 JoinHandler (eu.esdihumboldt.hale.io.appschema.writer.internal.JoinHandler)1 TypeTransformationHandler (eu.esdihumboldt.hale.io.appschema.writer.internal.TypeTransformationHandler)1 AppSchemaMappingContext (eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingContext)1