External Context Mapping
In normal context
mapping, the referenced original data is always within a Web Dynpro component.
To be more exact, the original nodes or attributes are either in the component
or in a custom controller context, as the global data store of a Web Dynpro
component.
Context mapping is
usually represented by scenarios where a component is not dependent on
external context data, but saves all context data itself in the original
instead. This means that at design time, no assumptions are made that context
data has to be referred outside of the component limits, that is, context data
that belongs to an external user of the component.
In practice,
however, there are cases where the assumption is made at design time that a
Web Dynpro component should reference external context data in the original.
This means that this type of component is developed deliberately so that it
cannot run independently, but is dependent on its subsequent user (an
embedding component).
Access to the user
of a Web Dynpro component cannot be defined until a concrete component usage
is defined. If you think of Web Dynpro components as classes, then a component
usage corresponds to a variable that references an object instance of this
class.
This type of access
to an external original context by a used component instance is known as
external
context mapping.
To clarify this,
consider the following graphic:
External Context
Mapping
|
-
In a view controller context of the Web
Dynpro component Child, context data outside of the child component should
be referenced using mapping. First of all, normal context mapping is defined
for the component interface context.
-
To reference external context data in
the component interface context, the context structure that is required in it
is defined. At this point, the developer must therefore know the structure of
the original context. The context elements involved must also be marked as
“can be mapped externally later“, that is, the later and
external user of the child component can define the actual context mapping for
the known original context. The property “can be mapped externally
later“ is defined using the isInputElement = true element property.
-
The Web Dynpro component Parent
uses the child component using the definition of a component usage. The child
component does not “see“ its concrete user until this point; here
it is the Web Dynpro component Parent.
-
Normal mapping can now take place at the
level of a concrete instance of the child component (represented by the
component usage) within the outer Parent component. As this context mapping takes place
outside of the defines component, that is, in the level of a concrete
component usage, it is known as external context mapping.
-
The original context to which the
external context mapping refers, keeps the original node elements that are
referenced at runtime. Its structure must contain those context elements that
were previously selected in the component interface context of the used
component as externally mappable input elements (isInputElement =
true ) (step 2). Moreover,
the general rules should be observed on which mapping context nodes and
attributes is based.
|
The following notes
should be observed to aid your understanding of external context
mapping:
-
If a parent component defines the use of
a child component, then it can only be related to the child component by its
component interface (for example using context mapping). For this reason,
external context mapping only starts from the context elements that belong to
the component interface context.
-
External context mapping always occurs
in two steps. In the first step, elements are selected in the component
interface context as “can be mapped externally later”
using the isInputElement = true property. In the second step, the actual context
mapping between the component interface context and the external original
context is defined for a concrete use of a component.
-
In external context mapping it is
possible that mappings to contexts are defined in different controllers. So,
with use A of a child component, there could be external mapping to the
component controller. With a second use B of the same component, the original
context could belong to a custom controller, however. The only condition is
that both original contexts contain such context elements that are compatible
to the “can be mapped externally later“ context structure that is defined in
the component interface.
Restriction
Note that
context attributes cannot be defined as “can be mapped externally
later“ directly below the root node (top level context attribute) in
the component interface content. External context mapping is possible only for
those context attributes that belong to independent or dependent context
nodes.