diff --git a/spring-batch-samples/pom.xml b/spring-batch-samples/pom.xml index 0f6924240..2f5ed9b78 100644 --- a/spring-batch-samples/pom.xml +++ b/spring-batch-samples/pom.xml @@ -45,45 +45,6 @@ junit junit - - org.springmodules - spring-modules-validation - 0.8a - - - rhino - js - - - commons-validator - commons-validator - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - commons-beanutils - commons-beanutils - - - commons-digester - commons-digester - - - antlr - antlr - - - org.springframework - spring - - - org.opensymphony.quartz quartz diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/validator/TradeValidator.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/validator/TradeValidator.java new file mode 100644 index 000000000..b5dd4f24b --- /dev/null +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/validator/TradeValidator.java @@ -0,0 +1,40 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.sample.domain.trade.internal.validator; + +import org.springframework.batch.item.validator.ValidationException; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; +import org.springframework.batch.sample.domain.trade.Trade; + +/** + * @author Michael Minella + */ +public class TradeValidator implements Validator { + @Override + public boolean supports(Class clazz) { + return clazz.equals(Trade.class); + } + + @Override + public void validate(Object target, Errors errors) { + Trade trade = (Trade) target; + + if(trade.getIsin().length() >= 13) { + errors.rejectValue("isin", "isin_length"); + } + } +} diff --git a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml index 3b910e5e1..4e437f426 100644 --- a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml @@ -60,15 +60,7 @@ - - - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/compositeItemWriterSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/compositeItemWriterSampleJob.xml index f2124d8fe..71e934f02 100644 --- a/spring-batch-samples/src/main/resources/jobs/compositeItemWriterSampleJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/compositeItemWriterSampleJob.xml @@ -61,15 +61,7 @@ - - - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/jobStepSample.xml b/spring-batch-samples/src/main/resources/jobs/jobStepSample.xml index 94d6507d8..5bc712995 100644 --- a/spring-batch-samples/src/main/resources/jobs/jobStepSample.xml +++ b/spring-batch-samples/src/main/resources/jobs/jobStepSample.xml @@ -49,15 +49,7 @@ - - - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml index 272f43844..05449790f 100644 --- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml @@ -82,15 +82,7 @@ - - - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/restartSample.xml b/spring-batch-samples/src/main/resources/jobs/restartSample.xml index ab790740a..8233a20c2 100644 --- a/spring-batch-samples/src/main/resources/jobs/restartSample.xml +++ b/spring-batch-samples/src/main/resources/jobs/restartSample.xml @@ -48,15 +48,7 @@ - - - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml index 6d13958d7..0ce3d7635 100644 --- a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml @@ -3,31 +3,31 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:batch="http://www.springframework.org/schema/batch" - xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd + xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - - + - - + + - + - - + + - - + + @@ -106,13 +106,7 @@ - - - - - - - +