JSRunnable: JSConditionImport, JSNewContextImport, JSPostprocessImport

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 JSConditionImport, JSNewContextImport and JSPostprocessImport. All of them can be linked to a ImportMappingRule, and executed by the M2M Engine.
These elements can be created into M2MIPackage elements via the contextual menus:

- Add New | M2MIE | JSConditionImport

- Add New | M2MIE | JSNewContextImport

- Add New | M2MIE | JSPostprocessImport

Add new JSRunnables

  1. JSConditionImport

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

    boolean JSConditionImport_Name ( MDWObject element );


    To create it, right-click on a M2MIPackage, and click on Add New | M2MIE | JSConditionImport.
    When the M2M Engine execute a ImportMappingRule 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 ImportMappingRule on the IRPModelement, if it returns 'False', the ImportMappingRule is not applied.

  2. JSNewContextImport

    A JSNewContextImport 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 M2MImportRuleset JavaScript context (including initM2MIE.js, JSRunnables, JSFunctions, JSVariables, JSFileLibraryies). The signature of this function is the following:

    MDWObject JSNewContextImport_Name ( MDWObject element );


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

  3. JSPostprocessImport

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

    void JSPostprocessImport_Name ( IRPModelElement element );


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