You are on page 1of 5

Sequence Diagram

a sequence diagram with objects of the classes flight number, flight, and
plane model. The diagram, as a whole, documents the flow of the
mutation «M» flight number irrelevant:

The diagram can be read from top to bottom. The flow starts with the
actor (1) sending the mutation event «M» flight number irrelevant (2) to
an object of the class flight number (3). The object of class flight
number (3) forwards the mutation event «M» flight number irrelevant
(4) to an object of the class plane model (5). Again, the processing of the
event within the object remains invisible. The processing of the events is
completed in the plane model object (5), and the control goes back to the
sender of the event, so to the flight number object (3). No separate event
arrow is inserted for the “reply”, after processing is completed. Finally,
the mutation event «Q» flight number irrelevant (6) is sent to the object
of class flight (7). Since it is possible that a flight number of objects
knows many flight objects the mutation event is sent to all flight objects
of the flight number object.
State Diagram
1) This is an example of UML behavioral state machine diagram showing
Bank Automated Teller Machine (ATM) top level state machine.

2) ATM is initially turned off. After the power is turned on, ATM performs
startup action and enters Self-Test state. If the test fails, ATM goes into Out
of Service state, otherwise there is triggerless transition to the Idle state.

3) In this state ATM waits for customer interaction. The ATM state changes
from Idle to Serving Customer when the customer inserts banking or credit
card in the ATM's card reader.

4) On entering the Serving Customer state, the entry action read Card is


performed. Note, that transition from Serving Customer state back to
the Idle state could be triggered by cancel event as the customer could
cancel transaction at any time.

5) Serving Customer state is a composite state with sequential


substates Customer
6) Authentication, Selecting Transaction and Transaction. Customer
Authentication and Transaction are composite states by themselves which
is shown with hidden decomposition indicator icon. Serving Customer state
has triggerless transition back to the Idle state after transaction is finished.
The state also has exit action eject Card which releases customer's card on
leaving the state, no matter what caused the transition out of the state.
An example of UML sequence diagram which shows how Facebook (FB) user
could be authenticated in a web application to allow access to his/her FB resources.
Facebook uses OAuth 2.0 protocol framework which enables web application
(called "client"), which is usually not the FB resource owner but is acting on the
FB user's behalf, to request access to resources controlled by the FB user and
hosted by the FB server. Instead of using the FB user credentials to access
protected resources, the web application obtains an access token.
Web application should be registered by Facebook to have an application ID
(ClientID) and secret (client secret). When request to some protected Facebook
resources is received, web browser ("user agent") is redirected to Facebook's
authorization server with application ID and the URL the user should be redirected
back to after the authorization process.
User receives back Request for Permission form. If the user authorizes the
application to get his/her data, Facebook authorization server redirects back to the
URI that was specified before together with authorization code ("verification
string"). The authorization code can be exchanged by web application for an
OAuth access token.
If web application obtains the access token for a FB user, it can perform authorized
requests on behalf of that FB user by including the access token in the Facebook
Graph API requests. If the user did not authorize web application, Facebook issues
redirect request to the URI specified before, and adds the error reason parameter to
notify the web application that authorization request was denied.

You might also like