package com.pinecone.technology.mcommerce.learning.android.chapter06.example.dao;
import com.pinecone.technology.mcommerce.learning.android.chapter06.example.dao.DaoSession;
import de.greenrobot.dao.DaoException;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table CUSTOMER.
*/
public class Customer {
private Long id;
/** Not-null value. */
private String FirstName;
/** Not-null value. */
private String LastName;
private String Company;
private String Address;
private String City;
private String State;
private String Country;
private String PostalCode;
private String Phone;
private String Fax;
/** Not-null value. */
private String Email;
private Long SupportRepId;
/** Used to resolve relations */
private transient DaoSession daoSession;
/** Used for active entity operations. */
private transient CustomerDao myDao;
private Employee employee;
private Long employee__resolvedKey;
public Customer() {
}
public Customer(Long id) {
this.id = id;
}
public Customer(Long id, String FirstName, String LastName, String Company, String Address, String City, String State, String Country, String PostalCode, String Phone, String Fax, String Email, Long SupportRepId) {
this.id = id;
this.FirstName = FirstName;
this.LastName = LastName;
this.Company = Company;
this.Address = Address;
this.City = City;
this.State = State;
this.Country = Country;
this.PostalCode = PostalCode;
this.Phone = Phone;
this.Fax = Fax;
this.Email = Email;
this.SupportRepId = SupportRepId;
}
/** called by internal mechanisms, do not call yourself. */
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getCustomerDao() : null;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/** Not-null value. */
public String getFirstName() {
return FirstName;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setFirstName(String FirstName) {
this.FirstName = FirstName;
}
/** Not-null value. */
public String getLastName() {
return LastName;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setLastName(String LastName) {
this.LastName = LastName;
}
public String getCompany() {
return Company;
}
public void setCompany(String Company) {
this.Company = Company;
}
public String getAddress() {
return Address;
}
public void setAddress(String Address) {
this.Address = Address;
}
public String getCity() {
return City;
}
public void setCity(String City) {
this.City = City;
}
public String getState() {
return State;
}
public void setState(String State) {
this.State = State;
}
public String getCountry() {
return Country;
}
public void setCountry(String Country) {
this.Country = Country;
}
public String getPostalCode() {
return PostalCode;
}
public void setPostalCode(String PostalCode) {
this.PostalCode = PostalCode;
}
public String getPhone() {
return Phone;
}
public void setPhone(String Phone) {
this.Phone = Phone;
}
public String getFax() {
return Fax;
}
public void setFax(String Fax) {
this.Fax = Fax;
}
/** Not-null value. */
public String getEmail() {
return Email;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setEmail(String Email) {
this.Email = Email;
}
public Long getSupportRepId() {
return SupportRepId;
}
public void setSupportRepId(Long SupportRepId) {
this.SupportRepId = SupportRepId;
}
/** To-one relationship, resolved on first access. */
public Employee getEmployee() {
Long __key = this.SupportRepId;
if (employee__resolvedKey == null || !employee__resolvedKey.equals(__key)) {
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
EmployeeDao targetDao = daoSession.getEmployeeDao();
Employee employeeNew = targetDao.load(__key);
synchronized (this) {
employee = employeeNew;
employee__resolvedKey = __key;
}
}
return employee;
}
public void setEmployee(Employee employee) {
synchronized (this) {
this.employee = employee;
SupportRepId = employee == null ? null : employee.getId();
employee__resolvedKey = SupportRepId;
}
}
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
public void delete() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.delete(this);
}
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.update(this);
}
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
public void refresh() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.refresh(this);
}
}