JSRunnable: JSConditionExport, JSNewContextExport, JSPostprocessExport

The JSRunnable Stereotype is not applicable to Rhapsody metaclass, so it can not be model in Rhapsody. It is an abstract M2M metaclass. It is the parent of JSConditionExport, JSNewContextExport and JSPostprocessExport. All of them can be linked to a ExportMappingRule, and executed by the M2M Engine.
These elements can be created into M2MIPackage elements via the contextual menus:

- Add New | M2MIE | JSConditionExport

- Add New | M2MIE | JSNewContextExport

- Add New | M2MIE | JSPostprocessExport

Add new JSRunnables

  1. JSConditionExport

    A JSConditionExport is a Rhapsody Function used as a condition to apply the ExportMappingRule. It must be implemented in JavaScript via the "Implementation" tab. The implemented code has access to all of the M2MExportRuleset JavaScript context (including initM2MIE.js, JSRunnables, JSFunctions, JSVariables, JSFileLibraryies). The signature of this function is the following:

    boolean JSConditionExport_Name ( MDWObject element );


    To create it, right-click on a M2MIPackage, and click on Add New | M2MIE | JSConditionExport.
    When the M2M Engine execute a ExportMappingRule on a model element (IRPModelElement), it provides the IRPModelement which is being transformed as argument to this Function and executes it. Then, the M2M Engine checks the boolean result returned by the JavaScript code. If the value is 'True', it applies the ExportMappingRule on the IRPModelement, if it returns 'False', the ExportMappingRule is not applied.

  2. JSNewContextExport

    A JSNewContextExport is a Rhapsody Function used to move the transformed element in a new owner. It must be implemented in JavaScript via the "Implementation" tab. The implemented code has access to all of the M2MExportRuleset JavaScript context (including initM2MIE.js, JSRunnables, JSFunctions, JSVariables, JSFileLibraryies). The signature of this function is the following:

    MDWObject JSNewContextExport_Name ( MDWObject element );


    To create it, right-click on a M2MIPackage, and click on Add New | M2MIE | JSNewContextExport.
    Just after the M2M Engine transforms a model element, it executes this JSNewContextExport function linked to the ExportMappingRule. This function returns an IRPModelElement, and M2M Engine moves the transformed element in this returned IRPModelElement.

  3. JSPostprocessExport

    A JSPostprocessExport is a Rhapsody Function used to populate the model after an element is transformed. It must be implemented in JavaScript via the "Implementation" tab.s The implemented code has access to all of the M2MExportRuleset JavaScript context (including initM2MIE.js, JSRunnables, JSFunctions, JSVariables, JSFileLibraryies). The signature of this function is the following:

    void JSPostprocessExport_Name ( IRPModelElement element );


    To create it, right-click on a M2MIPackage, and click on Add New | M2MIE | JSPostprocessExport.
    Once the M2M Engine transforms an element, and moves it into the new context element, it executes the JSPostprocessExport function to populate the model with new elements.