Events Architecture
Some time you need to ignore certain lines in files or you need to change a value after the record is filled, etc.
To solve these problems I´ve add a event architecture in the FileHelperEngine (in the future in all the others)
The events are 4 (2 for read and 2 for write ops):
- BeforeReadRecord
- AfterReadRecord
- BeforeWriteRecord
- AfterWriteRecord
The names said all right ?
The Example
Supose that you need to parse a txt report from a legacy system with these format
You must declare a Record Mapping Class for the main record:
So now is the time where we instanciate the engine and hook to the events.
So in the event method we ignore the lines with spaces and -
Note: if you change the RecordLine the engine use the changed value This can be useful in some cases but you must be carefull
|
See also
Must Read - Quick Start Guide - Attributes
List - F.A.Q. - Examples of
Use - Contacts & Credits - Donations