BATCH-1470: remove commons-lang dependency
This commit is contained in:
@@ -45,11 +45,6 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
|
||||
@@ -18,10 +18,10 @@ package org.springframework.batch.core.repository.dao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.core.Entity;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -19,8 +19,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author dsyer
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
|
||||
@@ -26,11 +26,11 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.springframework.batch.core.resource;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* Simple domain object for testing purposes.
|
||||
@@ -42,13 +40,37 @@ public class Foo {
|
||||
public String toString() {
|
||||
return "Foo[id=" +id +",name=" + name + ",value=" + value + "]";
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + value;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Foo other = (Foo) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (value != other.value)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,11 +60,6 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
|
||||
@@ -2,30 +2,29 @@ package org.springframework.batch.io.oxm.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class Trade {
|
||||
private String isin = "";
|
||||
private long quantity = 0;
|
||||
private BigDecimal price = new BigDecimal(0);
|
||||
private String customer = "";
|
||||
private String isin = "";
|
||||
|
||||
public Trade() {
|
||||
}
|
||||
|
||||
public Trade(String isin, long quantity, BigDecimal price, String customer){
|
||||
this.isin = isin;
|
||||
this.quantity = quantity;
|
||||
this.price = price;
|
||||
this.customer = customer;
|
||||
}
|
||||
private long quantity = 0;
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
private BigDecimal price = new BigDecimal(0);
|
||||
|
||||
private String customer = "";
|
||||
|
||||
public Trade() {
|
||||
}
|
||||
|
||||
public Trade(String isin, long quantity, BigDecimal price, String customer) {
|
||||
this.isin = isin;
|
||||
this.quantity = quantity;
|
||||
this.price = price;
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
@@ -42,31 +41,67 @@ public class Trade {
|
||||
}
|
||||
|
||||
public String getIsin() {
|
||||
return isin;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public long getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price="
|
||||
+ this.price + ",customer=" + this.customer + "]";
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
return isin;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public long getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price=" + this.price + ",customer="
|
||||
+ this.customer + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((customer == null) ? 0 : customer.hashCode());
|
||||
result = prime * result + ((isin == null) ? 0 : isin.hashCode());
|
||||
result = prime * result + ((price == null) ? 0 : price.hashCode());
|
||||
result = prime * result + (int) (quantity ^ (quantity >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Trade other = (Trade) obj;
|
||||
if (customer == null) {
|
||||
if (other.customer != null)
|
||||
return false;
|
||||
}
|
||||
else if (!customer.equals(other.customer))
|
||||
return false;
|
||||
if (isin == null) {
|
||||
if (other.isin != null)
|
||||
return false;
|
||||
}
|
||||
else if (!isin.equals(other.isin))
|
||||
return false;
|
||||
if (price == null) {
|
||||
if (other.price != null)
|
||||
return false;
|
||||
}
|
||||
else if (!price.equals(other.price))
|
||||
return false;
|
||||
if (quantity != other.quantity)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,11 +78,6 @@
|
||||
<artifactId>log4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
||||
@@ -32,7 +32,6 @@ import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
@@ -52,6 +51,7 @@ import org.springframework.oxm.XmlMappingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.transform.StaxResult;
|
||||
|
||||
/**
|
||||
@@ -431,7 +431,7 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
|
||||
// write root tag
|
||||
writer.add(factory.createStartElement(getRootTagNamespacePrefix(), getRootTagNamespace(), getRootTagName()));
|
||||
if (!StringUtils.isBlank(getRootTagNamespace())) {
|
||||
if (StringUtils.hasText(getRootTagNamespace())) {
|
||||
writer.add(factory.createNamespace(getRootTagNamespacePrefix(), getRootTagNamespace()));
|
||||
}
|
||||
|
||||
@@ -458,8 +458,8 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
|
||||
// writer.writeEndDocument(); <- this doesn't work after restart
|
||||
// we need to write end tag of the root element manually
|
||||
|
||||
String nsPrefix = StringUtils.isBlank(getRootTagNamespacePrefix()) ? "" : getRootTagNamespacePrefix() + ":";
|
||||
|
||||
String nsPrefix = !StringUtils.hasText(getRootTagNamespacePrefix()) ? "" : getRootTagNamespacePrefix() + ":";
|
||||
try {
|
||||
bufferedWriter.write("</" + nsPrefix + getRootTagName() + ">");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2006-2010 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.support;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* Static utility to help with serialization.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class SerializationUtils {
|
||||
|
||||
/**
|
||||
* Serialize the object provided.
|
||||
*
|
||||
* @param object the object to serialize
|
||||
* @return an array of bytes representing the object in a portable fashion
|
||||
*/
|
||||
public static byte[] serialize(Object object) {
|
||||
|
||||
if (object==null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
try {
|
||||
new ObjectOutputStream(stream).writeObject(object);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("Could not serialize object of type: "+object.getClass(), e);
|
||||
}
|
||||
|
||||
return stream.toByteArray();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bytes a serialized object created
|
||||
* @return the result of deserializing the bytes
|
||||
*/
|
||||
public static Object deserialize(byte[] bytes) {
|
||||
|
||||
if (bytes==null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException("Could not deserialize object", e);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new IllegalStateException("Could not deserialize object type", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,15 +15,17 @@
|
||||
*/
|
||||
package org.springframework.batch.item;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
@@ -172,12 +174,26 @@ public class ExecutionContextTests {
|
||||
|
||||
int value;
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + value;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TestSerializable other = (TestSerializable) obj;
|
||||
if (value != other.value)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.springframework.batch.item.file.transform;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
|
||||
public class Name {
|
||||
private String first;
|
||||
@@ -41,7 +40,41 @@ public class Name {
|
||||
this.born = born;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + born;
|
||||
result = prime * result + ((first == null) ? 0 : first.hashCode());
|
||||
result = prime * result + ((last == null) ? 0 : last.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Name other = (Name) obj;
|
||||
if (born != other.born)
|
||||
return false;
|
||||
if (first == null) {
|
||||
if (other.first != null)
|
||||
return false;
|
||||
}
|
||||
else if (!first.equals(other.first))
|
||||
return false;
|
||||
if (last == null) {
|
||||
if (other.last != null)
|
||||
return false;
|
||||
}
|
||||
else if (!last.equals(other.last))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.batch.item.sample;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* An XML customer.
|
||||
@@ -76,15 +73,51 @@ public class Customer {
|
||||
this.poo = poo;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(obj, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((address == null) ? 0 : address.hashCode());
|
||||
result = prime * result + age;
|
||||
result = prime * result + moo;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + poo;
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Customer other = (Customer) obj;
|
||||
if (address == null) {
|
||||
if (other.address != null)
|
||||
return false;
|
||||
}
|
||||
else if (!address.equals(other.address))
|
||||
return false;
|
||||
if (age != other.age)
|
||||
return false;
|
||||
if (moo != other.moo)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (poo != other.poo)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Customer [address=" + address + ", age=" + age + ", name=" + name + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package org.springframework.batch.item.sample;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Simple domain object for testing purposes.
|
||||
@@ -54,14 +51,38 @@ public class Foo {
|
||||
return "Foo[id=" +id +",name=" + name + ",value=" + value + "]";
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + value;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Foo other = (Foo) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (value != other.value)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void fail() throws Exception {
|
||||
throw new Exception(FAILURE_MESSAGE);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.batch.item.sample;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* An XML line-item.
|
||||
@@ -66,15 +63,48 @@ public class LineItem {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(obj, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(perUnitOunces);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(price);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + quantity;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LineItem other = (LineItem) obj;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
}
|
||||
else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(perUnitOunces) != Double.doubleToLongBits(other.perUnitOunces))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price))
|
||||
return false;
|
||||
if (quantity != other.quantity)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
return "LineItem [description=" + description + ", perUnitOunces=" + perUnitOunces + ", price=" + price
|
||||
+ ", quantity=" + quantity + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@ package org.springframework.batch.item.sample;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* An XML order.
|
||||
*
|
||||
@@ -68,16 +64,58 @@ public class Order {
|
||||
public void setShipper(Shipper shipper) {
|
||||
this.shipper = shipper;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(obj, this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((customer == null) ? 0 : customer.hashCode());
|
||||
result = prime * result + ((date == null) ? 0 : date.hashCode());
|
||||
result = prime * result + ((lineItems == null) ? 0 : lineItems.hashCode());
|
||||
result = prime * result + ((shipper == null) ? 0 : shipper.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Order other = (Order) obj;
|
||||
if (customer == null) {
|
||||
if (other.customer != null)
|
||||
return false;
|
||||
}
|
||||
else if (!customer.equals(other.customer))
|
||||
return false;
|
||||
if (date == null) {
|
||||
if (other.date != null)
|
||||
return false;
|
||||
}
|
||||
else if (!date.equals(other.date))
|
||||
return false;
|
||||
if (lineItems == null) {
|
||||
if (other.lineItems != null)
|
||||
return false;
|
||||
}
|
||||
else if (!lineItems.equals(other.lineItems))
|
||||
return false;
|
||||
if (shipper == null) {
|
||||
if (other.shipper != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shipper.equals(other.shipper))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
return "Order [customer=" + customer + ", date=" + date + ", lineItems=" + lineItems + ", shipper=" + shipper
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.batch.item.sample;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* An XML shipper.
|
||||
@@ -46,15 +43,40 @@ public class Shipper {
|
||||
this.perOunceRate = perOunceRate;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(obj, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(perOunceRate);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Shipper other = (Shipper) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(perOunceRate) != Double.doubleToLongBits(other.perOunceRate))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
return "Shipper [name=" + name + ", perOunceRate=" + perOunceRate + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>PLEASE DON'T USE COMMONS LANG</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -111,10 +111,6 @@
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
@@ -31,6 +30,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ReaderNotOpenException;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
@@ -22,11 +22,11 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.support.SerializationUtils;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.support.JdbcDaoSupport;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
|
||||
@@ -18,9 +18,6 @@ package org.springframework.batch.sample.domain.football;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
public class Game implements Serializable {
|
||||
|
||||
private String id;
|
||||
@@ -225,13 +222,30 @@ public class Game implements Serializable {
|
||||
return "Game: ID=" + id + " " + team + " vs. " + opponent +
|
||||
" - " + year;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Game other = (Game) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
}
|
||||
else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.football;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* Domain object representing the summary of a given Player's
|
||||
@@ -120,12 +118,29 @@ public class PlayerSummary {
|
||||
";" + passingTd + ";" + interceptions + ";" + rushes + ";" + rushYards + ";" + receptions +
|
||||
";" + receptionYards + ";" + totalTd;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PlayerSummary other = (PlayerSummary) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
}
|
||||
else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,88 +16,125 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
public class Address {
|
||||
public static final String LINE_ID_BILLING_ADDR = "BAD";
|
||||
public static final String LINE_ID_SHIPPING_ADDR = "SAD";
|
||||
private String addressee;
|
||||
private String addrLine1;
|
||||
private String addrLine2;
|
||||
private String city;
|
||||
private String zipCode;
|
||||
private String state;
|
||||
private String country;
|
||||
public static final String LINE_ID_BILLING_ADDR = "BAD";
|
||||
|
||||
public String getAddrLine1() {
|
||||
return addrLine1;
|
||||
}
|
||||
public static final String LINE_ID_SHIPPING_ADDR = "SAD";
|
||||
|
||||
public void setAddrLine1(String addrLine1) {
|
||||
this.addrLine1 = addrLine1;
|
||||
}
|
||||
private String addressee;
|
||||
|
||||
public String getAddrLine2() {
|
||||
return addrLine2;
|
||||
}
|
||||
private String addrLine1;
|
||||
|
||||
public void setAddrLine2(String addrLine2) {
|
||||
this.addrLine2 = addrLine2;
|
||||
}
|
||||
private String addrLine2;
|
||||
|
||||
public String getAddressee() {
|
||||
return addressee;
|
||||
}
|
||||
private String city;
|
||||
|
||||
public void setAddressee(String addressee) {
|
||||
this.addressee = addressee;
|
||||
}
|
||||
private String zipCode;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
private String state;
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
private String country;
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
public String getAddrLine1() {
|
||||
return addrLine1;
|
||||
}
|
||||
|
||||
public void setAddrLine1(String addrLine1) {
|
||||
this.addrLine1 = addrLine1;
|
||||
}
|
||||
|
||||
public String getAddrLine2() {
|
||||
return addrLine2;
|
||||
}
|
||||
|
||||
public void setAddrLine2(String addrLine2) {
|
||||
this.addrLine2 = addrLine2;
|
||||
}
|
||||
|
||||
public String getAddressee() {
|
||||
return addressee;
|
||||
}
|
||||
|
||||
public void setAddressee(String addressee) {
|
||||
this.addressee = addressee;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Address [addressee=" + addressee + ", city=" + city + ", country=" + country + ", state=" + state
|
||||
+ ", zipCode=" + zipCode + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((addressee == null) ? 0 : addressee.hashCode());
|
||||
result = prime * result + ((country == null) ? 0 : country.hashCode());
|
||||
result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Address other = (Address) obj;
|
||||
if (addressee == null) {
|
||||
if (other.addressee != null)
|
||||
return false;
|
||||
}
|
||||
else if (!addressee.equals(other.addressee))
|
||||
return false;
|
||||
if (country == null) {
|
||||
if (other.country != null)
|
||||
return false;
|
||||
}
|
||||
else if (!country.equals(other.country))
|
||||
return false;
|
||||
if (zipCode == null) {
|
||||
if (other.zipCode != null)
|
||||
return false;
|
||||
}
|
||||
else if (!zipCode.equals(other.zipCode))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,42 +16,66 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
public class BillingInfo {
|
||||
public static final String LINE_ID_BILLING_INFO = "BIN";
|
||||
private String paymentId;
|
||||
private String paymentDesc;
|
||||
public static final String LINE_ID_BILLING_INFO = "BIN";
|
||||
|
||||
public String getPaymentDesc() {
|
||||
return paymentDesc;
|
||||
}
|
||||
private String paymentId;
|
||||
|
||||
public void setPaymentDesc(String paymentDesc) {
|
||||
this.paymentDesc = paymentDesc;
|
||||
}
|
||||
private String paymentDesc;
|
||||
|
||||
public String getPaymentId() {
|
||||
return paymentId;
|
||||
}
|
||||
|
||||
public void setPaymentId(String paymentId) {
|
||||
this.paymentId = paymentId;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
public String getPaymentDesc() {
|
||||
return paymentDesc;
|
||||
}
|
||||
|
||||
public void setPaymentDesc(String paymentDesc) {
|
||||
this.paymentDesc = paymentDesc;
|
||||
}
|
||||
|
||||
public String getPaymentId() {
|
||||
return paymentId;
|
||||
}
|
||||
|
||||
public void setPaymentId(String paymentId) {
|
||||
this.paymentId = paymentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BillingInfo [paymentDesc=" + paymentDesc + ", paymentId=" + paymentId + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((paymentDesc == null) ? 0 : paymentDesc.hashCode());
|
||||
result = prime * result + ((paymentId == null) ? 0 : paymentId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
BillingInfo other = (BillingInfo) obj;
|
||||
if (paymentDesc == null) {
|
||||
if (other.paymentDesc != null)
|
||||
return false;
|
||||
}
|
||||
else if (!paymentDesc.equals(other.paymentDesc))
|
||||
return false;
|
||||
if (paymentId == null) {
|
||||
if (other.paymentId != null)
|
||||
return false;
|
||||
}
|
||||
else if (!paymentId.equals(other.paymentId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,100 +16,156 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
public class Customer {
|
||||
public static final String LINE_ID_BUSINESS_CUST = "BCU";
|
||||
public static final String LINE_ID_NON_BUSINESS_CUST = "NCU";
|
||||
private boolean businessCustomer;
|
||||
private boolean registered;
|
||||
private long registrationId;
|
||||
public static final String LINE_ID_BUSINESS_CUST = "BCU";
|
||||
|
||||
//non-business customer
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String middleName;
|
||||
private boolean vip;
|
||||
public static final String LINE_ID_NON_BUSINESS_CUST = "NCU";
|
||||
|
||||
//business customer
|
||||
private String companyName;
|
||||
private boolean businessCustomer;
|
||||
|
||||
public boolean isBusinessCustomer() {
|
||||
return businessCustomer;
|
||||
}
|
||||
private boolean registered;
|
||||
|
||||
public void setBusinessCustomer(boolean bussinessCustomer) {
|
||||
this.businessCustomer = bussinessCustomer;
|
||||
}
|
||||
private long registrationId;
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
// non-business customer
|
||||
private String firstName;
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
private String lastName;
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
private String middleName;
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
private boolean vip;
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
// business customer
|
||||
private String companyName;
|
||||
|
||||
public void setRegistered(boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
return middleName;
|
||||
}
|
||||
|
||||
public void setMiddleName(String middleName) {
|
||||
this.middleName = middleName;
|
||||
}
|
||||
|
||||
public long getRegistrationId() {
|
||||
return registrationId;
|
||||
}
|
||||
|
||||
public void setRegistrationId(long registrationId) {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
|
||||
public boolean isVip() {
|
||||
return vip;
|
||||
}
|
||||
|
||||
public void setVip(boolean vip) {
|
||||
this.vip = vip;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
public boolean isBusinessCustomer() {
|
||||
return businessCustomer;
|
||||
}
|
||||
|
||||
public void setBusinessCustomer(boolean bussinessCustomer) {
|
||||
this.businessCustomer = bussinessCustomer;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public void setRegistered(boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
return middleName;
|
||||
}
|
||||
|
||||
public void setMiddleName(String middleName) {
|
||||
this.middleName = middleName;
|
||||
}
|
||||
|
||||
public long getRegistrationId() {
|
||||
return registrationId;
|
||||
}
|
||||
|
||||
public void setRegistrationId(long registrationId) {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
|
||||
public boolean isVip() {
|
||||
return vip;
|
||||
}
|
||||
|
||||
public void setVip(boolean vip) {
|
||||
this.vip = vip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Customer [companyName=" + companyName + ", firstName=" + firstName + ", lastName=" + lastName + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (businessCustomer ? 1231 : 1237);
|
||||
result = prime * result + ((companyName == null) ? 0 : companyName.hashCode());
|
||||
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
|
||||
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
|
||||
result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
|
||||
result = prime * result + (registered ? 1231 : 1237);
|
||||
result = prime * result + (int) (registrationId ^ (registrationId >>> 32));
|
||||
result = prime * result + (vip ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Customer other = (Customer) obj;
|
||||
if (businessCustomer != other.businessCustomer)
|
||||
return false;
|
||||
if (companyName == null) {
|
||||
if (other.companyName != null)
|
||||
return false;
|
||||
}
|
||||
else if (!companyName.equals(other.companyName))
|
||||
return false;
|
||||
if (firstName == null) {
|
||||
if (other.firstName != null)
|
||||
return false;
|
||||
}
|
||||
else if (!firstName.equals(other.firstName))
|
||||
return false;
|
||||
if (lastName == null) {
|
||||
if (other.lastName != null)
|
||||
return false;
|
||||
}
|
||||
else if (!lastName.equals(other.lastName))
|
||||
return false;
|
||||
if (middleName == null) {
|
||||
if (other.middleName != null)
|
||||
return false;
|
||||
}
|
||||
else if (!middleName.equals(other.middleName))
|
||||
return false;
|
||||
if (registered != other.registered)
|
||||
return false;
|
||||
if (registrationId != other.registrationId)
|
||||
return false;
|
||||
if (vip != other.vip)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ package org.springframework.batch.sample.domain.order;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
|
||||
public class LineItem {
|
||||
public static final String LINE_ID_ITEM = "LIT";
|
||||
@@ -97,17 +93,35 @@ public class LineItem {
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LineItem [price=" + price + ", quantity=" + quantity + ", totalPrice=" + totalPrice + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (itemId ^ (itemId >>> 32));
|
||||
result = prime * result + quantity;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LineItem other = (LineItem) obj;
|
||||
if (itemId != other.itemId)
|
||||
return false;
|
||||
if (quantity != other.quantity)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,129 +20,212 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
|
||||
public class Order {
|
||||
public static final String LINE_ID_HEADER = "HEA";
|
||||
public static final String LINE_ID_FOOTER = "FOT";
|
||||
public static final String LINE_ID_HEADER = "HEA";
|
||||
|
||||
//header
|
||||
private long orderId;
|
||||
private Date orderDate;
|
||||
public static final String LINE_ID_FOOTER = "FOT";
|
||||
|
||||
//footer
|
||||
private int totalLines;
|
||||
private int totalItems;
|
||||
private BigDecimal totalPrice;
|
||||
private Customer customer;
|
||||
private Address billingAddress;
|
||||
private Address shippingAddress;
|
||||
private BillingInfo billing;
|
||||
private ShippingInfo shipping;
|
||||
// header
|
||||
private long orderId;
|
||||
|
||||
//order items
|
||||
private List<LineItem> lineItems;
|
||||
private Date orderDate;
|
||||
|
||||
public BillingInfo getBilling() {
|
||||
return billing;
|
||||
}
|
||||
// footer
|
||||
private int totalLines;
|
||||
|
||||
public void setBilling(BillingInfo billing) {
|
||||
this.billing = billing;
|
||||
}
|
||||
private int totalItems;
|
||||
|
||||
public Address getBillingAddress() {
|
||||
return billingAddress;
|
||||
}
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
public void setBillingAddress(Address billingAddress) {
|
||||
this.billingAddress = billingAddress;
|
||||
}
|
||||
private Customer customer;
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
private Address billingAddress;
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
private Address shippingAddress;
|
||||
|
||||
public List<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
private BillingInfo billing;
|
||||
|
||||
public void setLineItems(List<LineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
private ShippingInfo shipping;
|
||||
|
||||
public Date getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
// order items
|
||||
private List<LineItem> lineItems;
|
||||
|
||||
public void setOrderDate(Date orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public ShippingInfo getShipping() {
|
||||
return shipping;
|
||||
}
|
||||
|
||||
public void setShipping(ShippingInfo shipping) {
|
||||
this.shipping = shipping;
|
||||
}
|
||||
|
||||
public Address getShippingAddress() {
|
||||
return shippingAddress;
|
||||
}
|
||||
|
||||
public void setShippingAddress(Address shippingAddress) {
|
||||
this.shippingAddress = shippingAddress;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public int getTotalItems() {
|
||||
return totalItems;
|
||||
}
|
||||
|
||||
public void setTotalItems(int totalItems) {
|
||||
this.totalItems = totalItems;
|
||||
}
|
||||
|
||||
public int getTotalLines() {
|
||||
return totalLines;
|
||||
}
|
||||
|
||||
public void setTotalLines(int totalLines) {
|
||||
this.totalLines = totalLines;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
public BillingInfo getBilling() {
|
||||
return billing;
|
||||
}
|
||||
|
||||
public void setBilling(BillingInfo billing) {
|
||||
this.billing = billing;
|
||||
}
|
||||
|
||||
public Address getBillingAddress() {
|
||||
return billingAddress;
|
||||
}
|
||||
|
||||
public void setBillingAddress(Address billingAddress) {
|
||||
this.billingAddress = billingAddress;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public List<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
|
||||
public void setLineItems(List<LineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
|
||||
public Date getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
public void setOrderDate(Date orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public ShippingInfo getShipping() {
|
||||
return shipping;
|
||||
}
|
||||
|
||||
public void setShipping(ShippingInfo shipping) {
|
||||
this.shipping = shipping;
|
||||
}
|
||||
|
||||
public Address getShippingAddress() {
|
||||
return shippingAddress;
|
||||
}
|
||||
|
||||
public void setShippingAddress(Address shippingAddress) {
|
||||
this.shippingAddress = shippingAddress;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public int getTotalItems() {
|
||||
return totalItems;
|
||||
}
|
||||
|
||||
public void setTotalItems(int totalItems) {
|
||||
this.totalItems = totalItems;
|
||||
}
|
||||
|
||||
public int getTotalLines() {
|
||||
return totalLines;
|
||||
}
|
||||
|
||||
public void setTotalLines(int totalLines) {
|
||||
this.totalLines = totalLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Order [customer=" + customer + ", orderId=" + orderId + ", totalItems=" + totalItems + ", totalPrice="
|
||||
+ totalPrice + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((billing == null) ? 0 : billing.hashCode());
|
||||
result = prime * result + ((billingAddress == null) ? 0 : billingAddress.hashCode());
|
||||
result = prime * result + ((customer == null) ? 0 : customer.hashCode());
|
||||
result = prime * result + ((lineItems == null) ? 0 : lineItems.hashCode());
|
||||
result = prime * result + ((orderDate == null) ? 0 : orderDate.hashCode());
|
||||
result = prime * result + (int) (orderId ^ (orderId >>> 32));
|
||||
result = prime * result + ((shipping == null) ? 0 : shipping.hashCode());
|
||||
result = prime * result + ((shippingAddress == null) ? 0 : shippingAddress.hashCode());
|
||||
result = prime * result + totalItems;
|
||||
result = prime * result + totalLines;
|
||||
result = prime * result + ((totalPrice == null) ? 0 : totalPrice.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Order other = (Order) obj;
|
||||
if (billing == null) {
|
||||
if (other.billing != null)
|
||||
return false;
|
||||
}
|
||||
else if (!billing.equals(other.billing))
|
||||
return false;
|
||||
if (billingAddress == null) {
|
||||
if (other.billingAddress != null)
|
||||
return false;
|
||||
}
|
||||
else if (!billingAddress.equals(other.billingAddress))
|
||||
return false;
|
||||
if (customer == null) {
|
||||
if (other.customer != null)
|
||||
return false;
|
||||
}
|
||||
else if (!customer.equals(other.customer))
|
||||
return false;
|
||||
if (lineItems == null) {
|
||||
if (other.lineItems != null)
|
||||
return false;
|
||||
}
|
||||
else if (!lineItems.equals(other.lineItems))
|
||||
return false;
|
||||
if (orderDate == null) {
|
||||
if (other.orderDate != null)
|
||||
return false;
|
||||
}
|
||||
else if (!orderDate.equals(other.orderDate))
|
||||
return false;
|
||||
if (orderId != other.orderId)
|
||||
return false;
|
||||
if (shipping == null) {
|
||||
if (other.shipping != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shipping.equals(other.shipping))
|
||||
return false;
|
||||
if (shippingAddress == null) {
|
||||
if (other.shippingAddress != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shippingAddress.equals(other.shippingAddress))
|
||||
return false;
|
||||
if (totalItems != other.totalItems)
|
||||
return false;
|
||||
if (totalLines != other.totalLines)
|
||||
return false;
|
||||
if (totalPrice == null) {
|
||||
if (other.totalPrice != null)
|
||||
return false;
|
||||
}
|
||||
else if (!totalPrice.equals(other.totalPrice))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,44 +16,78 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
public class ShippingInfo {
|
||||
public static final String LINE_ID_SHIPPING_INFO = "SIN";
|
||||
private String shipperId;
|
||||
private String shippingTypeId;
|
||||
private String shippingInfo;
|
||||
public static final String LINE_ID_SHIPPING_INFO = "SIN";
|
||||
|
||||
public String getShipperId() {
|
||||
return shipperId;
|
||||
}
|
||||
private String shipperId;
|
||||
|
||||
public void setShipperId(String shipperId) {
|
||||
this.shipperId = shipperId;
|
||||
}
|
||||
private String shippingTypeId;
|
||||
|
||||
public String getShippingInfo() {
|
||||
return shippingInfo;
|
||||
}
|
||||
private String shippingInfo;
|
||||
|
||||
public void setShippingInfo(String shippingInfo) {
|
||||
this.shippingInfo = shippingInfo;
|
||||
}
|
||||
|
||||
public String getShippingTypeId() {
|
||||
return shippingTypeId;
|
||||
}
|
||||
|
||||
public void setShippingTypeId(String shippingTypeId) {
|
||||
this.shippingTypeId = shippingTypeId;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
public String getShipperId() {
|
||||
return shipperId;
|
||||
}
|
||||
|
||||
public void setShipperId(String shipperId) {
|
||||
this.shipperId = shipperId;
|
||||
}
|
||||
|
||||
public String getShippingInfo() {
|
||||
return shippingInfo;
|
||||
}
|
||||
|
||||
public void setShippingInfo(String shippingInfo) {
|
||||
this.shippingInfo = shippingInfo;
|
||||
}
|
||||
|
||||
public String getShippingTypeId() {
|
||||
return shippingTypeId;
|
||||
}
|
||||
|
||||
public void setShippingTypeId(String shippingTypeId) {
|
||||
this.shippingTypeId = shippingTypeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((shipperId == null) ? 0 : shipperId.hashCode());
|
||||
result = prime * result + ((shippingInfo == null) ? 0 : shippingInfo.hashCode());
|
||||
result = prime * result + ((shippingTypeId == null) ? 0 : shippingTypeId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ShippingInfo other = (ShippingInfo) obj;
|
||||
if (shipperId == null) {
|
||||
if (other.shipperId != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shipperId.equals(other.shipperId))
|
||||
return false;
|
||||
if (shippingInfo == null) {
|
||||
if (other.shippingInfo != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shippingInfo.equals(other.shippingInfo))
|
||||
return false;
|
||||
if (shippingTypeId == null) {
|
||||
if (other.shippingTypeId != null)
|
||||
return false;
|
||||
}
|
||||
else if (!shippingTypeId.equals(other.shippingTypeId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,62 +16,65 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order.internal.xml;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* An XML customer.
|
||||
*
|
||||
*
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class Customer {
|
||||
private String name;
|
||||
private String address;
|
||||
private int age;
|
||||
private int moo;
|
||||
private int poo;
|
||||
private String name;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
private String address;
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
private int age;
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
private int moo;
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
private int poo;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public int getMoo() {
|
||||
return moo;
|
||||
}
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setMoo(int moo) {
|
||||
this.moo = moo;
|
||||
}
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getPoo() {
|
||||
return poo;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setPoo(int poo) {
|
||||
this.poo = poo;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getMoo() {
|
||||
return moo;
|
||||
}
|
||||
|
||||
public void setMoo(int moo) {
|
||||
this.moo = moo;
|
||||
}
|
||||
|
||||
public int getPoo() {
|
||||
return poo;
|
||||
}
|
||||
|
||||
public void setPoo(int poo) {
|
||||
this.poo = poo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Customer [address=" + address + ", age=" + age + ", name=" + name + "]";
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,53 +19,55 @@ package org.springframework.batch.sample.domain.order.internal.xml;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* An XML order.
|
||||
*
|
||||
*
|
||||
* This is a complex type.
|
||||
*/
|
||||
public class Order {
|
||||
private Customer customer;
|
||||
private Date date;
|
||||
private List<LineItem> lineItems;
|
||||
private Shipper shipper;
|
||||
private Customer customer;
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
private Date date;
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
private List<LineItem> lineItems;
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
private Shipper shipper;
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public List<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public void setLineItems(List<LineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public Shipper getShipper() {
|
||||
return shipper;
|
||||
}
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public void setShipper(Shipper shipper) {
|
||||
this.shipper = shipper;
|
||||
}
|
||||
public List<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
|
||||
public void setLineItems(List<LineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
|
||||
public Shipper getShipper() {
|
||||
return shipper;
|
||||
}
|
||||
|
||||
public void setShipper(Shipper shipper) {
|
||||
this.shipper = shipper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Order [customer=" + customer + ", date=" + date + ", lineItems=" + lineItems + "]";
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.person;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
public class Child {
|
||||
|
||||
@@ -31,17 +28,36 @@ public class Child {
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
return "Child [name=" + name + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Child other = (Child) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,73 +19,83 @@ package org.springframework.batch.sample.domain.person;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.springframework.batch.sample.domain.order.Address;
|
||||
|
||||
public class Person {
|
||||
|
||||
private String title = "";
|
||||
|
||||
private String firstName = "";
|
||||
|
||||
private String last_name = "";
|
||||
|
||||
private int age = 0;
|
||||
|
||||
private Address address = new Address();
|
||||
|
||||
private List<Child> children = new ArrayList<Child>();
|
||||
|
||||
public Person(){
|
||||
|
||||
public Person() {
|
||||
children.add(new Child());
|
||||
children.add(new Child());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the address
|
||||
*/
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param address the address to set
|
||||
*/
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the age
|
||||
*/
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param age the age to set
|
||||
*/
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the firstName
|
||||
*/
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param firstName the firstName to set
|
||||
*/
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the children
|
||||
*/
|
||||
public List<Child> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param children the children to set
|
||||
*/
|
||||
public void setChildren(List<Child> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intentionally non-standard method name for testing purposes
|
||||
* @return the last_name
|
||||
@@ -93,6 +103,7 @@ public class Person {
|
||||
public String getLast_name() {
|
||||
return last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intentionally non-standard method name for testing purposes
|
||||
* @param last_name the last_name to set
|
||||
@@ -100,28 +111,82 @@ public class Person {
|
||||
public void setLast_name(String last_name) {
|
||||
this.last_name = last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the person_title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the person title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
return "Person [address=" + address + ", age=" + age + ", children=" + children + ", firstName=" + firstName
|
||||
+ ", last_name=" + last_name + ", title=" + title + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((address == null) ? 0 : address.hashCode());
|
||||
result = prime * result + age;
|
||||
result = prime * result + ((children == null) ? 0 : children.hashCode());
|
||||
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
|
||||
result = prime * result + ((last_name == null) ? 0 : last_name.hashCode());
|
||||
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Person other = (Person) obj;
|
||||
if (address == null) {
|
||||
if (other.address != null)
|
||||
return false;
|
||||
}
|
||||
else if (!address.equals(other.address))
|
||||
return false;
|
||||
if (age != other.age)
|
||||
return false;
|
||||
if (children == null) {
|
||||
if (other.children != null)
|
||||
return false;
|
||||
}
|
||||
else if (!children.equals(other.children))
|
||||
return false;
|
||||
if (firstName == null) {
|
||||
if (other.firstName != null)
|
||||
return false;
|
||||
}
|
||||
else if (!firstName.equals(other.firstName))
|
||||
return false;
|
||||
if (last_name == null) {
|
||||
if (other.last_name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!last_name.equals(other.last_name))
|
||||
return false;
|
||||
if (title == null) {
|
||||
if (other.title != null)
|
||||
return false;
|
||||
}
|
||||
else if (!title.equals(other.title))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@ package org.springframework.batch.sample.domain.trade;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
|
||||
public class CustomerDebit {
|
||||
private String name;
|
||||
@@ -53,12 +50,38 @@ public class CustomerDebit {
|
||||
public String toString() {
|
||||
return "CustomerDebit [name=" + name + ", debit=" + debit + "]";
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return EqualsBuilder.reflectionEquals(this, o);
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((debit == null) ? 0 : debit.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CustomerDebit other = (CustomerDebit) obj;
|
||||
if (debit == null) {
|
||||
if (other.debit != null)
|
||||
return false;
|
||||
}
|
||||
else if (!debit.equals(other.debit))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ package org.springframework.batch.sample.domain.trade;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
@@ -103,23 +101,51 @@ public class Trade implements Serializable {
|
||||
return "Trade: [isin=" + this.isin + ",quantity=" + this.quantity + ",price="
|
||||
+ this.price + ",customer=" + this.customer + "]";
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if(!(o instanceof Trade)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(o == this){
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Trade t = (Trade)o;
|
||||
return isin.equals(t.getIsin()) && quantity == t.getQuantity() &&
|
||||
price.equals(t.getPrice()) && customer.equals(t.getCustomer()) ;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((customer == null) ? 0 : customer.hashCode());
|
||||
result = prime * result + ((isin == null) ? 0 : isin.hashCode());
|
||||
result = prime * result + ((price == null) ? 0 : price.hashCode());
|
||||
result = prime * result + (int) (quantity ^ (quantity >>> 32));
|
||||
result = prime * result + (int) (version ^ (version >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Trade other = (Trade) obj;
|
||||
if (customer == null) {
|
||||
if (other.customer != null)
|
||||
return false;
|
||||
}
|
||||
else if (!customer.equals(other.customer))
|
||||
return false;
|
||||
if (isin == null) {
|
||||
if (other.isin != null)
|
||||
return false;
|
||||
}
|
||||
else if (!isin.equals(other.isin))
|
||||
return false;
|
||||
if (price == null) {
|
||||
if (other.price != null)
|
||||
return false;
|
||||
}
|
||||
else if (!price.equals(other.price))
|
||||
return false;
|
||||
if (quantity != other.quantity)
|
||||
return false;
|
||||
if (version != other.version)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user