Linking transformation output to other transformations

You can link output from a transformation to with another transformation to create combinations of model-to-model transformations and Java™ Emitter Templates (JET) model-to-text transformations. This functionality enables you to create more complex transformations, such as the UML-to-Java transformation.
The transformation to which you link must be registered before or when you run your model-to-model transformation.
To link model-to-model transformation output to another transformation:
  1. In the Project Explorer view, in the transformation mapping project, double-click the generated TransformationProvider Java file. For example, if the mapping model in the mapping project is called Source2Target, double-click the Source2TargetTransformationProvider.java file.
  2. Specify an add post-processing rule in the createRootTransformation method.
  3. In the post-processing rule, specify the ID of the transformation to invoke.
  4. Remove or edit the @generated tag for the createRootTransformation method.
  5. Click File > Save.
The next time that you run the model-to-model transformation, the target model that the transformation generates becomes input to the transformation that you specify in the processing rule.

The following code fragments show a modified @generated tag in the createRootTransformation method, and an add post-processing rule that invokes another transformation.

The add post-processing rule in the code fragment below invokes a JET transformation with a transformation ID that is set to MyJetTransformation:
/**
     * Creates a root transformation. You may add more rules to the transformation here
     * <!-- begin-user doc -->
     * <!-- end-user-doc -->
     * @param transform The root transformation
     * @generated NOT
     */
    protected RootTransformation createRootTransformation(ITransformationDescriptor descriptor) {
        return new RootTransformation(descriptor, new MainTransform()) {
            protected void addPostProcessingRules() {
                add(new JETRule(“MyJetTransformation")); //$NON-NLS-1$
            }
        };
    }
The add post-processing rule in the code fragment below invokes a model-to-model transformation with a transformation ID that is set to MyM2MTransformation:
/**
     * Creates a root transformation. You may add more rules to the transformation here
     * <!-- begin-user doc -->
     * <!-- end-user-doc -->
     * @param transform The root transformation
     * @generated NOT
     */
    protected RootTransformation createRootTransformation(ITransformationDescriptor descriptor) {
        return new RootTransformation(descriptor, new MainTransform()) {
            protected void addPostProcessingRules() {
                add(new TransformRule("MyM2MTransformation")); //$NON-NLS-1$
            }
        };
    }

Feedback