use of eu.esdihumboldt.hale.io.appschema.writer.internal.PropertyTransformationHandler 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");
}
}
}
use of eu.esdihumboldt.hale.io.appschema.writer.internal.PropertyTransformationHandler 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));
}
}
}
}
Aggregations