project BLF > class BRole > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


BLF
method BRole.ApiSynchronise
method BRole.CreateRolResource
method BRole.SaveRolePermissionsData
method BRole.ApiMaintainRolesForModuleURI

QadFinancials
method BRole.AddGenCodeGroupToRoles
method BRole.ApiCreateCIApproveRole


program code (program/brole.p)

<ANCESTOR-CODE>

/* ================================================================= */
/* When deleting a role or a resource in a role also delete all      */
/* related violations. This cannot be done with a cascaded delete in */
/* the data model as this delete must also trigger a create in the   */
/* SODLog table.                                                     */
/* ================================================================= */
<Q-8 assign vlFcQueryRecordsAvailable = SystSODActive (NoCache)  () in BSystem >
if vlFcQueryRecordsAvailable
then do:
    for each tRole where
             tRole.tc_Status = "D" or
            (tRole.tc_Status = "C" and
             tRole.RoleSODException = yes and
             can-find (first t_iRole where
                             t_iRole.tc_Rowid = tRole.tc_Rowid and
                             t_iRole.RoleSODException = no)):

        if viBSODViolationRule17ID = 0
        then do:
            <I-1 {bFcAddToTransaction
                 &CLASS           = "BSODViolationRule1"}>
        end.
        <M-2 run DeleteByRoleResource
           (input  tRole.Role_ID (iiRoleID), 
            input  0 (iiResourceID), 
            output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule1>
        if viFcReturnSuper = -4
        then viFcReturnSuper = 0.
        else vlDeletes1Done = yes.
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.

        if viBSODViolationRule28ID = 0
        then do:
            <I-12 {bFcAddToTransaction
                 &CLASS           = "BSODViolationRule2"}>
        end.
        <M-22 run DeleteByUserRoleCompanyCategory
           (input  0 (iiUsrID), 
            input  tRole.Role_ID (iiRoleID), 
            input  0 (iiDomainID), 
            input  0 (iiCompanyID), 
            input  0 (iiSODCategory1ID), 
            input  0 (iiSODCategory2ID), 
            output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule2>
        if viFcReturnSuper = -4
        then viFcReturnSuper = 0.
        else vlDeletes2Done = yes.
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
    end.
    
    for each tRole where tRole.tc_Status <> "D",
        each tRoleResource where
             tRoleResource.tc_ParentRowid = tRole.tc_Rowid and
             tRoleResource.tc_Status = "D":

        if viBSODViolationRule17ID = 0
        then do:
            <I-4 {bFcAddToTransaction
                 &CLASS           = "BSODViolationRule1"}>
        end.
        <M-5 run DeleteByRoleResource
           (input  tRole.Role_ID (iiRoleID), 
            input  tRoleResource.Resource_ID (iiResourceID), 
            output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule1>
        if viFcReturnSuper = -4
        then viFcReturnSuper = 0.
        else vlDeletes1Done = yes.
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.

        if viBSODViolationRule28ID = 0
        then do:
            <I-15 {bFcAddToTransaction
                 &CLASS           = "BSODViolationRule2"}>
        end.
        <M-16 run DeleteByRoleResource
           (input  tRole.Role_ID (iiRoleID), 
            input  tRoleResource.Resource_ID (iiResourceID), 
            output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule2>
        if viFcReturnSuper = -4
        then viFcReturnSuper = 0.
        else vlDeletes2Done = yes.
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
    end.
    
    if viBSODViolationRule17ID <> 0
    then if vlDeletes1Done
    then do:
        <M-10 run DeleteFinish  (output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule1>
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
        <I-7 {bFcCloseInstance
             &CLASS           = "BSODViolationRule1"}>
    end.
    else do:
        <I-9 {bFcCloseAndStopInstance
             &CLASS           = "BSODViolationRule1"}>
    end.
    
    if viBSODViolationRule28ID <> 0
    then if vlDeletes2Done
    then do:
        <M-19 run DeleteFinish  (output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule2>
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
        <I-21 {bFcCloseInstance
             &CLASS           = "BSODViolationRule2"}>
    end.
    else do:
        <I-18 {bFcCloseAndStopInstance
             &CLASS           = "BSODViolationRule2"}>
    end.
end.

finally:
    if oiReturnStatus < 0
    then do:
        <M-97 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BRole>
    end.
end finally.