Dashboard > Struts University > Home > MailReader > MailReader Use Cases > Retain
Added by Ted Husted, last edited by Ted Husted on Apr 05, 2006  (view change)
Labels: 
(None)


Brief

Profiles and subscriptions are stored for later retrieval.

Narrative

A client submits a request to the Registration action for a new User account for the username "trillian". The system queries the database

User user = getDatabase().findUser(username); // Database method

to see if the user exists, and then obtains a new User object for "trillian".

user = database.createUser(username); // Database method

The system stores the User object in the client's session.

setUser(user); // Action call

The client submits a request for a new Subscription for "mail.magrathea.com". After checking to see if the Subscription already exists, the system obtains a new Subscription object from the client's User.

Subscription sub = getUser().createSubscription(host); // Database method

The system stores the Subscription object in the client's session too.

setSubscription(sub); // Action property

The client submits a request that the "mail.magrathea.com" Subscription be deleted. The system obtains the Subscription from the client's User object,

Subscription sub = getUser().findSubscription(host); // Database method

and it asks the User object to remove the Subscription.

getUser().removeSubscription(sub); // Database method via Action property

The system asks the Database object to store the changes to the persistence system.

getDatabase().save(); // Database method

Goal

Goal Create, retrieve, update, and delete Users and their Subscriptions.
Level Subfunction (User Goal, Summary, Subfunction)
Trigger System needs to exercise a CRUD operation.
Primary Actor System

Main Success Scenario (MSS)

Step Action
1 System requests User object from Database object by providing username
2 Database provides User object
3 System updates User object properties
4 System requests Subscription from User object by providing host name
5 User object provides the Subscription object
6 System updates Subscription properties
7 System requests Subscription be removed by providing the host name
8 User object removes Subscription
9 System invokes Database Save command
10 Database stores Users and Subscriptions to persistance system

Extensions

Step Branching Action
   
1a Database object not available
.1 System logs and presents error condition
   
1b  
.1 Database object returns null to indicate User is not found
.2 System requests new User object for username
.3 Database object registers and returns new User object for username
   
4a User returns null to indicate Subscription does not exist
.1 User object returns null to indicate Subscription is not found
.2 System requests new Subscription object for host
.3 Database object registers and returns new Subscription object for host

Preconditions and Guarantees

Preconditions Reference to Database object obtained at system startup

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators