/*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016 Roland Haeder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
package org.mxchange.jcontactsbusiness;
+import java.util.Calendar;
import java.util.List;
import java.util.Objects;
+import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
import org.mxchange.jcontactsbusiness.branch.BranchOffice;
-import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
import org.mxchange.jcontactsbusiness.employee.CompanyEmployee;
import org.mxchange.jcontactsbusiness.employee.Employee;
import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData;
import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
/**
* A POJO for business contacts
private BusinessBasicData basicBusinessData;
/**
- * Reference to employee branches
+ * Reference to company branch offfices
*/
- @JoinColumn (name = "company_branches_id", nullable = false, updatable = false)
- @OneToMany (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
- private List<BranchOffice> branches;
+ @Transient
+ private List<BranchOffice> brancheOffices;
/**
* Reference to contact person
private Employee companyFounder;
/**
- * Reference to employee list
+ * Timestamp when this entry has been created
*/
- @JoinColumn (name = "company_employees_id", nullable = false, updatable = false)
- @OneToMany (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
- private List<Employee> employees;
+ @Basic (optional = false)
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "company_entry_created", nullable = false, updatable = false)
+ private Calendar contactCreated;
+
+ /**
+ * User owner instance
+ */
+ @JoinColumn (name = "company_user_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.MERGE, optional = false)
+ private User contactUserOwner;
/**
* Reference to headquarters data
}
@Override
- public List<BranchOffice> getBranches () {
- return this.branches;
+ public List<BranchOffice> getBrancheOffices () {
+ return this.brancheOffices;
}
@Override
- public void setBranches (final List<BranchOffice> branches) {
- this.branches = branches;
+ public void setBrancheOffices (final List<BranchOffice> brancheOffices) {
+ this.brancheOffices = brancheOffices;
}
@Override
}
@Override
- public List<Employee> getEmployees () {
- return this.employees;
+ public Calendar getContactCreated () {
+ return this.contactCreated;
+ }
+
+ @Override
+ public void setContactCreated (final Calendar contactCreated) {
+ this.contactCreated = contactCreated;
+ }
+
+ @Override
+ public User getContactUserOwner () {
+ return this.contactUserOwner;
}
@Override
- public void setEmployees (final List<Employee> employees) {
- this.employees = employees;
+ public void setContactUserOwner (final User contactUserOwner) {
+ this.contactUserOwner = contactUserOwner;
}
@Override