/** * @param customMapping * @return a new (uncustomized) field mapping */ public FieldMapping uncustomizeMapping(final CustomMapping customMapping) { delegate.removeMapping(customMapping); final FieldMapping fieldMapping = delegate.mapField(customMapping.getSource(), customMapping.getTarget()); fireEvent(MAPPING_CUSTOMIZE, customMapping, fieldMapping); return fieldMapping; }
/** {@inheritDoc} */ @Override public FieldMapping mapField( final Model source, final Model target, final List<Integer> sourceIndex, final List<Integer> targetIndex) { final FieldMapping mapping = delegate.mapField(source, target, sourceIndex, 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 * #mapField(org.jboss.tools.fuse.transformation.model.Model, * org.jboss.tools.fuse.transformation.model.Model) */ @Override public FieldMapping mapField(final Model source, final Model target) { final FieldMapping mapping = delegate.mapField(source, target); fireEvent(MAPPING, null, mapping); return mapping; }