Application
Controller
When you have the page flow logic and screen navigation
implemented in views (Web pages), you must change the source code (code-behind)
of the views to change the page flow.
Centralize
the flow of the application and screen navigation, so that you can change flow
or logic in a single location, with no changes (or minimal changes) to the
source code of views.
Minimize
the effort required to update the page flow logic.
Minimize page flow logic code duplication in views.
Three kinds
of objects are defined: Context, View and Controller.
The context
is a structure in which the state of the operation and the data relevant to the
flow are stored. Typically its life cycle is the operation itself. The context
is composed by two parts, the Control and the Business Context. The control
context is composed for those variables whose value determines the navigation
but they are not used in the operation being executed (the newCustomer variable
in the following example). The business context is composed for those variables
that are used by the operation to achieve it goal (Continuing with the same
example, the Customer Variable).
The Views
(also called steps) are activities displayed according to the logic defined in the
activity diagram. Generally, there’s more than one view in an operation. Each
view handles the logic of the step it implements, ignoring intentionally the
navigation logic. Its communication method is the Context. It reads and writes
the Context.
Last but
not least, the controller is the component responsible to determine the
activity to show according to the Context, the Current View and the activity
diagram. It can be generated from the business context and the activity
diagram. It also reads and writes the
Control Context. Typically it only reads the Business Context.
Given the
following input:
Select
Customer maps to SelectCustomer Object
New Customer
maps to NewCustomer Object
Select
Products maps to SelectProducts Object
ShippingAddress
maps to Shipping Address Object
Summary maps
to Summary Object
Context:
It
generates the following objects:
NewPurchaseOrder
is the web panel that implements the operation. It Wraps the different views
and stores the current step.
ControllerNewPurchaseOrder
is the procedure that implements the navigation logic.
ControlContext
is a SDT generated with the necessary information for the controller to choose
the following step.
You can Download the example from Here