TOP

copy.to.metamodel

Description

Copy a model, represented in one metamodel, as the same model in another metamodel, according to explicitly provided rules for metamodel mapping rules. For example, if appropriate metamodel mapping rules are provided, it will copy a model from UML 1.3 to UML 1.4.

Implementation class

net.mdatools.modelant.core.task.CopyBetweenMetamodels

Parameters

Attribute Description Type
from The name of the extent that holds the original model (in the original metamodel) String
to The name of the extent where to create the copy of the model (in the target metamodel) String

Nested elements

Element Description
Define rule(s) to map the original metamodel to the target metamodel Choose among:
Element Description
identity Define identity correspondence between the source and target metamodels
mapper Define correspondence between the source and target models. Map instances of source METAmodel packages, classes, enums and structs (i.e. model elements) to corresponding instances of the target METAmodel elements. Convention:
  • if no mapping defined, then assume that the source and the target model elements have the same qualified names.
 Usage:
   source package + target package  
     -> maps all classes in the source package to target classes with the same name and target package,
        this way effectively just renaming the package and copying its contents
     
   source package + source type name + target package + target type name 
     -> maps a single source class (by qualified name) to a single target class (by its qualified name)
     
   source package + source type name + target package + target type name + nested Ant tasks 
     -> maps a single source class (by qualified name) to a single target class (by its qualified name)
        and calls the Ant tasks script for each instance of the source type with the properties:
          source = source type instance (model object/element)
          target = target type instance (model object/element)
        
   source package + source type name + field name + target field name 
     -> maps a single field name in source class (by qualified name) to a single field name
        in the corresponding target class, where this correspondence is defined in another map either
        as source class to target class mapping or as source package to target package mapping.  
     
   source type name + target type name 
     -> maps a single source class (by simple name) to a single target class (by its simple name)
     
   source type name + target type name + nested Ant tasks
     -> maps a single source class (by simple name) to a single target class (by its simple name)
        and calls the Ant tasks script for each instance of the source class, with the properties:
          source = source type instance (model object/element)
          target = target type instance (model object/element)
     
   source type name + field name + target field name 
     -> maps a single single field in a source class (by simple name) to a single field name
        in the corresponding target class, where this correspondence is defined in another map either
        as source class to target class mapping or as source package to target package mapping.  
     
   source package + source enum type name + source enum value + target enum value 
     -> maps a single value of an enumeration (by qualified name) in the source model to a target enum value
     
   source enum type name + source enum value + target enum value 
     -> maps a single value of an enumeration (by simple name) in the source model to a target enum value
     
   source enum value + target enum value 
     -> maps a single value of an enumeration in the source model to a target enum value
     
   source field name + target field name 
     -> maps a single field name to a target field value
 
Ant definition (see antlib.xml):
   <copy.metamodels>
     <mapper>
        <map sourcePackage=... />
     </mapper>
   </copy.metamodels>
 
The fixed target field name NO-MAP allows skipping a field's mapping.
tasks Add specific tasks to post-process the pairs of corresponding model elements from the original and result models. The tasks find those model elements bound in SOURCE and TARGET local properties.

Nested elements

Element Description
Any task Tasks to process each pair of corresponding model elements, bound in SOURCE (the element from 'from' model) and TARGET (the element from 'to' model) properties.

Use <typedef resource="net/mdatools/modelant/core/antlib.xml"/>
Documentation generated by ant.doc Ant macro from ModelAnt by MDA Tools