View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.sample.domain.order;
18  
19  
20  public class Customer {
21  	public static final String LINE_ID_BUSINESS_CUST = "BCU";
22  
23  	public static final String LINE_ID_NON_BUSINESS_CUST = "NCU";
24  
25  	private boolean businessCustomer;
26  
27  	private boolean registered;
28  
29  	private long registrationId;
30  
31  	// non-business customer
32  	private String firstName;
33  
34  	private String lastName;
35  
36  	private String middleName;
37  
38  	private boolean vip;
39  
40  	// business customer
41  	private String companyName;
42  
43  	public boolean isBusinessCustomer() {
44  		return businessCustomer;
45  	}
46  
47  	public void setBusinessCustomer(boolean bussinessCustomer) {
48  		this.businessCustomer = bussinessCustomer;
49  	}
50  
51  	public String getCompanyName() {
52  		return companyName;
53  	}
54  
55  	public void setCompanyName(String companyName) {
56  		this.companyName = companyName;
57  	}
58  
59  	public String getFirstName() {
60  		return firstName;
61  	}
62  
63  	public void setFirstName(String firstName) {
64  		this.firstName = firstName;
65  	}
66  
67  	public boolean isRegistered() {
68  		return registered;
69  	}
70  
71  	public void setRegistered(boolean registered) {
72  		this.registered = registered;
73  	}
74  
75  	public String getLastName() {
76  		return lastName;
77  	}
78  
79  	public void setLastName(String lastName) {
80  		this.lastName = lastName;
81  	}
82  
83  	public String getMiddleName() {
84  		return middleName;
85  	}
86  
87  	public void setMiddleName(String middleName) {
88  		this.middleName = middleName;
89  	}
90  
91  	public long getRegistrationId() {
92  		return registrationId;
93  	}
94  
95  	public void setRegistrationId(long registrationId) {
96  		this.registrationId = registrationId;
97  	}
98  
99  	public boolean isVip() {
100 		return vip;
101 	}
102 
103 	public void setVip(boolean vip) {
104 		this.vip = vip;
105 	}
106 
107 	@Override
108 	public String toString() {
109 		return "Customer [companyName=" + companyName + ", firstName=" + firstName + ", lastName=" + lastName + "]";
110 	}
111 
112 	@Override
113 	public int hashCode() {
114 		final int prime = 31;
115 		int result = 1;
116 		result = prime * result + (businessCustomer ? 1231 : 1237);
117 		result = prime * result + ((companyName == null) ? 0 : companyName.hashCode());
118 		result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
119 		result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
120 		result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
121 		result = prime * result + (registered ? 1231 : 1237);
122 		result = prime * result + (int) (registrationId ^ (registrationId >>> 32));
123 		result = prime * result + (vip ? 1231 : 1237);
124 		return result;
125 	}
126 
127 	@Override
128 	public boolean equals(Object obj) {
129 		if (this == obj)
130 			return true;
131 		if (obj == null)
132 			return false;
133 		if (getClass() != obj.getClass())
134 			return false;
135 		Customer other = (Customer) obj;
136 		if (businessCustomer != other.businessCustomer)
137 			return false;
138 		if (companyName == null) {
139 			if (other.companyName != null)
140 				return false;
141 		}
142 		else if (!companyName.equals(other.companyName))
143 			return false;
144 		if (firstName == null) {
145 			if (other.firstName != null)
146 				return false;
147 		}
148 		else if (!firstName.equals(other.firstName))
149 			return false;
150 		if (lastName == null) {
151 			if (other.lastName != null)
152 				return false;
153 		}
154 		else if (!lastName.equals(other.lastName))
155 			return false;
156 		if (middleName == null) {
157 			if (other.middleName != null)
158 				return false;
159 		}
160 		else if (!middleName.equals(other.middleName))
161 			return false;
162 		if (registered != other.registered)
163 			return false;
164 		if (registrationId != other.registrationId)
165 			return false;
166 		if (vip != other.vip)
167 			return false;
168 		return true;
169 	}
170 
171 }