private void populateMappingInfo(EObject xmlEntity) {
    Resource resource = xmlEntity.eResource();

    // model contents for this resource
    ModelContents mdlContents = new ModelContents(resource);
    XmlDocument document = getXmlDocument(xmlEntity);
    currentDocumentName = document.getName();
    // fill the map with element to its mappingClass column value
    this.elementMap = new HashMap();
    this.elementFullNames = new HashSet();
    // get the mapping root associated with the transformation
    Iterator rootIter = mdlContents.getTransformations(document).iterator();
    while (rootIter.hasNext()) {
      MappingRoot mappingRoot = (MappingRoot) rootIter.next();
      // if there is a mapping root
      if (mappingRoot != null && mappingRoot instanceof TreeMappingRoot) {
        Iterator mappingIter = mappingRoot.getNested().iterator();
        while (mappingIter.hasNext()) {
          Mapping nestedMapping = (Mapping) mappingIter.next();
          // mapping Class columns
          List inputs = nestedMapping.getInputs();
          // xml elements
          List outputs = nestedMapping.getOutputs();
          if (!outputs.isEmpty() && !inputs.isEmpty()) {
            Object output = outputs.iterator().next();
            Object input = inputs.iterator().next();
            elementMap.put(output, input);
            if (output instanceof XmlElement) {
              elementFullNames.add(this.getFullName((EObject) output));
            }
          }
        }
      }
    }
  }
  /**
   * @see
   *     com.metamatrix.modeler.core.metamodel.aspect.sql.SqlColumnAspect#isTranformationInputParameter(org.eclipse.emf.ecore.EObject)
   * @since 4.2
   */
  public boolean isTranformationInputParameter(EObject eObject) {
    CoreArgCheck.isInstanceOf(XmlElement.class, eObject);
    final XmlElement element = (XmlElement) eObject;

    if (element instanceof XmlRoot) {
      return false;
    }

    final XmlDocument doc = getDocParent(element);
    final XmlElement parent = getElementParent(element);
    if (doc == null || parent == null) {
      return false;
    }

    Resource eResource = element.eResource();
    if (eResource instanceof EmfResource) {
      EmfResource emfResource = (EmfResource) eResource;
      ModelContents contents = emfResource.getModelContents();
      if (contents != null) {
        for (final Iterator mappings = contents.getTransformations(doc).iterator();
            mappings.hasNext(); ) {
          final TreeMappingRoot tmr = (TreeMappingRoot) mappings.next();
          if (tmr.getOutputs().contains(parent)) {
            final Iterator nested = tmr.getNested().iterator();
            while (nested.hasNext()) {
              final Mapping mapping = (Mapping) nested.next();
              if (mapping.getOutputs().contains(element)) {
                if (mapping.getInputs().size() == 0) {
                  return false;
                }
                Iterator i = mapping.getInputs().iterator();
                while (i.hasNext()) {
                  MappingClassColumn column = (MappingClassColumn) i.next();
                  SqlAspect aspect = AspectManager.getSqlAspect(column);
                  if (!(aspect instanceof SqlColumnAspect)) {
                    return false;
                  }
                  if (!((SqlColumnAspect) aspect).isTranformationInputParameter(column)) {
                    return false;
                  }
                }
                return true;
              }
            }
          }
        }
      }
    }
    return false;
  }
  /**
   * Create additional commands for copying the supplied additional "related" objects, and
   * add-and-execute them (via the {@link PasteFromClipboard#appendAndExecute(}).
   *
   * @param additionalObjs the original "related" objects that are to be copied and added to the
   *     correct location; never null
   * @param targetContents the content helper for the Resource in which the object is being copied
   *     and pasted; never null
   * @return the subset of <code>additionalObjs</code> that were not handled by this implementation;
   *     never null
   */
  protected Collection doCreateAdditionalCommands(final ModelContents targetContents) {
    if (this.additionalObjs.isEmpty()) {
      return this.additionalObjs;
    }

    // Find all of the annotations and transformations ...
    final Set annotations = new HashSet();
    final Set mappingClassSets = new HashSet();
    final Set transformations = new HashSet();
    final List remaining = new ArrayList();
    final Iterator iter = this.additionalObjs.iterator();
    while (iter.hasNext()) {
      final Object additionalObj = iter.next();
      if (additionalObj instanceof Annotation) {
        annotations.add(additionalObj);
      } else if (additionalObj instanceof MappingClassSet) {
        mappingClassSets.add(additionalObj);
      } else if (additionalObj instanceof TransformationMappingRoot) {
        transformations.add(additionalObj);
      } else {
        remaining.add(additionalObj);
      }
    }

    // Create the add command for all of the annotations ...
    if (annotations.size() != 0) {
      // Note:  container will probably be null due to changes in the following underlying method
      // call.
      // This is due to the targetContents' Resource == NULL (see
      // ModelResourceContainerFactory.getAnnotationContainer());
      AnnotationContainer container = targetContents.getAnnotationContainer(true);
      if (container == null) {
        // it's null, so we'll new one up via the CoreFactory....
        container = CoreFactory.eINSTANCE.createAnnotationContainer();
        // since one wasn't found, we need to create a temporary one and add to contents
        targetContents.getAllRootEObjects().add(container);
      }

      final EStructuralFeature feature = CorePackage.eINSTANCE.getAnnotationContainer_Annotations();
      createAndAppendAddCommand(annotations, container, feature);
    }

    // Create the add command for all of the mapping class sets ...
    if (mappingClassSets.size() != 0) {
      // Note:  container will probably be null due to changes in the following underlying method
      // call.
      // This is due to the targetContents' Resource == NULL (see
      // ModelResourceContainerFactory.getMappingClassSetContainer());
      MappingClassSetContainer container = targetContents.getMappingClassSetContainer(true);
      if (container == null) {
        // it's null, so we'll new one up via the TransformationFactory....
        container = TransformationFactory.eINSTANCE.createMappingClassSetContainer();
        // since one wasn't found, we need to create a temporary one and add to contents
        targetContents.getAllRootEObjects().add(container);
      }

      final EStructuralFeature feature =
          TransformationPackage.eINSTANCE.getMappingClassSetContainer_MappingClassSets();
      createAndAppendAddCommand(mappingClassSets, container, feature);
    }

    // Create the add command for all of the transformations ...
    if (transformations.size() != 0) {
      // Note:  container will probably be null due to changes in the following underlying method
      // call.
      // This is due to the targetContents' Resource == NULL (see
      // ModelResourceContainerFactory.getMappingClassSetContainer());
      TransformationContainer container = targetContents.getTransformationContainer(true);
      if (container == null) {
        // it's null, so we'll new one up via the TransformationFactory....
        container = TransformationFactory.eINSTANCE.createTransformationContainer();
        // since one wasn't found, we need to create a temporary one and add to contents
        targetContents.getAllRootEObjects().add(container);
      }

      final EStructuralFeature feature =
          TransformationPackage.eINSTANCE.getTransformationContainer_TransformationMappings();
      createAndAppendAddCommand(transformations, container, feature);
    }
    return null;
  }