package com.google.gwt.sample.contacts.server;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;
import com.google.gwt.sample.contacts.shared.ContactDetails;
@Entity
public class ContactEntity {
@Id
@TableGenerator(name = "Contacts_Gen", table = "ID_GENERATOR", pkColumnName = "GEN_NAME", valueColumnName = "GEN_VALUE", allocationSize = 10)
@GeneratedValue(generator = "Contacts_Gen", strategy = GenerationType.TABLE)
public String id;
public String firstName;
public String lastName;
public String emailAddress;
public ContactEntity() {
}
public ContactEntity(String firstName, String lastName, String emailAddress) {
this.firstName = firstName;
this.lastName = lastName;
this.emailAddress = emailAddress;
}
public String getEmailAddress() {
return emailAddress;
}
public String getFirstName() {
return firstName;
}
public String getFullName() {
return firstName + " " + lastName;
}
public String getId() {
return id;
}
public String getLastName() {
return lastName;
}
public ContactDetails getLightWeightContact() {
return new ContactDetails(id, getFullName());
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setId(String id) {
this.id = id;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}