Managing mapping models in transformations

After you configure a transformation to create a mapping model, you can add code to a Java™ class in the transformation to create mapping models, to extract information from mapping models, and to validate the mapping parameters that the transformation context contains.

Before you begin

The current workspace must contain an Eclipse plug-in that contains the following items:
  • Instance of the extension point
  • TransformationProvider element
  • Transformation element
The transformation must be configured to support the creation of mapping models, and the transformation context must contain the mapping parameters. Typically, a transformation user specifies mapping parameters on the Mapping tab of the transformation configuration editor.

About this task

The mapping parameters in the transformation context determine the mapping mode. The mapping mode specifies which of these mapping model actions, if any, the transformation should complete:
  • Create or update a mapping model
  • Extract mapped object names from a mapping model


  1. In the navigation view, in a transformation project, open the Java file to which you are adding methods to determine the mapping mode.
  2. To determine the mapping mode, invoke the methods in the class named, as in the following example:
    if (MappingModeUtility.isNoMappingMode(context)) {
    	// Run the transformation with the mapping model functionality disabled.
    else if (MappingModeUtility.isAMappingModelWritingMode(context) {
    	// Create or update a mapping model.
    else  if (MappingModeUtility.isUsesMappingMode(context) {
    	// Extract mapped object names from a mapping model.
  3. To complete any of the actions in the following table, add the appropriate method invocations to the code fragment shown in step 2. Depending on how the transformation transforms source objects, you might insert additional code between these method calls.
    Action Methods to invoke
    Create or update a mapping model
    • initialize(ITransformContext)
    • populateMappingModel(List, ITransformContext) or populateMappingModel(NamedElement, ITransformContext)
    • terminate(ITransformContext)
    Tip: If the mapping model must generate artifacts that follow a platform-specific naming convention, you can specify this naming convention in the transformation documentation: In the plug-in manifest file, the document attribute of the Transformation element specifies the location of the transformation documentation.
    Extract the mapped object names from a mapping model
    • initialize(ITransformContext)
    • One or more invocations of getFilename(NamedElement, ITransformContext, Character) or getFilenameIgnoringParent(NamedElement, ITransformContext)
    • terminate(ITransformContext)
    Validate the mapping parameters in a transformation context From the method in the transformation provider class named validateContext(ITransformationDescriptor descriptor, ITransformContext context) , invoke the following method: validateContext(ITransformContext)
  4. Click File > Save.
  5. Click Project > Build Project.