project QadFinancials > class BSystem > method ApiSynchroniseCustom

Description

ApiSynchroniseScba; this non-api method will do the synchronisation (=upload of some fixed data) for project Scba and is called from method ApiSynchronise.

Note1; that all mentioned components in icComponents will be handled in a separate transaction.
Note2. all entries in ocUpdatedComponents are default set on false (except for the components that were already handled by ApiSunchronise).
Note3; when you add functionality for a new component then please do also update method stopexternal instances.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BSystem.ApiSynchronise


program code (program/bsystem.p)

<ANCESTOR-CODE>
        
/* ======================== */
/* Start SCBASYNCHROBLOCK   */
/* ======================== */
SCBASYNCHROBLOCK : DO :
    
    /* =================== */
    /* WHEN DAEMONS        */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 8 and /* Daemons */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        assign vlDaemonsUpdated = no.
        
        /* Cross Company Posting Daemon */
        <I-1 {bFcStartAndOpenInstance
             &CLASS                = "BCrossCyDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BCrossCyDaemon.ApiSynchronise Start":U skip.
        output close.
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BCrossCyDaemon':U, output viFcReturnSuper).
           
        <M-3 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                         output viSynchroniseError (oiReturnStatus)) in BCrossCyDaemon>
                        
        <I-4 {bFcCloseAndStopInstance
             &CLASS           = "BCrossCyDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BCrossCyDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone) skip.
        output close.
                               
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.

        /* Balance Daemon */
        <I-5 {bFcStartAndOpenInstance
             &CLASS                = "BBalanceDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BBalanceDaemon.ApiSynchronise Start":U skip.
        output close.        
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BBalanceDaemon':U, output viFcReturnSuper).
        
        <M-7 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BBalanceDaemon>

        <I-8 {bFcCloseAndStopInstance
             &CLASS           = "BBalanceDaemon"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BBalanceDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone) skip.
        output close.
                            
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.
        
        /* Budget Daemon */
        <I-11 {bFcStartAndOpenInstance
             &CLASS                = "BBudgetDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BBudgetDaemon.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BBudgetDaemon':U, output viFcReturnSuper).
                
        <M-13 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BBudgetDaemon>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BBudgetDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone) skip.
        output close.
                              
        <I-14 {bFcCloseAndStopInstance
             &CLASS           = "BBudgetDaemon"}>

        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.

        /* History Daemon */
        <I-15 {bFcStartAndOpenInstance
             &CLASS                = "BHistoryDaemon"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BHistoryDaemon.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BHistoryDaemon':U, output viFcReturnSuper).
        
        <M-17 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BHistoryDaemon>

        <I-18 {bFcCloseAndStopInstance
             &CLASS           = "BHistoryDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BHistoryDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.
        
        /* Cube Daemon */
        <I-36 {bFcStartAndOpenInstance
             &CLASS                = "BCubeDaemon"}>
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BCubeDaemon.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BCubeDaemon':U, output viFcReturnSuper).
        
        <M-63 run ApiSynchronise
           (output vlUpdatesDone (olUpdatesDone), 
            output viSynchroniseError (oiReturnStatus)) in BCubeDaemon>

        <I-892 {bFcCloseAndStopInstance
             &CLASS           = "BCubeDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BCubeDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.
        
        /* Replication Daemon */
        <I-75 {bFcStartAndOpenInstance
             &CLASS                = "BReplicaDaemon"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BReplicaDaemon.ApiSynchronise Start":U skip.
        output close.         
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BReplicaDaemon':U, output viFcReturnSuper).
        
        <M-77 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BReplicaDaemon>

        <I-78 {bFcCloseAndStopInstance
             &CLASS           = "BReplicaDaemon"}>                          
                                        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BReplicaDaemon.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.

        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError
                    vlDaemonsUpdated = ?.
        else
        if vlUpdatesDone = yes and vlDaemonsUpdated = no then assign vlDaemonsUpdated = true.

        /* State result */
        if vlDaemonsUpdated = ?
        then assign tTopic.tcUpdateInformation = #T-88'Update Failed':30(2976562)T-88#.
        else if vlDaemonsUpdated = yes
        then assign tTopic.tcUpdateInformation = trim(#T-74'Updates Done':30(3760)T-74#).
        else assign tTopic.tcUpdateInformation = #T-73'No Updates Required':30(62653)T-73#.
        
    end. /* if available tTopic 8 */

    /* =================== */
    /* WHEN GLTYPE         */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 101 and /* GLTYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-19 {bFcStartAndOpenInstance
             &CLASS                = "BGLType"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BGLType.ApiSynchronise Start":U skip.
        output close.  
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BGLType':U, output viFcReturnSuper).
                
        <M-21 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
             output viSynchroniseError (oiReturnStatus)) in BGLType>
        
        <I-22 {bFcCloseAndStopInstance
             &CLASS           = "BGLType"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BGLType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
           
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-69'Update Failed':30(2976562)T-69#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-25'Updates Done':30(3760)T-25#).
        else assign tTopic.tcUpdateInformation = trim(#T-26'No Updates Required':30(3761)T-26#).
    end. /* if available tTopic 10 */
    
    /* =================== */
    /* WHEN JOURNALTYPE    */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 102 and /* JOURNALTYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-27 {bFcStartAndOpenInstance
             &CLASS                = "BJournalType"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BJournalType.ApiSynchronise Start":U skip.
        output close.  
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BJournalType':U, output viFcReturnSuper).
                
        <M-29 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                     output viSynchroniseError (oiReturnStatus)) in BJournalType>
                     
        <I-30 {bFcCloseAndStopInstance
             &CLASS           = "BJournalType"}>
                   
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BJournalType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone) skip.
        output close.
                   
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-85'Update Failed':30(2976562)T-85#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-43'Updates Done':30(3760)T-43#).
        else assign tTopic.tcUpdateInformation = trim(#T-44'No Updates Required':30(3761)T-44#).
   end. /* if available tTopic 20 */
   
    /* =================== */
    /* WHEN PROFILETYPE    */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 103 and /* PROFILETYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-31 {bFcStartAndOpenInstance
             &CLASS                = "BProfileType"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BProfileType.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BProfileType':U, output viFcReturnSuper).
                
        <M-33 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BProfileType>
                      
        <I-34 {bFcCloseAndStopInstance
             &CLASS           = "BProfileType"}>
                    
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BProfileType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-62'Update Failed':30(2976562)T-62#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-45'Updates Done':30(3760)T-45#).
        else assign tTopic.tcUpdateInformation = trim(#T-46'No Updates Required':30(3761)T-46#).
    end. /* if available tTopic 30 */ 
    
    /* ===================== */
    /* WHEN EXCHANGERATETYPE */
    /* ===================== */
    find tTopic where 
         tTopic.tiTopicNumber = 104 and /* EXCHANGERATETYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-35 {bFcStartAndOpenInstance
             &CLASS                = "BExchangeRateType"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BExchangeRateType.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BExchangeRateType':U, output viFcReturnSuper).
                
        <M-37 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BExchangeRateType>
        
        <I-38 {bFcCloseAndStopInstance
             &CLASS           = "BExchangeRateType"}>
                    
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BExchangeRateType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-270'Update Failed':30(2976562)T-270#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-47'Updates Done':30(3760)T-47#).
        else assign tTopic.tcUpdateInformation = trim(#T-48'No Updates Required':30(3761)T-48#).
   end. /* if available tTopic 40 */
   
   /* =================== */
    /* WHEN PaymentFormatTYPE         */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 105 and /* PaymentFormatTYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-39 {bFcStartAndOpenInstance
             &CLASS                = "BPaymentFormat"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BPaymentFormat.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BPaymentFormat':U, output viFcReturnSuper).
                
        <M-41 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
               output viSynchroniseError (oiReturnStatus)) in BPaymentFormat>
        
        <I-42 {bFcCloseAndStopInstance
             &CLASS           = "BPaymentFormat"}>
                    
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BPaymentFormat.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-80'Update Failed':30(2976562)T-80#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-49'Updates Done':30(3760)T-49#).
        else assign tTopic.tcUpdateInformation = trim(#T-50'No Updates Required':30(3761)T-50#).
    end. /* if available tTopic 50 */
    
    /* =================== */
    /* WHEN AddressTYPE    */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 106 and /* AddressTYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-51 {bFcStartAndOpenInstance
             &CLASS                = "BAddressType"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BAddressType.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BAddressType':U, output viFcReturnSuper).
                
        <M-53 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BAddressType>
        
        <I-54 {bFcCloseAndStopInstance
             &CLASS           = "BAddressType"}>

        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BAddressType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-94'Update Failed':30(2976562)T-94#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-64'Updates Done':30(3760)T-64#).
        else assign tTopic.tcUpdateInformation = trim(#T-65'No Updates Required':30(3761)T-65#).
    end. /* if available tTopic 60 */
    
    /* =================== */
    /* WHEN GLSYSTEMTYPE   */
    /* =================== */
    find tTopic where 
         tTopic.tiTopicNumber = 107 and /* GLSYSTEMTYPE */
         tTopic.tlSelected    = true
         no-error.
    if available tTopic and
      (vcSynchronizeType = {&SYNCHRONIZETYPE-FULL} or
       tTopic.tcSynchronizeType = vcSynchronizeType)
    then do :
        <I-55 {bFcStartAndOpenInstance
             &CLASS                = "BGLSystemType"}>
        
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BGLSystemType.ApiSynchronise Start":U skip.
        output close. 
        
        /*  Set indication in the logging.  */
        publish "Logging.LogSetIndication" (input 'BGLSystemType':U, output viFcReturnSuper).
                
        <M-57 run ApiSynchronise (output vlUpdatesDone (olUpdatesDone), 
                      output viSynchroniseError (oiReturnStatus)) in BGLSystemType>
        
        <I-58 {bFcCloseAndStopInstance
             &CLASS           = "BGLSystemType"}>
                    
        output to value (vcSynchroniseLogFile) append.
        put unformatted string (now) '> ':U
            "BGLSystemType.ApiSynchronise End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
        output close.
                    
        if viSynchroniseError < 0
        or (oiReturnStatus = 0 and viSynchroniseError > 0)
        then assign oiReturnStatus = viSynchroniseError.

        if viSynchroniseError < 0
        then assign tTopic.tcUpdateInformation = #T-90'Update Failed':30(2976562)T-90#.
        else
        if vlUpdatesDone 
        then assign tTopic.tcUpdateInformation = trim(#T-66'Updates Done':30(3760)T-66#).
        else assign tTopic.tcUpdateInformation = trim(#T-67'No Updates Required':30(3761)T-67#).
    end. /* if available tTopic 70 */
    
END. /* SCBASYNCHROBLOCK */

/* ============== */
/* Call submethod */
/* ============== */
    output to value (vcSynchroniseLogFile) append.
    put unformatted string (now) '> ':U
        "BSystem.ApiSynchroniseCustom2 Start":U skip.
    output close. 
    
    <M-79 run ApiSynchroniseCustom2  (output viSynchroniseError (oiReturnStatus)) in BSystem>
    
    output to value (vcSynchroniseLogFile) append.
    put unformatted string (now) '> ':U
        "BSystem.ApiSynchroniseCustom2 End : ":U string (viSynchroniseError) ' ':U string (vlUpdatesDone)  skip.
    output close.

    if viSynchroniseError < 0
    or (oiReturnStatus = 0 and viSynchroniseError > 0)
    then assign oiReturnStatus = viSynchroniseError.