project BLF > class BEventDaemonQueue > method CreateEvent

Description

Create a publishing event (to be processed by EPD)


Parameters


icClassNameinputcharacterThe name of the component/class on which the event took place.
iiObjectIdinputintegerThe internal id of the object
icObjectRowIdinputcharacter
iiEventDestinationIDinputintegerid
icEventDestinationTypeinputcharacter
ihParentClassinputhandle
ilHeaderOnlyinputlogical
ilSuppressEmptyFieldsinputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method database.PublishEvent


program code (program1/beventdaemonqueue.p)

<M-21 run AddDetailLine (input  'fcDaemonQueue':U (icTable), 
                         input  '' (icParentRowid), 
                         output viFcReturnSuper (oiReturnStatus)) in BEventDaemonQueue>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign tfcDaemonQueue.DaemonQueueRef = string(iiObjectId).

if vcEventClassName <> icClassName
or vcEventClassLng  <> current-language
then do:
    <Q-30 run LanguagePrim (all) (Read) (NoCache)
       (input current-language, (LngCode)
        input ?, (LngID)
        output dataset tqLanguagePrim) in BLanguage>
    find first tqLanguagePrim where tqLanguagePrim.tcLngCode = current-language no-error.
    
    <Q-29 run BusComponentInfo (all) (Read) (NoCache)
       (input ?, (BusComponentId)
        input icClassName, (BusComponentCode)
        input (if available tqLanguagePrim then tqLanguagePrim.tiLng_ID else -1), (LngId)
        output dataset tqBusComponentInfo) in BBusinessComponent>
    find first tqBusComponentInfo no-error.
    
    assign vcEventClassLabel = (if available tqBusComponentInfo
                                then if tqBusComponentInfo.tcBusComponentLabelTranslated = ?
                                     or tqBusComponentInfo.tcBusComponentLabelTranslated = ""
                                     then tqBusComponentInfo.tcBusComponentCode
                                     else tqBusComponentInfo.tcBusComponentLabelTranslated
                                else icClassName)
           vcEventClassName  = (if available tqBusComponentInfo
                                then tqBusComponentInfo.tcBusComponentCode
                                else icClassName)
           viEventClassId    = (if available tqBusComponentInfo
                                then tqBusComponentInfo.tiBusComponent_ID
                                else 0).
    
    vcEventClassLng = current-language.
end.

tfcDaemonQueue.DaemonQueueRefDescription = substitute(#T-28'Event for component &1 (&2)':255(9378)T-28#,vcEventClassLabel,vcEventClassName).

<M-11 run AddDetailLine (input  'EventDaemonQueue':U (icTable), 
                         input  tfcDaemonQueue.tc_Rowid (icParentRowid), 
                         output viFcReturnSuper (oiReturnStatus)) in BEventDaemonQueue>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

/* random class, will be replaced by parent class at run-time */

assign vhFcComponent = ihParentClass.

<M-54 run DumpXmlToLongchar
   (input  ilHeaderOnly (ilHeaderOnly), 
    input  ilSuppressEmptyFields (ilSuppressEmptyFields), 
    input  0 (iiPriority), 
    input  (icEventDestinationType = {&EVENTDESTINATIONTYPE-DIRECTAPPSERVER}) (ilWriteXMLSchema), 
    input  icObjectRowId (icObjectRowId), 
    input  no (ilExportForInput), 
    output vpXmlRepresentation (opXmlRepresentation), 
    output viFcReturnSuper (oiReturnStatus)) in BCompany>
    
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

assign tEventDaemonQueue.EventDestination_ID       = iiEventDestinationID
       tEventDaemonQueue.EventDaemonQueueStatus    = "INIT":U
       tEventDaemonQueue.tcBusComponentCode        = vcEventClassName
       tEventDaemonQueue.BusComponent_ID           = viEventClassId
       tEventDaemonQueue.EventDaemonQueueLOB       = vpXmlRepresentation.