Esempio n. 1
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;
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
 }