14 - wd_dataflow context mapping and model binding
TRANSCRIPT
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
1/23
Matthias Weidlich
Web Dynpro:Context Mapping & Model Binding
Seminar System Modeling
08.06.05
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
2/23
HPI, Seminar System Modeling - SS2005 / 2
Agenda
Context Concept
usage of contexts
general structure
context properties
supply functions and context programming
Data Flows in a Web Dynpro Application
overview
data binding
context mapping
model binding
model import
connection to model at runtime
In a Nutshell
References
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
3/23
HPI, Seminar System Modeling - SS2005 / 3
Context Concept: Usage of Contexts
contexts are the main concept for storingand passing data in Web Dynpro
each controller has its own context
all data used in controllers or views is
stored in the context of the correspondingcontroller
a context represents a hierarchical datamodel
a context describes entities and their
relations, so it can be compared to an ERModel
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
4/23
HPI, Seminar System Modeling - SS2005 / 4
Context Concept: General Structure
a context is always
structured as a tree,
consisting of nodes
and attributes
each context has a root node, underneaththe data fields are stored
nodes represent data structures, attributes
represent data elements
Context Element
Subnode
name cardinality selection singleton
Root Node cardinality = 1..1
Value Node
leadSelection
Model Node modelClass
Context
Node Attribute name readOnly
Value Attribute calculated type
Model Attribute
consists
of
"consists
of
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
5/23
Context Concept: Cardinality
Boat
Controller
b3
Red
b2
Green
Sailor
s1 05.05. 07.05.
s5 12.06. 13.06.
Sailor
redb3
greenb2boat_colorboat_ID
Johns5
Jims1sailor_namesailor_ID
13.06.12.06.s5b207.05.05.05.s1b2
rented tillrented fromsailor_IDboat_ID
Lending
rented from
rented till
Boat
boat_ID
color
Sailor sailor_ID
name
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
6/23
HPI, Seminar System Modeling - SS2005 / 6
Context Concept: Cardinality (2)
node elements represent either
an individual instance
of an object type
or a list of instances
this property of a nodeis called cardinality
cardinality is specified
via min appearance ..max appearance:
(0)1..1: the node
contains only one
element instance which
has (not) to be instantiated0(1)..n: the node can contain multiple element instances (at least one)
leadSelection marks one element in an element list
Element in
Design Time
1:1 Node cardinality = 1..1
0:1 Node cardinality = 0..1
1:n Node
cardinality = 1..n
0:n Node cardinality = 0..n
Element in
Runtime
Node
Element0..1
List ofNode
Elements
1..n
0..n
consists
of
can be
mapped to
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
7/23
HPI, Seminar System Modeling - SS2005 / 7
Context Concept: Type and Calculated
type declares the data type of the attribute (type can be Java NativeType, but should be a Java Dictionary Type)
calculated = true means the attribute is not stored as a memory object,but will be automatically calculated by the Web Dynpro Runtime on
demandon demand: the attribute is accessed by a layout controller or somecontroller coding
body of setter- and getter- method is generated automatically, thedeveloper has to code the calculation part
code example for calculated property:
java.lang.String getUserFullName (
IPrivateFormView.IUserDataElement element) {
//@@beginreturn element.getFirstname() + + element.getLastname();
//@@end
}
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
8/23
HPI, Seminar System Modeling - SS2005 / 8
Context Concept: Singleton
singleton = true means that the elements of the relevant node areinstantiated for only one element of the parent node (leadSelection)
Boat
Controller
b3
Red
b2
Green
Sailor
s1 05.05. 07.05.
s5 12.06. 13.06.
Sailor
State5
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
9/23
HPI, Seminar System Modeling - SS2005 / 9
Supply Functions:
special type of controller methods for creating context attributes in
value nodes
method body with user coding area is automatically created
often used in connection with singleton nodes
context programming:
generic APIs
needed for the dynamic creation of new context elements at runtime
use global interfaces, e.g. IWDContext, IWDNode, IWDNodelement
typed APIs
typed APIs are automatically created for statically defined contextelements
method signatures contain the corresponding object typesuse interfaces that are derived from the global interfaces, e.g.IContextNode, INode
Context Concept: Supply Functions & Context Progr.
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
10/23
Data Flows in a Web Dynpro Application
data binding:link betweenview layout andview controllercontext
context mapping:link between twoglobal controllercontexts orbetween globalcontroller
context and view
controllercontext
model binding:link betweenglobal controller
context and WebDynpro Model
Web Dynpro Application
View
Controller
Model
Custom
Controller
Model
Agent
Web Dynpro Runtime
Custom Controller
Context
View Controller
Context
View Layout
to backend system
to
presentation
server
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
11/23
Data Flows: Data Binding
data binding:link betweenview layout andview controllercontext
1:context elementthat has notbeen bound
2:UI element that
has not beenbound
3, 4, 5:UI element /context element
that has beenbound
Web Dynpro Application
View
Controller
Model
Custom
Controller
Model
Agent
Web Dynpro Runtime
Custom Controller
Context
View Controller
Context
View Layout
to backend system
to
presentation
server
2 3 4 5
1
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
12/23
HPI, Seminar System Modeling - SS2005 / 12
Data Flows: Data Binding (2)
properties of the user interface elements can bebound to attributes respectively nodes of a view context
context attributes have to be Java Dictionary Types, as Java Native Typescannot be bound
any user changes to the UI element properties in the view are immediatelyvisible in the context
as the same data storage is assigned, no data transport is necessary
if the UI element property
is a field of values (e.g. a table), the bound node has to be a multiplenode (cardinality = 0/1 . . n)
is a single value bound to an attribute of a multiple node,leadSelection marks the value to show
UI ElementUI Element
Property
Context Attribute
Value Attribute
Node Attribute
is bound toconsists of
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
13/23
Data Flows: Context Mapping
context mapping:link between twoglobal controllercontexts orbetween globalcontroller
context and viewcontrollercontext
1, 2:
context elementthat has not beenmapped
3, 4, 5, 6:context element
that has beenmapped
Web Dynpro Application
View
Controller
Model
Custom
Controller
Model
Agent
Web Dynpro Runtime
Custom Controller
Context
View Controller
Context
View Layout
to backend system
to
presentation
server
2 3 4
1
5 6
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
14/23
HPI, Seminar System Modeling - SS2005 / 14
Data Flows: Context Mapping (2)
locally defined attributes areonly visible for thecorresponding controller
mapped attributes are visible atboth ends of the mapping
again: the same data storage isassigned, no data transport is
necessary
constraint:
attribute 1 can only be mappedon attribute 2, if one of the
parent nodes of attribute 1 ismapped on one of the parentnodes of attribute 2
Nodeconsists
of
Value Node
Model Node
is mapped to
AttributeValue Attribute
Model Attribute
is mapped to
is mapped to
is mapped to
consists
of
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
15/23
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
16/23
Data Flows: Model Binding
model binding:link betweenglobal controllercontext and WebDynpro Model
1:model elementthat has not beenbound
2:context element
that has not beenbound
3, 4, 5:context element /model element
that has beenbound
Web Dynpro Application
View
Controller
Model
Custom
Controller
Model
Agent
Web Dynpro Runtime
Custom Controller
Context
View Controller
Context
View Layout
to backend system
to
presentation
server
2 3
4
1
5
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
17/23
HPI, Seminar System Modeling - SS2005 / 17
Data Flows: Model Binding (2)
Web Dynpro model:
data structure that represents the
data and functionality
of the backend
all model classes have to implement the
Common Model Interface (CMI)
CMI affects data management and eventhandling
access to CMI classes:
with generic methods
with typed getter- and setter methods
Model Element
Model Class name
Non Executable
Model Class
Executable
Model Class
Model
belongs
to
Model Property name type
consists
of
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
18/23
HPI, Seminar System Modeling - SS2005 / 18
Data Flows: Model Binding (3)
constraint:a context model attribute can only be mapped on a model attribute, if oneof the parent nodes of the context model attribute is mapped on one of theparent classes of the model attribute
Model ElementContext Element
Model Class
Model AttributeContext
Model Attribute
Context
Model Node
is bound to
Model
consists of
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
19/23
HPI, Seminar System Modeling - SS2005 / 19
Data Flows: Model Import
supported model types:
UML Web Dynpro Model in the XMI format
webservice description as WSDL
Java Bean model
Remote Function Call (RFC) model
import wizard generates the classes out of the model
Import
Wizard
Model
Agent
R
Model Data
to WebDynpro
Runtime
Models
Webservice Model
(WSDL)
UML Web Dynpro
Model (XMI)Java Bean Model
RFC Model
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
20/23
HPI, Seminar System Modeling - SS2005 / 20
Data Flows: Connection to Model (J2EE based)
J2EE based Web Dynpro Runtime communication:
to webservice via SOAP
to J2EE backend server via Remote Method Invocation (RMI)
to ABAP backend server by using the SAP Java Connector (SAP JCo)
SAP JCo is a middleware component that supports ABAP calls JAVAand JAVA calls ABAP
Model
AgentWebservice Provider
J2EE Backend Server
ABAP Backend Server
R
(RMI)
R
(SOAP)
R
(SAP JavaConnector)
J2EE Web
Dynpro
Runtime
R
Backend
Data
Backend
Data
Backend
Data
Model Data
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
21/23
HPI, Seminar System Modeling - SS2005 / 21
Data Flows: Connection to Model (ABAP based)
ABAP based Web Dynpro Runtime communication:
again: to webservice via SOAP
to ABAP backend server directly by calling RFCs and BAPIs
access to SAP Business Objects is gained by standardized methods:
Business Application Programming Interfaces (BAPIs)Remote Function Calls (RFCs) are a SAP standard for communicationbetween applications on SAP systems as well as non-SAP systems
Model
Agent
Webservice Provider
ABAP Backend Server
R
(SOAP)
R
(RFC, BAPI)
ABAP Web
Dynpro
Runtime
R
Backend
Data
Backend
Data
Model Data
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
22/23
HPI, Seminar System Modeling - SS2005 / 22
In a Nutshell
contexts are the main concept for data management in WebDynpro
a context is a data model
data flows in Web Dynpro:
data binding links properties of user interface elements andcontext attributes
context mapping links context elements
model binding links context elements and elements of themodel
-
8/6/2019 14 - WD_dataflow Context Mapping and Model Binding
23/23
HPI, Seminar System Modeling - SS2005 / 23
References
Web Dynpro Overview, McNulty, SAP AG, 2003Creating your first Web Dynpro Application, SAP Online Help, SAP AG 2004
Creating an Email client using Web Dynpro, SAP Online Help, SAP AG 2004
Java-Programmierung mit dem SAP Web Application Server, Kessler, Tillert,
Dobrikov, Galileo Press, Bonn 2005Introduction to Web Dynpro, SAP Developer Network, www.sdn.sap.com
Web Dynpro Architecture, SAP Library, www.help.sap.com
Business Application Programming Interfaces, tse - technologieberatung undsystementwicklung, Hamburg 2005, http://www.tse-
hamburg.de/Papers/SAP/sapBAPI.htmlSAP BAPI und SAP JCo, Horn, 2005, http://www.torsten-horn.de/techdocs/sap-bapi.htm
Application Server, Web Application Server, Web Services, SOAP, Java,
Horn, 2005, http://www.torsten-horn.de/techdocs/applicationserver.htm
Wiederverwendbare Software (Web Dynpro), Tillert, 2004, www.sap.infoThe new face of SAP - Web Dynpro, Winkler, 2004, http://www.oio.de/web-dynpro-the-new-sap-face.htm