Skip to content

State Machine Import

bruno.buzzi edited this page Aug 24, 2018 · 30 revisions

State Machine Import from UML Diagram



U-Fabrik allow to import State Machine from UML Case tools. In order to perform a import follow the next steps (see figure 1):

  1. Select the XMI file where the State Machine is defined (Open File).
  2. Create a State Machine Definition (Create).
  3. Select the State Machine to import form the list (State Machine List).
  4. Complete State Machine options.
  5. Complete Transition options.
  6. Complete State options.
  7. Click Import.

Figure 1

Figure 2
Each element in the State Machine must be represented by a Class in the class diagram. The State Machine itself also must be represented by a Class. This class structure must comply some requirements:

  • All classes must have an attribute to describe its name.[in this case is name]
  • State Machine class has a collection of Transitions (1 to N relation). [in this case is StateMachineDefinition]
  • Transition class belong to one State Machine. [in this case is TransitionDefinition]
  • Transition class has two 1 to 1 relations with State class. [in this case current and next - but these names can be overriden with start and end for example (start is current and end is next)]
  • State class must have two boolean attributes (isInitial and isFinal). [in this case is StateDefinition]
    Figure 3
    This figure show how the Import dialog elements are related to class diagram elements.
    Figure 4
    In Transition options if "Start State Message" or "End State Message" have different name in the class diagram (in this case current and next) then those messages must implemented by simple answering the corresponding attribute:
    TransitionDefinition

How the State Machine is Imported

The State Machine is imported as instances of the selected classes. A group of convenience methods are created within "state machine" category to handle State Machine states and transitions. This includes methods to the class that host the State Machine (in this case ForeignTransaction).