UML Sequence Diagrams Examples

Here we provide some examples of UML sequence diagrams:


Next  Online bookshop UML sequence diagram

Purpose: An example of high level UML sequence diagram for Online Bookshop.

Summary: Online customer can search book catalog, view description of a selected book, add book to shopping cart, do checkout.


Next  Submit comments to Pluck using DWR, AJAX, JSON

Purpose: An example of UML sequence diagram which shows how user comments on some article are submitted to Pluck using various AJAX technologies.

Summary: Comments submitted by a web user are first validated by the web site which is hosting commented article. DWR technology (AJAX for Java) is used to convert user comments HTML form data into Java object and possible validation errors - back into JavaScript callbacks for errors. Comments that look Ok are submitted to Pluck server hosting all comments to all articles.


Next  Facebook user authentication in a web application

Purpose: An example of sequence diagram which shows how Facebook user could be authenticated in a web application to allow access to his/her Facebook resources.

Summary: Facebook uses OAuth 2.0 protocol framework which enables web application (called "client"), which is usually not the Facebook resource owner but is acting on the Facebook user's behalf, to request access to resources controlled by the FB user and hosted by the Facebook server. Instead of using the Facebook user credentials to access protected resources, the web application obtains an access token.


Next  Spring and Hibernate transaction management

Purpose: An example of UML sequence diagram which illustrates transaction management combined with exception handling using Spring framework for enterprise Java™ and Hibernate.

Summary: Spring application development framework for enterprise Java™ integrates Hibernate transaction management. Business method execution could complete (successfully or not) without throwing any exception, or by throwing some Java runtime (unchecked) exception or some business (checked) exception. Transaction interceptor will will decide to try to commit transaction or to roll it back.


Submit Comments to Pluck

An example of sequence diagram which shows how user comments on some article are submitted to Pluck using various AJAX technologies. (See example of interaction overview diagram with similar semantics at Submit Comments to Pluck using DWR, AJAX, JSON.)

Comments submitted by user are first validated by the web site hosting articles. DWR technology (AJAX for Java) is used to convert user comments HTML form data into Java object and possible validation errors - back into JavaScript callbacks for errors.

Comments that look Ok are submitted to Pluck server hosting all comments to all articles. AJAX technology is also used in this case both to submit the new comment as well as to get back the list of all recent comments (including the new one). JSON is used to get comments back.

This diagram also shows some duration constraints. (Disclaimer: constraints shown are fictitious and not describing any real communication.) For example, according to the diagram callback waiting time for posted comment varies from 1 to 4 seconds. At the same time, requesting all posted comments takes only up to 100 msec.

Sequence diagram example - submit comments to Pluck using DWR, AJAX, JSON.

Sequence diagram example - submit comments to Pluck using DWR, AJAX, JSON.

Facebook User Authentication in a Web Application

An example of 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 (client_id) 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.

Sequence diagram example - Facebook User Authentication in a Web Application.

Sequence diagram example - Facebook User Authentication in a Web Application.

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.

Next  Spring and Hibernate transaction management

Comments
blog comments powered by Disqus