Wednesday, January 30, 2008

Number Sequence Framework Part I


Class: NumberSequence

Purpose:
This class is used for generating the sequence from code.It takes following parameters

NumberSequenceCode : This is the sequence code defined on the defined in the numberSequence table.

_makeDecisionLater : Decides whether the number generated is saved in the NumberSequenceList Table or not.If true it is saved , if false it is deleted on ttscommit call.


Flow and methods:

NumberSequence.Num() method is used to get the number. Then the following methods are called in sequence.

NumberSequence.runNumber(): This function calls the checkSetup() Function which apply some validations . Then getNumInternal() is called.

NumberSequence .getNumInternal() : This function calls the function getNumFromList() which returns the number from NumberSequenceList table with status free if any.If no number is returned from the getNumFromList() function then it calls the getNumFromTable() function which generates the new number.This function also insert the newly created number into the numberSequenceList Table with status active.

Other functions:
NumberSequence.abort() : This function should be used when the number generated is discarded. This function set the status of number number in numberSequenceList table to free.

NumberSequence.used() : This function should be called when the number generated is used. This function deletes the generated number from the numberSequenceList table.


Table: NumberSequenceList

On the call of NubmerSeq.GetNumFromTable() function.The generated number is inserted in the NumberSequenceList table with status active.
On the call of NubmerSeq.GetNumFromList() function.The number is updated in the NumberSequenceList table with status active from free status.

On the call of ttscommit after NubmerSeq.abort() function the status of the generated number is changed to the free.NumberSeq.abort() function sets the number Sequence to abort in the application container AbortIdx[];

On the call of NubmerSeq.used() function puts the value of globaltransId in NumberSequenceList Table which is deleted on ttscommit call.