001/* 002 * Copyright 2006-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.batch.sample.domain.order; 018 019 020public class Customer { 021 public static final String LINE_ID_BUSINESS_CUST = "BCU"; 022 023 public static final String LINE_ID_NON_BUSINESS_CUST = "NCU"; 024 025 private boolean businessCustomer; 026 027 private boolean registered; 028 029 private long registrationId; 030 031 // non-business customer 032 private String firstName; 033 034 private String lastName; 035 036 private String middleName; 037 038 private boolean vip; 039 040 // business customer 041 private String companyName; 042 043 public boolean isBusinessCustomer() { 044 return businessCustomer; 045 } 046 047 public void setBusinessCustomer(boolean bussinessCustomer) { 048 this.businessCustomer = bussinessCustomer; 049 } 050 051 public String getCompanyName() { 052 return companyName; 053 } 054 055 public void setCompanyName(String companyName) { 056 this.companyName = companyName; 057 } 058 059 public String getFirstName() { 060 return firstName; 061 } 062 063 public void setFirstName(String firstName) { 064 this.firstName = firstName; 065 } 066 067 public boolean isRegistered() { 068 return registered; 069 } 070 071 public void setRegistered(boolean registered) { 072 this.registered = registered; 073 } 074 075 public String getLastName() { 076 return lastName; 077 } 078 079 public void setLastName(String lastName) { 080 this.lastName = lastName; 081 } 082 083 public String getMiddleName() { 084 return middleName; 085 } 086 087 public void setMiddleName(String middleName) { 088 this.middleName = middleName; 089 } 090 091 public long getRegistrationId() { 092 return registrationId; 093 } 094 095 public void setRegistrationId(long registrationId) { 096 this.registrationId = registrationId; 097 } 098 099 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 } 132 if (obj == null) { 133 return false; 134 } 135 if (getClass() != obj.getClass()) { 136 return false; 137 } 138 Customer other = (Customer) obj; 139 if (businessCustomer != other.businessCustomer) { 140 return false; 141 } 142 if (companyName == null) { 143 if (other.companyName != null) { 144 return false; 145 } 146 } 147 else if (!companyName.equals(other.companyName)) { 148 return false; 149 } 150 if (firstName == null) { 151 if (other.firstName != null) { 152 return false; 153 } 154 } 155 else if (!firstName.equals(other.firstName)) { 156 return false; 157 } 158 if (lastName == null) { 159 if (other.lastName != null) { 160 return false; 161 } 162 } 163 else if (!lastName.equals(other.lastName)) { 164 return false; 165 } 166 if (middleName == null) { 167 if (other.middleName != null) { 168 return false; 169 } 170 } 171 else if (!middleName.equals(other.middleName)) { 172 return false; 173 } 174 if (registered != other.registered) { 175 return false; 176 } 177 if (registrationId != other.registrationId) { 178 return false; 179 } 180 if (vip != other.vip) { 181 return false; 182 } 183 return true; 184 } 185 186}