/** * @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 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; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration #mapExpression(java.lang.String, * java.lang.String, org.jboss.tools.fuse.transformation.model.Model) */ @Override public ExpressionMapping mapExpression( final String language, final String expression, final Model target) { final ExpressionMapping mapping = delegate.mapExpression(language, expression, target); fireEvent(MAPPING, null, mapping); return mapping; }
/** * {@inheritDoc} * * @see MapperConfiguration#customizeMapping(FieldMapping, String, String) */ @Override public CustomMapping customizeMapping( final FieldMapping fieldMapping, final String mappingClass, final String mappingOperation) { final CustomMapping customMapping = delegate.customizeMapping(fieldMapping, mappingClass, mappingOperation); fireEvent(MAPPING_CUSTOMIZE, fieldMapping, customMapping); return customMapping; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration * #removeMapping(org.jboss.tools.fuse.transformation.MappingOperation) */ @Override public void removeMapping(final MappingOperation<?, ?> mapping) { if (mapping.getType() == null) { mappingPlaceholders.remove(mapping); } else { delegate.removeMapping(mapping); } fireEvent(MAPPING, mapping, null); }
/** * @param mapping * @param language * @param expression * @return The supplied mapping if it remains incomplete, else a new mapping mapped via the * delegate */ public MappingOperation<?, ?> setSourceExpression( final MappingOperation<?, ?> mapping, final String language, final String expression) { if (mapping.getType() == null) { ((MappingPlaceholder) mapping).setSource(new ExpressionPlaceholder(language, expression)); } else { delegate.removeMapping(mapping); } return update(mapping, language, expression, (Model) mapping.getTarget(), MAPPING_SOURCE); }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration * #getMappingsForTarget(org.jboss.tools.fuse.transformation.model.Model) */ @Override public List<MappingOperation<?, ?>> getMappingsForTarget(final Model target) { final List<MappingOperation<?, ?>> mappings = delegate.getMappingsForTarget(target); for (final MappingOperation<?, ?> mapping : mappingPlaceholders) { if (target.equals(mapping.getTarget())) { mappings.add(mapping); } } return mappings; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration * #getMappingsForSource(org.jboss.tools.fuse.transformation.model.Model) */ @Override public List<MappingOperation<?, ?>> getMappingsForSource(final Model source) { final List<MappingOperation<?, ?>> mappings = delegate.getMappingsForSource(source); for (final MappingOperation<?, ?> mapping : mappingPlaceholders) { if (source.equals(mapping.getSource())) { mappings.add(mapping); } } return mappings; }
/** {@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; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration * #removeVariable(org.jboss.tools.fuse.transformation.Variable) */ @Override public boolean removeVariable(final Variable variable) { for (final MappingOperation<?, ?> mapping : getMappings()) { if (mappingContainsVariable(mapping, variable)) { removeMapping(mapping); } } final boolean removed = delegate.removeVariable(variable); fireEvent(VARIABLE, variable, null); return removed; }
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; }
private MappingOperation<?, ?> update( final MappingOperation<?, ?> mapping, final String language, final String expression, final Model target, final String eventType) { MappingOperation<?, ?> resultMapping; if (target == null) { resultMapping = mapping; } else { if (mapping.getType() == null) { mappingPlaceholders.remove(mapping); } resultMapping = delegate.mapExpression(language, expression, target); } fireEvent(eventType, mapping, resultMapping); return resultMapping; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getMappings() */ @Override public List<MappingOperation<?, ?>> getMappings() { final List<MappingOperation<?, ?>> mappings = delegate.getMappings(); mappings.addAll(mappingPlaceholders); return mappings; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getSourceModel() */ @Override public Model getSourceModel() { return delegate.getSourceModel(); }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#saveConfig(java.io.OutputStream) */ @Override public void saveConfig(final OutputStream output) throws Exception { delegate.saveConfig(output); }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getTargetModel() */ @Override public Model getTargetModel() { return delegate.getTargetModel(); }
/** * {@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; }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getVariable(java.lang.String) */ @Override public Variable getVariable(final String variableName) { return delegate.getVariable(variableName); }
/** {@inheritDoc} */ @Override public MappingOperation<?, ?> getMapping(Model source, Model target) { return delegate.getMapping(source, target); }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getVariables() */ @Override public List<Variable> getVariables() { return delegate.getVariables(); }
/** * {@inheritDoc} * * @see org.jboss.tools.fuse.transformation.MapperConfiguration #addVariable(java.lang.String, * java.lang.String) */ @Override public Variable addVariable(final String name, final String value) { final Variable variable = delegate.addVariable(name, value); fireEvent(VARIABLE, null, variable); return variable; }
/** * {@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; }