Interfaces for Attributes
You can add an interface to a business object if the business object
hierarchy has a local attribute with the same name as one of the interface
attributes as shown in the following
MQL
session. The naming convention for the local attributes,
I1.a1
, denotes the local attribute
a1
belonging to interface
I1
.
MQL<35>add type T1; MQL<36>add attribute a1 type string default a1-def-value; MQL<37>mod type T1 add attribute a1; MQL<38>add interface I1 type T1; MQL<39>add attribute a1 type string owner interface I1 default I1-a1-def-value; MQL<40>add bus T1 test 0 vault unit1 policy simple-u; MQL<41>mod bus T1 test 0 add interface I1; MQL<42>print bus T1 test 0 select attribute; business object T1 test 0 attribute = a1 attribute = I1.a1 MQL<43>print bus T1 test 0 select attribute.value; business object T1 test 0 attribute[a1].value = a1-def-value attribute[a1].value = I1-a1-def-value MQL<44>print bus T1 test 0 select attribute[a1]; business object T1 test 0 attribute[a1] = I1-a1-def-value attribute[a1] = a1-def-value MQL<45>print bus T1 test 0 select attribute[*a1]; business object T1 test 0 attribute[a1] = I1-a1-def-value attribute[a1] = a1-def-value MQL<46>print bus T1 test 0 select attribute[I1.a1]; business object T1 test 0 attribute[a1] = I1-a1-def-value
You can add two interfaces on a business object if both interfaces owned a local attribute with the same name, as shown in the following MQL trace:
MQL<28>add type T1; MQL<29>add interface I1 type T1; MQL<30>add interface I2 type T1; MQL<31>add attribute a1 type string owner interface I1 default I1-a1-def-value; MQL<32>add attribute a1 type string owner interface I2 default I2-a1-def-value; MQL<33>add bus T1 test 0 policy simple-u vault unit1; MQL<34>mod bus T1 test 0 add interface I1; MQL<35>mod bus T1 test 0 add interface I2; MQL<36>print bus T1 test 0 select attribute; business object T1 test 0 attribute = I1.a1 attribute = I2.a1 MQL<37>print bus T1 test 0 select attribute.value; business object T1 test 0 attribute[a1].value = I1-a1-def-value attribute[a1].value = I2-a1-def-value MQL<38>print bus T1 test 0 select attribute[a1]; business object T1 test 0 attribute[a1] = I2-a1-def-value attribute[a1] = I1-a1-def-value MQL<39>print bus T1 test 0 select attribute[*a1]; business object T1 test 0 attribute[a1] = I2-a1-def-value attribute[a1] = I1-a1-def-value MQL<40>print bus T1 test 0 select attribute[I1.a1]; business object T1 test 0 attribute[a1] = I1-a1-def-value MQL<41>print bus T1 test 0 select attribute[I2.a1]; business object T1 test 0 attribute[a1] = I2-a1-def-value