/** {@inheritDoc} */ @Override public VariableMapping mapVariable( final Variable variable, final Model target, final List<Integer> targetIndex) { final VariableMapping mapping = delegate.mapVariable(variable, target, targetIndex); fireEvent(MAPPING, null, mapping); return mapping; }
private MappingOperation<?, ?> update( final MappingOperation<?, ?> mapping, final Object source, final Model target, final String eventType) { MappingOperation<?, ?> resultMapping; if (source == null || target == null) { resultMapping = mapping; } else { // Not or no longer a mapping placeholder if (mapping.getType() == null) { mappingPlaceholders.remove(mapping); } if (source instanceof Model) { if (mapping.getType() != null) { delegate.removeMapping(mapping); } resultMapping = delegate.mapField((Model) source, target); if (mapping.getType() == MappingType.CUSTOM) { final CustomMapping customMapping = (CustomMapping) mapping; resultMapping = delegate.customizeMapping( (FieldMapping) resultMapping, customMapping.getMappingClass(), customMapping.getMappingOperation()); } } else if (source instanceof Variable) { if (mapping.getType() == MappingType.VARIABLE && target.equals(mapping.getTarget())) { resultMapping = mapping; ((VariableMapping) mapping).setVariable((Variable) source); } else { if (mapping.getType() != null) { delegate.removeMapping(mapping); } resultMapping = delegate.mapVariable((Variable) source, target); } } else { if (mapping.getType() != null) { delegate.removeMapping(mapping); } final Expression expression = (Expression) source; resultMapping = delegate.mapExpression(expression.getLanguage(), expression.getExpression(), target); } } fireEvent(eventType, mapping, resultMapping); return resultMapping; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration * #mapVariable(org.jboss.tools.fuse.transformation.Variable, * org.jboss.tools.fuse.transformation.model.Model) */ @Override public VariableMapping mapVariable(final Variable variable, final Model target) { final VariableMapping mapping = delegate.mapVariable(variable, target); fireEvent(MAPPING, null, mapping); return mapping; }