Example
Let’s assume that an Order business object exists. The protected layer is implemented in library ppmmmbl999st00. The root component maps to table ppmmm999.
Primary key of table ppmmm999 is otyp, orno. The business object has two attribute implementations for these columns: orderType and orderNumber. The public identifier is orderID, which is calculated from orderType and orderNumber.
In that case the method will be:
ppmmm.bl999st00.Order.ShowAndPublishEvent(
const string i.eventAction,
domain ppmmm.otyp i.orderType,
domain ppmmm.orno i.orderNumber
[boolean i.instanceAvailable,
const string i.actionType])
Input:
- The i.eventAction can be any string (as long as it matches the BDE standard for event actions), except one of the standard event actions (“create’, “change”, “delete”). It must always be filled.
- The parameter(s) after i.eventAction are the internal identifiers for the object or component instance to be published. In this example, two parameters are used. The implementation of this method will determine the value for the orderID based on the second and third input parameters and then it will build and publish the corresponding event.
- i.instanceAvailable: optional, true if unspecified; if false, only identifiers are included in the event message and the Show method is unused; this must only be set to false if the instance is unavailable so the Show will fail!
- i.actionType: if empty (or unspecified) no actionTypes are set, if filled this action type will be used for the component instance and all other component instances (parents/children) will get action type ‘unchanged’.
If the method is invoked as follows:
ppmmm.bl999st00.Order.ShowAndPublishEvent(
“cancel”,
ppmmm.otyp.purchase, “123”)
then the following event is published, for example:
<EventMessage>
<ControlArea>
<eventEntity>Order</eventEntity>
<eventAction>cancel</eventAction>
<eventTimeStamp>2007-01-16T10:56:38Z</eventTimeStamp>
<eventSupplier>LN Company 590</eventSupplier>
</ControlArea>
<DataArea>
<Order>
<orderID>PUR_00123</orderID>
<orderDate>2007-01-10T10:56:38Z</ orderDate >
<Line>
<orderLineNumber>1</orderLineNumber>
<item>100</item>
<quantity>12</quantity>
<price>9.99</price>
<orderedQuantityValue>100</orderedQuantityValue>
</Line>
<Line>
<orderLineNumber>2</orderLineNumber>
<item>200</item>
<quantity>1</quantity>
<price>39.95</price>
</Line>
</Order>
</DataArea>
</EventMessage>