class CustomerUpdateProcessor implements ItemProcessor<CustomerUpdate, CustomerUpdate> {

	private CustomerDao customerDao;

	private InvalidCustomerLogger invalidCustomerLogger;

	@Nullable
	@Override
	public CustomerUpdate process(CustomerUpdate item) throws Exception {<FILL_FUNCTION_BODY>}

	public void setCustomerDao(CustomerDao customerDao) {
		this.customerDao = customerDao;
	}

	public void setInvalidCustomerLogger(InvalidCustomerLogger invalidCustomerLogger) {
		this.invalidCustomerLogger = invalidCustomerLogger;
	}

}


		if (item.getOperation() == DELETE) {
			// delete is not supported
			invalidCustomerLogger.log(item);
			return null;
		}

		CustomerCredit customerCredit = customerDao.getCustomerByName(item.getCustomerName());

		if (item.getOperation() == ADD && customerCredit == null) {
			return item;
		}
		else if (item.getOperation() == ADD && customerCredit != null) {
			// veto processing
			invalidCustomerLogger.log(item);
			return null;
		}

		if (item.getOperation() == UPDATE && customerCredit != null) {
			return item;
		}
		else if (item.getOperation() == UPDATE && customerCredit == null) {
			// veto processing
			invalidCustomerLogger.log(item);
			return null;
		}

		// if an item makes it through all these checks it can be assumed to be bad,
		// logged, and skipped
		invalidCustomerLogger.log(item);
		return null;
	
<no_super_class>