use of eu.esdihumboldt.hale.common.align.extension.transformation.PropertyTransformationFactory in project hale by halestudio.
the class FunctionExecutor method processValid.
/**
* @see CellNodeValidator#processValid(Cell, ListMultimap, ListMultimap)
*/
@Override
protected void processValid(Cell cell, ListMultimap<String, Pair<SourceNode, Entity>> sources, ListMultimap<String, Pair<TargetNode, Entity>> targets) {
if (cell.getPriority() != functionPriority) {
// ignore the priorities that do not match
return;
}
/*
* if the result node is only one and its value had already been set, it
* is not necessary to execute this function of a lower priority. (if
* there are more than one target node we will need to execute them all
* and check at the end of the transformation.
*/
if (targets.size() == 1) {
TargetNode targetNode = targets.values().iterator().next().getFirst();
if (targetNode.isDefined()) {
// pass
return;
}
}
String functionId = cell.getTransformationIdentifier();
List<PropertyTransformationFactory> transformations = this.transformations.getPropertyTransformations(functionId);
if (transformations == null || transformations.isEmpty()) {
reporter.error(new TransformationMessageImpl(cell, MessageFormat.format("No transformation for function {0} found. Skipping property transformation.", functionId), null));
} else {
// TODO select based on e.g. preferred transformation engine?
PropertyTransformationFactory transformation = transformations.iterator().next();
executeTransformation(transformation, cell, sources, targets);
}
}
use of eu.esdihumboldt.hale.common.align.extension.transformation.PropertyTransformationFactory in project hale by halestudio.
the class AbstractDefaultTransformationFunctionService method getPropertyTransformations.
@Override
public List<PropertyTransformationFactory> getPropertyTransformations(String functionId) {
List<PropertyTransformationFactory> functions = super.getPropertyTransformations(functionId);
Alignment al = getCurrentAlignment();
if (al != null) {
List<PropertyTransformationFactory> cfs = new ArrayList<>(functions);
String localId = functionId;
if (localId.startsWith(PREFIX_ALIGNMENT_FUNCTION)) {
localId = localId.substring(PREFIX_ALIGNMENT_FUNCTION.length());
}
CustomPropertyFunction cf = al.getAllCustomPropertyFunctions().get(localId);
if (cf != null) {
cfs.add(new CustomPropertyFunctionFactory(cf));
}
functions = cfs;
}
return functions;
}
Aggregations