project BLF > class BBusinessComponent > 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
| oiReturnStatus | output | integer | |
Internal usage
BLF
program code (program/bbusinesscomponent.p)
<ANCESTOR-CODE>
/* Create a resource for each activity */
/* No Resource-record should be created for the "ReturnToSender" activity. Requested by woa*/
empty temp-table tResourceTemp.
for each tBusComponent where
tBusComponent.tc_Status <> "D",
each tBusActivity where
tBusActivity.tc_ParentRowid = tBusComponent.tc_Rowid and
(tBusActivity.tc_Status = "N" or
tBusActivity.tc_Status = "C") and
tBusActivity.BusActivityCode <> "ReturnToSender" on error undo, throw:
create tResourceTemp.
assign tResourceTemp.BusActivity_ID = tBusActivity.BusActivity_ID
tResourceTemp.ResourceLabel = substr(tBusComponent.BusComponentLabel + " - " + tBusActivity.BusActivityLabel, 1, 60, "CHARACTER":U)
tResourceTemp.ResourceType = {&RESOURCE-TYPE-ACTIVITY}
tResourceTemp.ResourceURI = "urn:cbf:":U + tBusComponent.BusComponentCode + "." + tBusActivity.BusActivityCode
tResourceTemp.tcBusActivityCode = ?
tResourceTemp.tcBusComponentCode = ?
tResourceTemp.tc_Rowid = tBusActivity.tc_Rowid
tResourceTemp.tc_Status = tBusActivity.tc_Status.
end.
/* =============================================================== */
/* When deleting a business activity, also delete the related */
/* resource and related SOD 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. */
/* =============================================================== */
for each tBusComponent where
tBusComponent.tc_Status = "D",
each tBusActivity where
tBusActivity.tc_ParentRowid = tBusComponent.tc_Rowid and
tBusActivity.BusActivityCode <> "ReturnToSender" on error undo, throw:
create tResourceTemp.
assign tResourceTemp.BusActivity_ID = tBusActivity.BusActivity_ID
tResourceTemp.ResourceURI = "urn:cbf:":U + tBusComponent.BusComponentCode + "." + tBusActivity.BusActivityCode
tResourceTemp.tc_Rowid = tBusActivity.tc_Rowid
tResourceTemp.tc_Status = "D".
end.
for each tBusComponent where
tBusComponent.tc_Status <> "D",
each tBusActivity where
tBusActivity.tc_ParentRowid = tBusComponent.tc_Rowid and
tBusActivity.tc_Status = "D" and
tBusActivity.BusActivityCode <> "ReturnToSender" on error undo, throw:
create tResourceTemp.
assign tResourceTemp.BusActivity_ID = tBusActivity.BusActivity_ID
tResourceTemp.ResourceURI = "urn:cbf:":U + tBusComponent.BusComponentCode + "." + tBusActivity.BusActivityCode
tResourceTemp.tc_Rowid = tBusActivity.tc_Rowid
tResourceTemp.tc_Status = "D".
end.
if can-find(first tResourceTemp)
then do:
<I-9 {bFcAddToTransaction
&CLASS = "BResource"}>
<M-7 run CreateResource
(input tResourceTemp (tResourcesInput),
output vcResourceIds (ocResourceIds),
output viLocalReturnStatus (oiReturnStatus)) in BResource>
/* ========================================================================================================= */
/* Normally we would here close BResource but we will not do it for performance */
/* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it. */
/* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the */
/* appserver that is executed after each call to the appserver */
/* ========================================================================================================= */
if viLocalReturnStatus < 0
then do:
assign oiReturnStatus = viLocalReturnStatus.
<M-8 run StopExternalInstances (output viFcReturnSuper (oiReturnStatus)) in BBusinessComponent>
return.
end.
end.