Resetting Processes |
![]() ![]() ![]() |
The reset attribute of the call definition elements plays an important role in case of nested definitions are made. Its value can be "true", or "." characters pointing to an outer process that the resetting of the current process is bound to. When the value of the reset attribute is "true" or "." then the process is reset by each cycle. If the value of the attribute contains more than one "." characters then the resetting of the process in not performed by each cycle of it; rather its is performed by each cycle of the process pointed to. The methods of the Processes A process class has prepare(), processRecord() and finalizeProcess() methods. Before starting to call processRecord() method of a process class for each record, the Process Manager calls its prepare() method to let the process get ready for the successive processRecord() method calls. After all the records are processed, this time the Process Manager calls its finalizeProcess() method. It may be necessary to call prepare() and finalizeProcess() methods of certain type of processes for each cycle of a query process or a process template. See the example below.
The WriteOrdersToTextFile process in the example opens an output file in the prepare() method, appends the records in the processRecord() method and closes the output file in the finalizeProcess() method. For such a process it is very important when the finalizeProcess() method is called. This can be managed by defining the reset attribute carefully. The definition in the example means that the resetting of the process is bound to the cycle of the GetCustomerOrders process. When GetCustomerOrders finishes processing of each record provided by it parent process GetCustomers, the finalizeProcess() method of the WriteOrdersToTextFile process is called and the process is reset which means by the next cycle, its prepare() method will be called again and another output file will be opened. If no reset attribute was defined then the WriteOrdersToTextFile process would write all the orders to a single file since its finalizeProcess() method would not be called until the finalization of the root process template. |