Ejemplo n.º 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;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
 }