project QadFinancials > class BDaemonFunctions > method GetDaemonStatus


Parameters


icDaemonStatusinputcharacter
icActivityCodeinputcharacter
ocDaemonNamesoutputcharacter
ocDaemonLabelsoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDaemonFunctions.GetDaemonsToStart
method BDaemonFunctions.GetDaemonsToStop


program code (program1/bdaemonfunctions.p)

/* ================================================================= */
/* Lookup daemons with status inactive (skip reportdaemon)           */
/* ================================================================= */
<Q-77 run DaemonInfoLimited (all) (Read) (NoCache)
   (input 0, (DaemonId)
    input '', (DaemonName)
    input icDaemonStatus, (DaemonStatus)
    input '', (DaemonStatusDiffersFrom)
    output dataset tqDaemonInfoLimited) in BBaseDaemon>

for each tqDaemonInfoLimited where
         tqDaemonInfoLimited.tcDaemonName <> {&REPORTDAEMON} and
         tqDaemonInfoLimited.tiDaemonMaxNumberOfInstances > 0
         on error undo, throw:
    
    case tqDaemonInfoLimited.tcDaemonName:
        when {&BALANCEDAEMON}
        then assign vcFcComponentName = "BBalanceDaemon"
                    vcDaemonLabel     = {&BALANCEDAEMON-TR}.
        when {&BUDGETDAEMON}
        then assign vcFcComponentName = "BBudgetDaemon"
                    vcDaemonLabel     = {&BUDGETDAEMON-TR}.
        when {&CROSSCOMPANYDAEMON}
        then assign vcFcComponentName = "BCrossCyDaemon"
                    vcDaemonLabel     = {&CROSSCOMPANYDAEMON-TR}.
        when {&CUBEDAEMON}
        then assign vcFcComponentName = "BCubeDaemon"
                    vcDaemonLabel     = {&CUBEDAEMON-TR}.
        when {&EVENTDAEMON}
        then assign vcFcComponentName = "BEventDaemon"
                    vcDaemonLabel     = {&EVENTDAEMON-TR}.
        when {&HISTORYDAEMON}
        then assign vcFcComponentName = "BHistoryDaemon"
                    vcDaemonLabel     = {&HISTORYDAEMON-TR}.
        when {&REPLICATIONDAEMON}
        then assign vcFcComponentName = "BReplicaDaemon"
                    vcDaemonLabel     = {&REPLICATIONDAEMON-TR}.
        when {&SCANDAEMON}
        then assign vcFcComponentName = "BScanDaemon"
                    vcDaemonLabel     = {&SCANDAEMON-TR}.
        when {&TIMEOUTDAEMON}
        then assign vcFcComponentName = "BTimeOutDaemon"
                    vcDaemonLabel     = {&TIMEOUTDAEMON-TR}.
        when {&XMLDAEMON}
        then assign vcFcComponentName = "BXmlDaemon"
                    vcDaemonLabel     = {&XMLDAEMON-TR}.
    end case.

    /* ================================================================= */
    /* Check authorisation                                               */
    /* ================================================================= */
    <M-12 run apiActivityIsAllowed
       (input  '' (icUsrLogin), 
        input  '' (icCompanyCode), 
        input  icActivityCode (icActivityCode), 
        output vlFcOk (olIsAllowed), 
        output viFcReturnSuper (oiReturnStatus)) in BDaemonFunctions>
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.
    
    if vlFcOk
    then if ocDaemonNames  = ""
         then assign ocDaemonNames  = tqDaemonInfoLimited.tcDaemonName
                     ocDaemonLabels = vcDaemonLabel.
         else assign ocDaemonNames  = ocDaemonNames + "," + tqDaemonInfoLimited.tcDaemonName
                     ocDaemonLabels = ocDaemonLabels + "," + vcDaemonLabel.
end.

finally:
    vcFcComponentName = "BDaemonFunctions".
end finally.