project BLF > class RPCRequestService > method ReadMainContextProperties

Description

This method reads the main context properties into class data items so the program can decide what needs to be done.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method RPCRequestService.Main


program code (program1/rpcrequestservice.p)

/* componentName: this is the short name of the component that needs to be executed */
assign vcComponentNameRPCRS = <M-17 GetContextProperty
                                 (input  '' (icPropertyQualifier), 
                                  input  'componentName' (icPropertyName)) in RPCRequestService>.

if vcComponentNameRPCRS = "" or
   vcComponentNameRPCRS = ?
then assign vcComponentNameRPCRS = <M-30 GetContextProperty
                                      (input  '' (icPropertyQualifier), 
                                       input  'programName' (icPropertyName)) in RPCRequestService>.

/* methodName: this is the method that needs to be executed */
assign vcMethodNameRPCRS = <M-18 GetContextProperty
                              (input  '' (icPropertyQualifier), 
                               input  'methodName' (icPropertyName)) in RPCRequestService>.

/* sessionId: this is the id of an existing global session, if it already would have been instantiated by the caller.  
   If this is passed, it should be validated (the same way as the global session id is validated when it is 
   passed into an API method).  If the sessionId is passed, and is validated, 
   the values in the next 3 properties (domain, username and password) are disregarded because all information 
   can be taken from the global session. */
assign vcSessionIdRPCRS = <M-31 GetContextProperty
                             (input  '' (icPropertyQualifier), 
                              input  'sessionId' (icPropertyName)) in RPCRequestService>.
assign vcBLFSessionId   = <M-43 GetContextProperty
                             (input  '' (icPropertyQualifier), 
                              input  'BLFsessionId' (icPropertyName)) in RPCRequestService>.
viBLFSessionIdRPCRS = 0.
viBLFSessionIdRPCRS = integer(vcBLFSessionId) no-error.

/* username: this is the login of the user that is used for the authentication and the application login into the application itself. */
assign vcUserNameRPCRS = <M-32 GetContextProperty
                            (input  '' (icPropertyQualifier), 
                             input  'username' (icPropertyName)) in RPCRequestService>.

/* passwordIsEncoded: this indicates if the password is encoded (base64), default false. */
assign vcPasswordIsEncoded = <M-33 GetContextProperty
                                (input  '' (icPropertyQualifier), 
                                 input  'passwordIsEncoded' (icPropertyName)) in RPCRequestService>
       vlPasswordIsEncodedRPCRS = can-do("true,yes", vcPasswordIsEncoded).

/* password: this is the password of the above user. If the password is encoded, we will decode it using base64-decode(). */
assign vcPasswordRPCRS = <M-34 GetContextProperty
                            (input  '' (icPropertyQualifier), 
                             input  'password' (icPropertyName)) in RPCRequestService>.

/* entity: this is the entity code of the entity in which the business component data needs to be created. 
   The system should validate that the entity belongs to the domain specified above, or retrieved based on 
   the sessionId (global session ID). */
assign vcEntityRPCRS = <M-35 GetContextProperty
                          (input  '' (icPropertyQualifier), 
                           input  'entity' (icPropertyName)) in RPCRequestService>.

/* applicationId: this is unique identification of the application that receives the request for processing the data.  
   For example ?Amsterdam.Financials?.  It identifies the installed system.  
   It should be checked before processing the data. 
   For this we will add a field (SystApplicationId) to the system table so we can do the check 
   (comparing the applicationId context field to the Syst.SystApplicationId field).*/
assign vcApplicationIdRPCRS = <M-36 GetContextProperty
                                 (input  '' (icPropertyQualifier), 
                                  input  'applicationId' (icPropertyName)) in RPCRequestService>.

/* shutdownSession: indicates wether or not the session needs to be shut down when done processing. */
assign vcShutdownSession = <M-45 GetContextProperty
                              (input  '' (icPropertyQualifier), 
                               input  'shutdownSession' (icPropertyName)) in RPCRequestService>
       vlShutdownSessionRPCRS = can-do("true,yes", vcShutdownSession).
       
/* debugLevel: allows enabling of CT log */
vcDebugLevel = <M-51 GetContextProperty
                  (input  '' (icPropertyQualifier), 
                   input  'debugLevel' (icPropertyName)) in RPCRequestService>.

if vcDebugLevel = ""
or vcDebugLevel = ?
then do:
    vcQxtendConfig = search ("QXTEND.config").

    if vcQxtendConfig = ?
    then do:
        /* Make the config file on the same place as the server.xml */
        file-info:file-name = search("server.xml").
        output to value (replace(file-info:full-pathname,"server.xml","QXTEND.config")).
        put unformatted 
            "#Specify DebugLevel: 0=no logging, 6=standard logging, 31=extended logging" skip
            "DebugLevel=0":U skip(1).
        output close.
    end.
    else do:
        input from value(vcQxtendConfig).
        repeat:
            import unformatted vcQxtendConfig.
            if vcQxtendConfig begins "DebugLevel="
            then assign vcDebugLevel = entry (2,vcQxtendConfig,"=").
        end.
        input close.
    end.
end.

viDebugLevelRPCRS = int(vcDebugLevel) no-error.
if error-status:error
then assign viDebugLevelRPCRS = 0.