package org.mxchange.jcontactsbusiness.model.headquarters;
import java.util.Date;
+import java.util.List;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jcountry.model.data.CountryData;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jusercore.model.user.User;
/**
- * A POJO for company headquarts data
+ * A POJO for company headquarters data
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
@Column (name = "headquarters_city", length = 100, nullable = false)
private String headquartersCity;
+ /**
+ * Reference to contact person
+ */
+ @JoinColumn (name = "headquarters_contact_employee_id", referencedColumnName = "employee_id")
+ @OneToOne (targetEntity = BusinessEmployee.class, cascade = CascadeType.REFRESH)
+ private Employable headquartersContactEmployee;
+
/**
* Headquarter's country code
*/
@Column (name = "headquarters_id", nullable = false, updatable = false)
private Long headquartersId;
+ /**
+ * Opening times for this branch office
+ */
+ @JoinTable (name = "headquarters_opening_times", joinColumns = @JoinColumn (name = "headquarters_opening_id", referencedColumnName = "branch_id"), inverseJoinColumns = @JoinColumn (name = "opening_headquarters_id", referencedColumnName = "opening_times_id"))
+ @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.ALL)
+ private List<OpeningTime> headquartersOpeningTimes;
+
/**
* Headquarters' phone number
*/
/**
* User owner instance
*/
- @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+ @JoinColumn (name = "headquarters_user_id")
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
private User headquartersUserOwner;
/**
this.headquartersCity = headquartersCity;
}
+ @Override
+ public Employable getHeadquartersContactEmployee () {
+ return this.headquartersContactEmployee;
+ }
+
+ @Override
+ public void setHeadquartersContactEmployee (final Employable headquartersContactEmployee) {
+ this.headquartersContactEmployee = headquartersContactEmployee;
+ }
+
@Override
public Country getHeadquartersCountry () {
return this.headquartersCountry;
this.headquartersId = headquartersId;
}
+ @Override
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<OpeningTime> getHeadquartersOpeningTimes () {
+ return this.headquartersOpeningTimes;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+ public void setHeadquartersOpeningTimes (final List<OpeningTime> headquartersOpeningTimes) {
+ this.headquartersOpeningTimes = headquartersOpeningTimes;
+ }
+
@Override
public DialableLandLineNumber getHeadquartersPhoneNumber () {
return this.headquartersPhoneNumber;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
*/
void setHeadquartersUserOwner (final User headquartersUserOwner);
+ /**
+ * Getter for branch office owning employee
+ * <p>
+ * @return Owning employee
+ */
+ Employable getHeadquartersContactEmployee ();
+
+ /**
+ * Setter for branch office contact person
+ * <p>
+ * @param branchContactEmployee Contact person
+ */
+ void setHeadquartersContactEmployee (final Employable branchContactEmployee);
+
+ /**
+ * Getter for opening times for this branch office
+ * <p>
+ * @return Opening times
+ */
+ List<OpeningTime> getHeadquartersOpeningTimes ();
+
+ /**
+ * Setter for opening times for this branch office
+ * <p>
+ * @param branchOpeningTimes Opening times
+ */
+ void setHeadquartersOpeningTimes (final List<OpeningTime> branchOpeningTimes);
+
/**
* Getter for timestamp when this entry has been created
* <p>