Assigning Other State Machines to Existing Elements
State machines can be assigned to individual element types (i.e. a goal) or multiple elements (i.e. requirements, bugs, user stories). When multiple element types use the same state machine, you can later decide to create a state machine for a specific element type.
Below is an example of how this is done.
Adjust State Machines Already in Use
When working on a project, you will come across state machines that are used for multiple types of requirements. Below is an example of the Bug sub-stereotype, which in this case needs its own state machine.
- Open the Settings window and go to the State machines package.
- Select the state machine … for requirements and execute the Edit command in its context menu.
If a state machine has already been assigned to a stereotype, you can’t assign any other state machines to it. As a result, you need to remove the stereotype from the state machine. - To remove a stereotype from a state machine, go to the Stereotypes tab, select the corresponding stereotype and click the Delete button.
- After clicking Delete, you will be asked if existing states should be deleted.
- Click OK to confirm your choices.
- In the next dialog, you will be presented with options for Yes and No.
If you click Yes, all existing elements will automatically revert to the start state of the new state machine. If no new state machine has been modelled up to this point, the initial state of the stereotype will be applied.
Alternatively, clicking No means that the states remain the same until the editing dialog of an element is opened. (See section for ‘apply state machine to existing elements’).
Create New State Machines
Create a new state machine and assign the relevant stereotypes.
Now, after creating a bug, a new state machine will be used. This isn’t the case, however, for bugs that already exist; for these, new state machines need to be manually applied.
Apply State Machines
Apply State Machines to Existing Elements
After having created a new state machine, you may want to apply it to pre-existing elements that have a different state machine. This action is performed through the standard dialog and is only possible when you selected No in the previous dialog.
- Open a bug.
If the state machine has changed, the part of the dialog for the state of the element will have a yellow button. - Click on this yellow button.
The new state machine will be applied to the element. Check that the initial state of the new state machine is displayed in the element’s dialog to ensure the action has been performed successfully.
- Save your choices.
Apply State Machine After Stereotype Change
Open a requirement and change its stereotype.
You will see the new state machine straight away.
Apply a state and save your choices.