project BLF > class BSystem > method SynchroniseNavig

Description

synchronise navigation data :
component categories
business area's
business components
business activities


Parameters


olUpdatesDoneoutputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BSystem.ApiSynchronise2


program code (program9/bsystem.p)

empty temp-table tBusinessTranslation.
assign vcPreviousSystemLanguage = current-language.

/* ======================================================= */
/* Run naviginfo that return areas, classes and activities */
/* in all installed languages                              */
/* ======================================================= */
<Q-21 run LanguageByCodeID (all) (Read) (NoCache)
   (input '', (LngCode)
    input 0, (LngID)
    input yes, (Installed)
    output dataset tqLanguageByCodeID) in BLanguage >

/* language 'US' must always be loaded */
if not can-find (first tqLanguageByCodeID where
                       tqLanguageByCodeID.tcLngCode = "us":U)
then do:
    create tqLanguageByCodeID.
    assign tqLanguageByCodeID.tcLngCode = "us":U.
end.

for each tqLanguageByCodeID on error undo, throw:

    assign current-language = tqLanguageByCodeID.tcLngCode.
   
    empty temp-table tSyncBusinessComponent.
    empty temp-table tSyncBusinessActivity.
    run appinfo/naviginfo.p (input vhFcSuper,
                             input table tSyncBusinessComponent by-reference,
                             input table tSyncBusinessActivity by-reference).

    for each tSyncBusinessComponent on error undo, throw:
        create tBusinessTranslation.
        assign tBusinessTranslation.tcRelatedObject   = "B:":U + tSyncBusinessComponent.tcName
               tBusinessTranslation.tcLngCode         = tqLanguageByCodeID.tcLngCode
               tBusinessTranslation.tcTranslationText = tSyncBusinessComponent.tcLabel.
    end.
    for each tSyncBusinessActivity on error undo, throw:
        create tBusinessTranslation.
        assign tBusinessTranslation.tcRelatedObject   = "D:":U + tSyncBusinessActivity.tcClassName
                                                       + ".":U + tSyncBusinessActivity.tcName
               tBusinessTranslation.tcLngCode         = tqLanguageByCodeID.tcLngCode
               tBusinessTranslation.tcTranslationText = tSyncBusinessActivity.tcLabel.
    end.
end.

/* ================================================================= */
/* Now run naviginfo without language code to get untranslated labels*/
/* ================================================================= */
assign current-language = "?":U.

empty temp-table tSyncBusinessComponent.
empty temp-table tSyncBusinessActivity.
run appinfo/naviginfo.p (input vhFcSuper,
                         input table tSyncBusinessComponent by-reference,
                         input table tSyncBusinessActivity by-reference).

/* ================== */
/* Reset the language */
/* ================== */
assign current-language = vcPreviousSystemLanguage.

/* =================================================== */                                                       
/* Handle the business-components and their activities */
/* =================================================== */
<I-7 {bFcStartAndOpenInstance
     &CLASS                = "BBusinessComponent"}>
        
<M-9 run ApiSynchronise (input  tSyncBusinessComponent (tBusinessComponentsBC), 
                         input  tSyncBusinessActivity (tBusinessActivitiesBC), 
                         input  tBusinessTranslation (tBusinessComponentLabel), 
                         output vlUpdatesDone (olUpdatesDone), 
                         output viLocalReturn (oiReturnStatus)) in BBusinessComponent>

<I-10 {bFcCloseAndStopInstance
     &CLASS           = "BBusinessComponent"}>
if vlUpdatesDone
then olUpdatesDone = yes.
if viLocalReturn <> 0
then oiReturnStatus = viLocalReturn.
if viLocalReturn < 0
then return.


finally:

    /* clean-up */
    empty temp-table tSyncBusinessComponent.
    empty temp-table tSyncBusinessActivity.
    empty temp-table tBusinessTranslation.
    assign current-language = vcPreviousSystemLanguage.

end finally.