コード例 #1
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;
 }
コード例 #2
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;
 }
コード例 #3
0
 Model find(final Object object, final Model model) {
   if (model.equals(object)) {
     return model;
   }
   for (final Model child : model.getChildren()) {
     final Model match = find(object, child);
     if (match != null) {
       return match;
     }
   }
   return null;
 }
コード例 #4
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;
 }