Prev | Next |
Code Generation - Activity Diagrams
Code generation from Activity diagrams in a Class requires a validation phase, during which Enterprise Architect uses the system engineering graph optimizer to analyze the diagram and render it into various constructs from which code can be generated. Enterprise Architect also transforms the constructs into one of the various action types (if appropriate), similar to the Interaction diagram constructs.
Actions
Action |
Description |
See also |
---|---|---|
Call Actions (Invocation Actions) |
Used to invoke operations or behaviors in an Activity diagram; the two main variants of Call Actions supported in behavioral code generation are:
Arguments Call Actions can specify argument values corresponding to the parameters in the associated behavior or behavioral feature. You can add the arguments manually or create them automatically using the of the 'Arguments' dialog. |
Assign Action Pins Behavior Calls Synchronize Arguments |
CreateObjectAction |
Used to denote an object creation in the activity flow; you can set the result Pin of the CreateObjectAction as the object to be created, using the Properties window for the Action element. The Classifier of the CreateObjectAction signifies the Classifier for which an instance is to be created. |
Assign Action Pins |
DestroyObjectAction |
Used to denote an object deletion in the activity flow; you can set the target Pin of the DestroyObjectAction as the object to be destroyed, using the Properties window for the Action element. |
Assign Action Pins |
Loops |
Enterprise Architect's system engineering graph optimizer is also capable of analyzing and identifying loops; an identified loop is internally rendered as an Action Loop, which is translated by the EASL code generation macros to generate the required code. You can have a single loop, nested loops, and multiple levels of nested loops. |
|
Conditional Statements |
To model a conditional statement, you use Decision/Merge nodes. Alternatively, you can imply Decisions/Merges internally; the graph optimizer expects an associated Merge node for each Decision node, to facilitate efficient tracking of various branches and analysis of the code constructs within them. |
Notes
- To be able to generate code from behavioral models, all behavioral constructs should be contained within a Class
Learn more
- EASL Code Generation Macros
- Assign Action Pins
- Interactions and Activities
- Behavior Calls
- Synchronize Arguments
- Resource: EAExample Model > Example Model > Software Engineering > Java Model With Behaviors > TestSelectionSort