Relational Databases and Web Integration Week 14
[email protected] Tuesday, 18 August 2009
Composing STDs Recall the Generalized Hello World web application from last week can add new messages into database select a greeting for display Let’s insist that access to this application is controlled via a client login page
Tuesday, 18 August 2009
Last Weeks Example state machine test[
test ]
HelloWorld
Entry Point StartPage
onClick onCancel
addText onSubmit
onClick onClick displayMessageSelections onSelect displayGreeting
Exit Point
Tuesday, 18 August 2009
onClick
text added
Composing STDs state machine test[
compose ]
HelloWorld Login
Login success greeting : test
Tuesday, 18 August 2009
failure
Failure
tryAgain onCancel
The Problem Most dynamic websites are composed of many files located within many different directories This makes it hard to understand the clients potential flows through a website Typically, we have to look at many different controller entities before we understand our sites flow
Tuesday, 18 August 2009
Webflows Describe a clients perspective of a web site along with page event handling Aimed at being: reusable self-contained separation of concerns Capture the navigation through a site (ie. its webflow)
Tuesday, 18 August 2009
Key implementation is the Spring Webflow framework. Webflows are due to be incorporated within Tapestry 5.
Webflows Primary goal to support business process navigation and flows Advantages: clear overview of the system webflow composition unit testing of webflows webflow reuse (self-contained components)
Tuesday, 18 August 2009
Webflows Not always applicable or suitable not useful for sites that require a lot of free-browsing (eg. online communities or blogs) better applied to sites that require controlled navigation (eg. ordering an article)
Tuesday, 18 August 2009
Webflows Webflows may be described using STDs STD states have 5 UML stereotypes applied to them: action decision view end subflow
Tuesday, 18 August 2009
These UML stereotypes are non-standard, so you will need to define them.
Action States Can call a method on your business layer to perform some actions; retrieve data to populate your shop, place an order or login a user If action completes it will redirect you to another state, like a view state, so you can show data you retrieved in the action state State is comparable with a MVC controller
Tuesday, 18 August 2009
Decision State Validate your data, like a conditional statement (if/else, switch) eg. is the user already logged in or have they reached their order limit? Depending on the outcome you can direct the user to another state
Tuesday, 18 August 2009
View State Simply shows a webpage, and waits for input This state is comparable to an MVC view
Tuesday, 18 August 2009
Note: with these types of state we could even knock up mock-ups of our intended views to show our prospective customers.
End State Final state the flow will enter Its main purpose is to let the user know their order was processed (or not), and the flow has completed When reaching this state, all resources associated with the flow are cleaned up
Tuesday, 18 August 2009
Subflow State
Spawns another flow as a subflow
Tuesday, 18 August 2009
Example Want a telephone book search facility allows you to locate an employee of the company using some search criteria once you have found the right person, you can consult detailed information (eg. phone number, desk location, manager, colleagues, etc.)
Tuesday, 18 August 2009
Example: Overview state machine test[
telephone ]
> TelephoneSearch entry return > : searching
back
detail
> : details error Error
Tuesday, 18 August 2009
Example: Search state machine searching[
searching ]
entry > Searching Search Criteria
new search
search Failure validate
Tuesday, 18 August 2009
OK
Person List
detail return
Example: Details
state machine details [
details ]
> Details onError Get Detail OK
error
OK onError
Person Detail back
Tuesday, 18 August 2009
colleague detail
validate
Example: View
package Data[
class-diagram ]
SearchCriteria -firstName : String -lastName : String
PersonList detail
PersonDetail
Error
-firstName : String -lastName : String -userID : String -phone : Integer
colleague
Tuesday, 18 August 2009
package Data[
Example: Controller class-diagram ]
SearchCriteria
new search
-firstName : String -lastName : String
search
Failure ValidateSearch
OK
+search( String, String )
PersonList detail
detail
back
GetDetail
PersonDetail OK
ValidateDetail +detail( String, String )
colleague
-firstName : String -lastName : String -userID : String -phone : Integer
OK
+getDetail( String )
colleague
error
error Error
Tuesday, 18 August 2009
package Data[
class-diagram ]
Example: Entity SearchCriteria
new search
-firstName : String -lastName : String
search
Failure ValidateSearch
OK
+search( String, String )
PersonList detail
detail
back
GetDetail
PersonDetail OK
ValidateDetail +detail( String, String )
colleague
Address
-firstName : String -lastName : String -userID : String -phone : Integer
OK
+getDetail( String )
colleague
error
error Error
Tuesday, 18 August 2009
-firstName : String -lastName : String -userID : String -phone : Integer
Example: Searching
interaction diag1[
diag1 ]
: SearchCriteria
: ValidateSearch
: PersonList
> : Address
1: validate(fname, lname) 2: SELECT * FROM Address WHERE firstName = fname AND lastName = lname 3: rowPtr alt [rowPtr != NULL] 4:
list : Bag
loop [rowPtr != NULL]
5: getRow(rowPtr) 6: row 7: add(row)
8: display(list)
[else] 9: failure() 10: new search 11: 12: display()
Tuesday, 18 August 2009
And of course we also require at least the following additional sequence diagrams: •search criteria validation followed by a details interaction •colleague details accessed via details view •returning to search view from details view
References Spring Webflow Framework Spring Webflow Practical Guide Telephone Example
Tuesday, 18 August 2009