1 61 package com.ivata.groupware.business.addressbook.address; 62 63 import com.ivata.groupware.business.addressbook.address.country.CountryDO; 64 import com.ivata.groupware.business.addressbook.person.PersonDO; 65 import com.ivata.groupware.container.persistence.BaseDO; 66 67 82 public class AddressDO extends BaseDO { 83 88 private final static String DISPLAY_VALUE_SEPERATOR = ", "; 89 92 private CountryDO country; 93 99 private PersonDO person; 100 103 private String postCode; 104 109 private String region; 110 115 private String streetAddress; 116 121 private String town; 122 123 132 public final CountryDO getCountry() { 133 return country; 134 } 135 136 143 public final String getDisplayValue() { 144 StringBuffer displayValue = new StringBuffer (); 145 if (streetAddress != null) { 146 displayValue.append(streetAddress); 147 } 148 if (town != null) { 149 if (displayValue.length() > 0) { 150 displayValue.append(DISPLAY_VALUE_SEPERATOR); 151 } 152 displayValue.append(town); 153 } 154 if (postCode != null) { 155 if (displayValue.length() > 0) { 156 displayValue.append(DISPLAY_VALUE_SEPERATOR); 157 } 158 displayValue.append(postCode); 159 } 160 if (region != null) { 161 if (displayValue.length() > 0) { 162 displayValue.append(DISPLAY_VALUE_SEPERATOR); 163 } 164 displayValue.append(region); 165 } 166 if (country != null) { 167 if (displayValue.length() > 0) { 168 displayValue.append(DISPLAY_VALUE_SEPERATOR); 169 } 170 displayValue.append(country.getDisplayValue()); 171 } 172 return displayValue.toString(); 173 } 174 178 public PersonDO getPerson() { 179 return person; 180 } 181 182 192 public final String getPostCode() { 193 return postCode; 194 } 195 196 204 public final String getRegion() { 205 return region; 206 } 207 214 public final String getStreetAddress() { 215 return streetAddress; 216 } 217 223 public final String getTown() { 224 return town; 225 } 226 227 232 public final void setCountry(final CountryDO country) { 233 this.country = country; 234 } 235 238 public final void setPerson(final PersonDO person) { 239 this.person = person; 240 } 241 242 249 public final void setPostCode(final String postCode) { 250 this.postCode = postCode; 251 } 252 253 258 public final void setRegion(final String region) { 259 this.region = region; 260 } 261 262 267 public final void setStreetAddress(final String streetAddress) { 268 this.streetAddress = streetAddress; 269 } 270 275 public final void setTown(final String town) { 276 this.town = town; 277 } 278 288 public Integer getId() { 289 return super.getId(); 290 } 291 } 292 | Popular Tags |