Ejemplo n.º 1
0
 /**
  * @param mapping
  * @param target
  * @return The supplied mapping if it remains incomplete, else a new mapping mapped via the
  *     delegate
  */
 public MappingOperation<?, ?> setTarget(
     final MappingOperation<?, ?> mapping, final Model target) {
   if (mapping.getType() == null) {
     ((MappingPlaceholder) mapping).setTarget(target);
   }
   return update(mapping, mapping.getSource(), target, MAPPING_TARGET);
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
  public static void updateDateFormat(final Shell shell, final MappingOperation<?, ?> mappingOp) {
    if (mappingOp != null && mappingOp instanceof BaseDozerMapping) {

      // if both sides of the equation are Models, we're good to check this out
      if (!(mappingOp.getSource() instanceof Model && mappingOp.getTarget() instanceof Model)) {
        return;
      }
      Model srcModel = (Model) mappingOp.getSource();
      Model tgtModel = (Model) mappingOp.getTarget();
      BaseDozerMapping dMapping = (BaseDozerMapping) mappingOp;
      if (srcModel.getType().equalsIgnoreCase("java.lang.String")
          && tgtModel.getType().equalsIgnoreCase("java.util.Date")) {
        String dateFormatStr = Util.getDateFormat(shell, mappingOp, true);
        dMapping.setSourceDateFormat(dateFormatStr);
      } else if (tgtModel.getType().equalsIgnoreCase("java.lang.String")
          && srcModel.getType().equalsIgnoreCase("java.util.Date")) {
        String dateFormatStr = Util.getDateFormat(shell, mappingOp, false);
        dMapping.setTargetDateFormat(dateFormatStr);
      }
    }
  }