project BLF > class Business Component > method ReadSessionValues

Description

Read some comonly used values from session like current user login or current company ID and store these values in variables available to all business classes.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method business.InitInstance
method BBaseDaemonProcessor.SwitchSessionCy


program code (program1/business.p)

assign vhFcComponent = vhCacher
        vcNameList   = "ValidLogin,l,UserName,c,UsrID,i,CompanyId,i,CompanyCode,c,"
                     + vcFcComponentName + "FieldSecurityActive,l,"
                     + {&SETTINGCONFIG-ENABLEPERSISTENTCACHE} + ",l,"
                     + "UICustomizationActive,l,CPO,c,vcDateFormat,c,vcNumericFormat,c,UserLogin,c,LocalisationCode,c,"
                     + "GlobalSessionId,c,MaxInstancesInTransaction,i,vlTranslationTracing,l,SessionDebugLevel,i,TimeOffset,i,"
                     + "UseTranslations,l".

<M-30 run GetValuesFromSession
   (input  viSessionID (iiSessionId), 
    input  vcNameList (icNameList), 
    output vcValueList (ocValueList), 
    output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

if entry(1,vcValueList,chr(2)) <> "TRUE"
then do:
    <M-14 run SetMessage
          (input  #T-1'You are not logged on to the system.':100(415)T-1# (icMessage), 
           input  '' (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'D':U (icType), 
           input  1 (iiSeverity), 
           input  '' (icRowid), 
           input  'BLF-264':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in business>
    assign oiReturnStatus = -5.
    return.
end.

assign vcUserName                    = entry(2,vcValueList,chr(2))
       viUsrID                       = integer(entry(3,vcValueList,chr(2)))
       viCompanyId                   = integer(entry(4,vcValueList,chr(2)))
       vcCompanyCode                 = entry(5,vcValueList,chr(2))
       vlFieldSecurityActiveOnBC     = (entry(6,vcValueList,chr(2)) = "TRUE")
       vlEnablePersistentCache       = (entry(7,vcValueList,chr(2)) = "TRUE")
       vlUICustomizationActive       = (entry(8,vcValueList,chr(2)) = "TRUE")
       vcClientPrincipalObject        = entry(9,vcValueList,chr(2))
       vcFcDateFormat                 = entry(10,vcValueList,chr(2))
       vcFcNumericFormat              = entry(11,vcValueList,chr(2))
       vcUserLogin                    = entry(12,vcValueList,chr(2))
       vcLocalisationCode             = entry(13,vcValueList,chr(2))
       vcGlobalSessionId              = entry(14,vcValueList,chr(2))
       viFcMaxInstancesInTransaction  = integer(entry(15,vcValueList,chr(2)))
       vlTranslationTracing           = (entry(16,vcValueList,chr(2)) = "TRUE")
       viSessionDebugLevel            = integer(entry(17,vcValueList,chr(2)))
       viTimeOffset                   = integer(entry(18,vcValueList,chr(2)))
       vlObjectTranslationsActive     = entry(19, vcValueList, chr(2)) = "TRUE".

session:timezone = viTimeOffset.

if viSessionDebugLevel = ?
then viSessionDebugLevel = 0.

/*
<M-17 run RegisterClientPrincipalInPool
   (input  'showusage' (icObjectKey), 
    output viFcReturnSuper (oiReturnStatus)) in ComponentPool>
*/
run RegisterClientPrincipalInPool (input vcClientPrincipalObject, output viFcReturnSuper).
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.