1 package info.ejava.examples.ejb.interceptor.bo; 2 3 import javax.persistence.Column; 4 import javax.persistence.Entity; 5 import javax.persistence.EnumType; 6 import javax.persistence.Enumerated; 7 import javax.persistence.Table; 8 import javax.validation.Valid; 9 import javax.validation.constraints.NotNull; 10 11 12 @SuppressWarnings("serial") 13 @Entity 14 @Table(name="JPAINTERCEPTOR_PADDRESS") 15 public class PostalInfo extends ContactInfo{ 16 @NotNull(groups={PreNormalizedCheck.class, PrePersistCheck.class}) 17 @Enumerated(EnumType.STRING) 18 @Column(name="CONTACT_TYPE", length=10) 19 private AddressType type; 20 21 @NotNull(groups={PreNormalizedCheck.class}) 22 @Valid 23 private PostalAddress address; 24 25 @Override 26 public ContactType getContactType() { 27 return ContactType.ADDRESS; 28 } 29 30 public AddressType getType() { return type; } 31 public void setType(AddressType type) { 32 this.type = type; 33 } 34 35 public PostalAddress getAddress() { return address; } 36 public void setAddress(PostalAddress address) { 37 this.address = address; 38 } 39 40 @Override 41 public String toString() { 42 StringBuilder builder = new StringBuilder(); 43 builder.append("PostalInfo [") 44 .append("role=").append(getRole()) 45 .append(", type=").append(type) 46 .append(", address=") 47 .append(address) 48 .append("]"); 49 return builder.toString(); 50 } 51 }