project BLF > class RPCRequestService > method Main

Description

The main method.


Parameters


bzSessionContextDSinput-outputdataset-handleThis is a handle to the context dataset which should contain information about the business component that needs to be created/updated.
ozExceptionDSoutputdataset-handleThis is a handle to the exception dataset. The exception dataset might be filled in with the messages that are coming back from the business component.
izInputDSinputdataset-handleThis is a handle to the object dataset for the specified component. It contains information for all rows that need to be created in the database. The dataset that is passed into the method should be conform to the XSD file that describes the object dataset of the component.
bzInputOutputDSinput-outputdataset-handleThis is a handle to an input-output dataset. Currently, this parameter is there just to be compliant with the SI approach. For the moment it is not used.
ozOutputDSoutputdataset-handleThis is a handle to an output dataset. Currently, this parameter is there just to be compliant with the SI approach. For the moment it is not used.


Internal usage


unused


program code (program1/rpcrequestservice.p)

/* Initialize */
empty temp-table tErrors.
empty temp-table temp_err_msg.
assign vhSessionContextDS = bzSessionContextDS.

/* Read properties and decide what needs to be done */
<M-40 run ReadMainContextProperties  (output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>
<M-46 run CheckMainContextProperties  (output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>

if viFcReturnSuper >= 0
then do:
    /* Force publish of objects */
    if vcComponentNameRPCRS = "Generic" and
       vcMethodNameRPCRS    = "ForcePublish"
    then do:
        <M-44 run ForcePublish  (output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>
    end.
    else
    /* Import XML */
    if vcMethodNameRPCRS = ""
    then do:
        <M-45 run ImportXML
           (input  izInputDS by-reference (izInputDS), 
            output ozOutputDS (ozOutputDS), 
            output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>
    end.
    else
    /* Run API method or query */
    if vcComponentNameRPCRS <> "" and
       vcMethodNameRPCRS    <> ""
    then do:
        <M-69 run RunAPI
           (input  izInputDS by-reference (izInputDS), 
            input-output bzInputOutputDS by-reference (bzInputOutputDS), 
            output ozOutputDS (ozOutputDS), 
            output viFcReturnSuper (oiReturnStatus)) in RPCRequestService>
    end.
    /* Don't know what to do */
    else do:
        create tErrors.

        assign tErrors.tcFcMessage   = trim(#T-43'Invalid parameters passed to RPCRequestService.':255(733748924)T-43#)
               tErrors.tcFcMsgNumber = "BLF-RPCRS-1"
               tErrors.tiFcSeverity  = 3
               tErrors.tcFcType      = "E"
               tErrors.tcFcContext   = trim(#T-42'This message comes from program/RPCRequestService.p.':255(5142)T-42#)
               tErrors.tcFcRowid     = string(rowid(tErrors))
               viFcReturnSuper       = -1.
    end.
end.

/* Handle errors */
if viFcReturnSuper <> 0
then do:
    assign viFcCount1 = 0.

    if can-find (first tErrors)
    then for each tErrors:
        create temp_err_msg.

        assign viFcCount1                  = viFcCount1 + 1
               temp_err_msg.tt_msg_nbr     = tErrors.tcFcMsgNumber
               temp_err_msg.tt_msg_desc    = tErrors.tcFcMessage + chr(10) + "Internal message type (" + tErrors.tcFcType + ") - severity(" + string(tErrors.tiFcSeverity) + ")"
               temp_err_msg.tt_msg_sev     = if viFcReturnSuper < 0
                                             then "3"
                                             else "2"
               temp_err_msg.tt_msg_field   = tErrors.tcFcFieldLabel + " (" + tErrors.tcFcFieldName + ")"
               temp_err_msg.tt_msg_context = tErrors.tcFcContext + " (" + tErrors.tcFcBusMethod + ") " + tErrors.tcFcExplanation
               temp_err_msg.tt_msg_data    = tErrors.tcfcfieldvalue
               temp_err_msg.tt_msg_index   = viFcCount1.
    end.
    else if viFcReturnSuper < 0
    then do:
        /* BLF-4122 make sure at least one message is returned */
        create temp_err_msg.
        assign temp_err_msg.tt_msg_desc    = "internal error " + string(viFcReturnSuper)
               temp_err_msg.tt_msg_sev     = "3"
               temp_err_msg.tt_msg_index   = 1.
    end.

    empty temp-table tErrors.
    assign ozExceptionDS = dataset dsExceptions:handle.
    return.
end.