project BLF > class RPCRequestService > method ForcePublish


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method RPCRequestService.Main


program code (program1/rpcrequestservice.p)

<M-1 run ReadContextPropertiesForForcePublish
   (output vcComponentsToPublish (ocComponentsToPublish), 
    output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>

<M-69 run ValidateSession
   (output vlSessionStarted (olSessionStarted), 
    output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

do viFcCount1 = num-entries(vcComponentsToPublish) to 1 by -1:
    <M-2 run PublishComponent
       (input  entry(vifccount1, vccomponentsToPublish) (icComponentName), 
        output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if viFcReturnSuper < 0
    then do:
        if vlSessionStarted
        then do:
            <I-29 {tFcStopInstance
                 &CLASS                = "Session"
                 &SESSIONID            = "viSession3ID"}>
        end.
        
        return.
    end.
end.

if vlShutdownSessionRPCRS
then do:
    /* BLF-4122
     * do not report any errors from shutting down the session
     * as the publish itself has been processed successfully at this time
     */
    if  vcSessionIdRPCRS <> ''
    and vcSessionIdRPCRS <> ?
    then do:
        vlogout = yes.
        <I-54 {tFcOpenInstance
             &CLASS                = "Session"
             &ERROR-STATEMENT      = "vlogout = no. oiReturnStatus = 0."
             &SESSIONID            = "0"}>
        if vlogout
        then do:
            <M-85 run Logout  (output viFcReturnSuper (oiReturnStatus)) in Session>
        end.
        <I-27 {tFcCloseAndStopInstance
             &CLASS           = "Session"
             &ERROR-STATEMENT = "vlogout = no. oiReturnStatus = 0."}>
    end.
    else do:
        <I-58 {tFcStopInstance
             &CLASS                = "Session"
             &ERROR-STATEMENT      = "vlogout = no. oiReturnStatus = 0."
             &SESSIONID            = "0"}>
    end.
    
    assign vhSessionContext = vhSessionContextDS:get-buffer-handle(1) no-error.
    if vhSessionContext <> ?
    then do:
        create query vhSQuery in widget-pool "non-persistent".
        vhSQuery:forward-only = yes.
        vhSQuery:set-buffers(vhSessionContext).
        vlFcOk = vhSQuery:query-prepare ("for each ":U + vhSessionContext:name
                                         + " where ":U + vhSessionContext:name + ".propertyName = 'BLFSessionId'").
        if vlFcOk
        then vlFcOk = vhSQuery:query-open().
        if vlFcOk
        then do:
            vhSQuery:get-first().
            if not vhSQuery:query-off-end
            then vhSessionContext:buffer-delete().
        end.
        vhSQuery:query-close().
        delete object vhSQuery.
    end.
end.
else
if vlSessionStarted
then do:
    assign vhSessionContext = vhSessionContextDS:get-buffer-handle(1) no-error.
    if vhSessionContext <> ?
    then do:
        create query vhSQuery in widget-pool "non-persistent".
        vhSQuery:forward-only = yes.
        vhSQuery:set-buffers(vhSessionContext).
        vlFcOk = vhSQuery:query-prepare ("for each ":U + vhSessionContext:name
                                         + " where ":U + vhSessionContext:name + ".propertyName = 'BLFSessionId'").
        if vlFcOk
        then vlFcOk = vhSQuery:query-open().
        if vlFcOk
        then do:
            vhSQuery:get-first().
            if vhSQuery:query-off-end
            then vhSessionContext:buffer-create().
            assign vhSessionContext::propertyQualifier = "QAD"
                   vhSessionContext::propertyName      = "BLFSessionId"
                   vhSessionContext::propertyValue     = string(viSession3ID).
            vhSessionContext:buffer-release().
        end.
        vhSQuery:query-close().
        delete object vhSQuery.
    end.
end.