コード例 #1
0
 /**
  * @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;
 }
コード例 #2
0
 /** {@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;
 }
コード例 #3
0
 /**
  * {@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;
 }
コード例 #4
0
 /**
  * {@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;
 }
コード例 #5
0
 /**
  * {@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);
 }
コード例 #6
0
 /**
  * @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);
 }
コード例 #7
0
 /**
  * {@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;
 }
コード例 #8
0
 /**
  * {@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;
 }
コード例 #9
0
 /** {@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;
 }
コード例 #10
0
 /**
  * {@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;
 }
コード例 #11
0
 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;
 }
コード例 #12
0
 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;
 }
コード例 #13
0
 /**
  * {@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;
 }
コード例 #14
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getSourceModel()
  */
 @Override
 public Model getSourceModel() {
   return delegate.getSourceModel();
 }
コード例 #15
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.tools.fuse.transformation.MapperConfiguration#saveConfig(java.io.OutputStream)
  */
 @Override
 public void saveConfig(final OutputStream output) throws Exception {
   delegate.saveConfig(output);
 }
コード例 #16
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getTargetModel()
  */
 @Override
 public Model getTargetModel() {
   return delegate.getTargetModel();
 }
コード例 #17
0
 /**
  * {@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;
 }
コード例 #18
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getVariable(java.lang.String)
  */
 @Override
 public Variable getVariable(final String variableName) {
   return delegate.getVariable(variableName);
 }
コード例 #19
0
 /** {@inheritDoc} */
 @Override
 public MappingOperation<?, ?> getMapping(Model source, Model target) {
   return delegate.getMapping(source, target);
 }
コード例 #20
0
 /**
  * {@inheritDoc}
  *
  * @see org.jboss.tools.fuse.transformation.MapperConfiguration#getVariables()
  */
 @Override
 public List<Variable> getVariables() {
   return delegate.getVariables();
 }
コード例 #21
0
 /**
  * {@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;
 }
コード例 #22
0
 /**
  * {@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;
 }