class StagingItemProcessor<T> implements ItemProcessor<ProcessIndicatorItemWrapper<T>, T>, InitializingBean {

	private JdbcOperations jdbcTemplate;

	public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	@Override
	public void afterPropertiesSet() throws Exception {<FILL_FUNCTION_BODY>}

	/**
	 * Use the technical identifier to mark the input row as processed and return
	 * unwrapped item.
	 */
	@Nullable
	@Override
	public T process(ProcessIndicatorItemWrapper<T> wrapper) throws Exception {

		int count = jdbcTemplate.update("UPDATE BATCH_STAGING SET PROCESSED=? WHERE ID=? AND PROCESSED=?",
				StagingItemWriter.DONE, wrapper.getId(), StagingItemWriter.NEW);
		if (count != 1) {
			throw new OptimisticLockingFailureException("The staging record with ID=" + wrapper.getId()
					+ " was updated concurrently when trying to mark as complete (updated " + count + " records.");
		}
		return wrapper.getItem();
	}

}

		Assert.state(jdbcTemplate != null, "Either jdbcTemplate or dataSource must be set");
	
<no_super_class>