From c5e5b73407631bae1e6aa8e95e7429c853a2c6d1 Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Mon, 2 Feb 2009 22:02:36 +0000 Subject: [PATCH] BATCH-1055: added section on filtering --- .../docbook/reference/readersAndWriters.xml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/src/site/docbook/reference/readersAndWriters.xml b/docs/src/site/docbook/reference/readersAndWriters.xml index b6e0184a2..10b8f90e9 100644 --- a/docs/src/site/docbook/reference/readersAndWriters.xml +++ b/docs/src/site/docbook/reference/readersAndWriters.xml @@ -286,6 +286,32 @@ + +
+ Filtering Records + + One typical use for an item processor is to filter out records + before they are passed to the ItemWriter. Filtering is an action + distinct from skpping; skipping indicates that a record is invalid + whereas filtering simply indicates that a record should not be written. + + + For example, consider a batch job that reads a file containing + three different types of records: records to insert, records to update, + and records to delete. If record deletion is not supported by the + system, then we would not want to send any "delete" records to the + ItemWriter. But, since these records are not + actually bad records, we would want to filter them out, rather than + skip. As a result, the ItemWriter would receive only "insert" and + "update" records. + + To filter a record, one simply returns "null" from the + ItemProcessor. The framework will detect that the + result is "null" and avoid adding that item to the list of records + delivered to the ItemWriter. As usual, an + exception thrown from the ItemProcessor will + result in a skip. +