project BLF > class Database Component > 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
QadFinancials
QadFitnesse
program code (program1/database.p)
/* ================================================================= */
/* Clear events from previous call of SetPublicTables */
/* ================================================================= */
assign vcExternalControlItems = "".
if viBEventDaemonQueueID = 0
then vlEventsPublished = no.
else do:
<I-12 {bFcOpenInstance
&CLASS = "BEventDaemonQueue"}>
<M-15 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BEventDaemonQueue>
vlEventsPublished = yes.
end.
<I-1 {bFcRun
&PARAMETERS = "output viFcReturnSuper"
&PROCEDURE = "gipr_ObjectStatusUpdate"}>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-3 run UpdateLastModified (output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* ================================================================= */
/* Publish all events that have not already been published */
/* (by object status change) */
/* ================================================================= */
if vlEventPublishingActive
then do:
/* First time in additional updated vlEventPublishingNeeded = ?
* So run this query only once in every instance of a database component
*/
If vlEventPublishingNeeded = ?
Then Do:
<Q-16 assign vlFcQueryRecordsAvailable = LookupDestinations (NoCache)
(input viCompanyId, (CompanyId)
input vcFcComponentName, (BusComponentName)
input yes, (AllChanges)) in BEventConfig >
/* set the vlEventPublishingNeeded to true or false
* so next time this query read will be skipped
*/
If vlFcQueryRecordsAvailable <> False
Then Assign vlEventPublishingNeeded = True.
Else Assign vlEventPublishingNeeded = False.
End.
if vlEventPublishingNeeded = True
then do:
<M-22 run EventPublishing
(input false (ilForcePublish),
output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
end.
if vlEventsPublished
then do:
vlEventsPublished = no.
<M-37 run CreateEventFinish (output viFcReturnSuper (oiReturnStatus)) in BEventDaemonQueue>
/* ========================================================================================================= */
/* Normally we would here close BEventDaemonQueue 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 viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
/* ================================================================= */
/* If current object is active in workflow, check if an instance of */
/* BWorkObject is part of this transaction. */
/* (That is when the end-user opened and saved the workflow window.) */
/* If this is not the case, workflow update must be done here. */
/* ================================================================= */
if vlWorkFlowActive
and vcFcComponentName <> "BWorkObject":U
then do:
<M-23 run UpdateWorkobject (output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
/* ================================================================= */
/* Save translations. */
/* ================================================================= */
if vcFcComponentName <> "BTranslation"
and can-find (first tTransString)
then do:
<I-63 {bFcAddToTransaction
&CLASS = "BTranslation"}>
<M-54 run SetTranslations
(input tTransString (t_sTransString),
output viFcReturnSuper (oiReturnStatus)) in BTranslation>
/* ========================================================================================================= */
/* Normally we would here close BTranslation 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 viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
finally:
if vlEventsPublished
then. /* ========================================================================================================= */
/* Normally we would here close BEventDaemonQueue 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 */
/* ========================================================================================================= */
for each tXMLTables:
if tXMLTables.tlStatic
then delete object tXMLTables.thBuffer no-error.
else delete object tXMLTables.thTableHandle no-error.
delete tXMLTables.
end.
end finally.