package de.hsadmin.mods.cust; import static javax.persistence.FetchType.EAGER; import static javax.persistence.GenerationType.SEQUENCE; import javax.persistence.EntityManager; import de.hsadmin.mods.user.UnixUser; @javax.persistence.Entity(name = "Contacts") @javax.persistence.Table(name = "contact") @javax.persistence.SequenceGenerator(name = "ContactsSeqGen", sequenceName = "contact_contact_id_seq") public class Contact extends de.hsadmin.core.model.Entity implements java.io.Serializable { private static final long serialVersionUID = 9119607911598098558L; // attribute id @javax.persistence.Id @javax.persistence.GeneratedValue(strategy = SEQUENCE, generator = "ContactsSeqGen") @javax.persistence.Column(name = "contact_id", columnDefinition = "integer") private long id; // attribute customer @javax.persistence.JoinColumn(name = "bp_id", columnDefinition = "integer") @javax.persistence.ManyToOne(fetch = EAGER) private Customer customer; // attribute salut @javax.persistence.Column(name = "salut", columnDefinition = "character varying(30)") private String salut; // attribute firstName @javax.persistence.Column(name = "first_name", columnDefinition = "character varying(40)") private String firstName; // attribute lastName @javax.persistence.Column(name = "last_name", columnDefinition = "character varying(40)") private String lastName; // attribute title @javax.persistence.Column(name = "title", columnDefinition = "character varying(20)") private String title; // attribute firma @javax.persistence.Column(name = "firma", columnDefinition = "character varying(120)") private String firma; // attribute co @javax.persistence.Column(name = "co", columnDefinition = "character varying(50)") private String co; // attribute street @javax.persistence.Column(name = "street", columnDefinition = "character varying(50)") private String street; // attribute zipCode @javax.persistence.Column(name = "zipcode", columnDefinition = "character varying(10)") private String zipCode; // attribute city @javax.persistence.Column(name = "city", columnDefinition = "character varying(40)") private String city; // attribute country @javax.persistence.Column(name = "country", columnDefinition = "character varying(30)") private String country; // attribute phonePrivate @javax.persistence.Column(name = "phone_private", columnDefinition = "character varying(30)") private String phonePrivate; // attribute phoneOffice @javax.persistence.Column(name = "phone_office", columnDefinition = "character varying(30)") private String phoneOffice; // attribute phoneMobile @javax.persistence.Column(name = "phone_mobile", columnDefinition = "character varying(30)") private String phoneMobile; // attribute fax @javax.persistence.Column(name = "fax", columnDefinition = "character varying(30)") private String fax; // attribute email @javax.persistence.Column(name = "email", columnDefinition = "character varying(50)") private String email; public Contact() { } public Contact(Customer cust) { this.customer = cust; } public Contact(Customer cust, String salut, String title, String firstName, String lastName, String firma, String co, String street, String zipCode, String city, String country, String phonePrivate, String phoneOffice, String phoneMobile, String fax, String email) { this.customer = cust; this.salut = salut; this.title = title; this.firstName = firstName; this.lastName = lastName; this.firma = firma; this.co = co; this.street = street; this.zipCode = zipCode; this.city = city; this.country = country; this.phonePrivate = phonePrivate; this.phoneOffice = phoneOffice; this.phoneMobile = phoneMobile; this.fax = fax; this.email = email; } // / {@inheritDoc} public static String createQueryFromStringKey(String humanKey) { return "name='" + humanKey + "'"; } // / {@inheritDoc} @Override public String createStringKey() { return getCustomer().getName(); } // / {@inheritDoc} @Override public long id() { return id; } public long getId() { return id; } public void setId(long id) { this.id = id; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public String getSalut() { return salut; } public void setSalut(String salut) { this.salut = salut; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getFirma() { return firma; } public void setFirma(String firma) { this.firma = firma; } public String getCo() { return co; } public void setCo(String co) { this.co = co; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getZipCode() { return zipCode; } public void setZipCode(String zipCode) { this.zipCode = zipCode; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getPhonePrivate() { return phonePrivate; } public void setPhonePrivate(String phonePrivate) { this.phonePrivate = phonePrivate; } public String getPhoneOffice() { return phoneOffice; } public void setPhoneOffice(String phoneOffice) { this.phoneOffice = phoneOffice; } public String getPhoneMobile() { return phoneMobile; } public void setPhoneMobile(String phoneMobile) { this.phoneMobile = phoneMobile; } public String getFax() { return fax; } public void setFax(String fax) { this.fax = fax; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } // / {$inheritDoc} @Override public boolean isNew() { return id == 0; } // / {@inheritDoc} @Override public UnixUser owningUser(EntityManager em) { return null; // TODO: no access yet } }