project BLF > include bFcRun.i

Description

This include supports method calls in the server components business logic.
The programmer is not allowed to use this include directly into his code.


include parameters


&CLASSClass short name.
Blank if you want to run a method of the same class.
&CLASSTYPEclass type of the called class
&PARAMETERSParameter list for the method call, excluding ().
&PROCEDUREName of the method to call.
&USER-DEFINED-CONTEXT


Internal usage


BLF
method business.ExitInstance
method business.GetPublicData
method business.SetPublicData
method business.StoreState
method database.AddDetailLine
method database.AdditionalUpdates
method database.ApiGetAlternateKeyValues
method database.Calculate
method database.ClearData
method database.DataDelete
method database.DataNew
method database.GetActivitiesForStatus
method database.GetXmlRepresentationDataset
method database.InitialValues
method database.MaintainByDatasetWithOutput
method database.SetNewStatus
method database.ValidateActivityCode
method database.ValidateBC
method database.ValidateComponent
method database.ValidateUI
method database.ValueChanged
method breport.ApiProcessReportLogic


include code

&if "{&CLASS}" = ""
&then
    /* run method in own class */
    &if "{&PARAMETERS}" = ""
    &then
    run {&PROCEDURE} in {&TARGETPROCEDURE}.
    &else
    run {&PROCEDURE} in {&TARGETPROCEDURE} ({&PARAMETERS}).
    &endif
&elseif "{&CLASS-REF}" = ""
&then
    &if defined(vh{&CLASS}Inst)
    &then
        /* run method in instance of referenced class */
        &if "{&PARAMETERS}" = ""
        &then
        run {&PROCEDURE} in vh{&CLASS}Inst.
        &else
        run {&PROCEDURE} in vh{&CLASS}Inst ({&PARAMETERS}).
        &endif
    &elseif "{&CLASSTYPE}" = "T"
    &then
        /* run method in a technical class, using a generic handle */
        &if "{&PARAMETERS}" = ""
        &then
        run {&PROCEDURE} in vhFcComponent.
        &else
        run {&PROCEDURE} in vhFcComponent ({&PARAMETERS}).
        &endif
    &else
        /* Run method in a business class without reference, using a generic handle.
           class must be started and stopped here. */
        if vhFcComponent = ?
        then do:
            assign viFcCount1  = 0
                   vlFcStarted = yes.
            run value(lc("ins/ins__{&CLASS}.p":U)) persistent set vhFcComponent.
            run MainBlock in vhFcComponent
               (input viSessionId,
                input 0,
                input ?,
                input no,
                input "{&USER-DEFINED-CONTEXT}",
                input-output viFcCount1,
                output viFcIncludeReturn).
            if viFcIncludeReturn < 0
            then do:
                assign oiReturnStatus = viFcIncludeReturn.
                run StopInstance in vhFcComponent
                   (input "",
                    input "",
                    input "",
                    input no,
                    output viFcIncludeReturn).
                delete procedure vhFcComponent.
                return ?.
            end.
        end.
        else vlFcStarted = no.

        &if "{&PARAMETERS}" = ""
        &then
        run {&PROCEDURE} in vhFcComponent.
        &else
        run {&PROCEDURE} in vhFcComponent ({&PARAMETERS}).
        &endif
        
        if vlFcStarted
        then do:
            run StopInstance in vhFcComponent
               (input "",
                input "",
                input "",
                input no,
                output viFcIncludeReturn).
            delete procedure vhFcComponent.
            if viFcIncludeReturn < 0
            then do:
                assign oiReturnStatus = viFcIncludeReturn.
                return ?.
            end.
        end.
    &endif
&else
    /* run method in instance of referenced class */
    &if "{&PARAMETERS}" = ""
    &then
    run {&PROCEDURE} in vh{&CLASS-REF}Inst.
    &else
    run {&PROCEDURE} in vh{&CLASS-REF}Inst ({&PARAMETERS}).
    &endif
&endif