From: Roland Haeder Date: Thu, 7 Apr 2016 09:23:51 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ad7fc179282872e34c096d1521b05874cbe0dc33;p=jcontacts-business-core.git Continued a bit: - added POJO/POJI for opening times - size only applies for strings, no need here (cleanup) - updated jar(s) --- diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index 6c00138..59559ef 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/jcountry-core.jar b/lib/jcountry-core.jar index 49be2e4..01a8041 100644 Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ diff --git a/lib/jphone-core.jar b/lib/jphone-core.jar index c997cec..be67aae 100644 Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 7a5f4c5..5d51db1 100644 Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ diff --git a/src/org/mxchange/jcontactsbusiness/CompanyContact.java b/src/org/mxchange/jcontactsbusiness/CompanyContact.java index 3642930..aed29bb 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyContact.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyContact.java @@ -80,7 +80,7 @@ public class CompanyContact implements BusinessContact { * Id number */ @Id - @Column (name = "company_id", length = 20, nullable = false, updatable = false) + @Column (name = "company_id", nullable = false, updatable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) private Long companyContactId; diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java index ca92223..fcae00a 100644 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -73,7 +73,7 @@ public class CompanyBasicData implements BusinessBasicData { * Id number */ @Id - @Column (name = "company_basic_id", length = 20, nullable = false, updatable = false) + @Column (name = "company_basic_id", nullable = false, updatable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) private Long companyBasicId; @@ -101,7 +101,7 @@ public class CompanyBasicData implements BusinessBasicData { * Legal status of company (example: "Inc.", "GmbH") */ @Basic (optional = false) - @Column (name = "company_legal_status", length = 20, nullable = false) + @Column (name = "company_legal_status", nullable = false) private String companyLegalStatus; /** diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index 062b781..f6126f2 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -108,7 +108,7 @@ public class CompanyBranchOffice implements BranchOffice { */ @Id @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "branch_id", length = 20, nullable = false, updatable = false) + @Column (name = "branch_id", nullable = false, updatable = false) private Long branchId; /** diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java index 2ef7040..093d9c4 100644 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java @@ -90,7 +90,7 @@ public class CompanyDepartment implements Department { */ @Id @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "department_id", length = 20, nullable = false, updatable = false) + @Column (name = "department_id", nullable = false, updatable = false) private Long departmentId; /** diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index 3b33f6c..221d481 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -107,7 +107,7 @@ public class CompanyEmployee implements Employee { * Id number */ @Id - @Column (name = "employee_id", length = 20, nullable = false, updatable = false) + @Column (name = "employee_id", nullable = false, updatable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) private Long employeeId; @@ -310,4 +310,5 @@ public class CompanyEmployee implements Employee { public void setEmployeeUserOwner (final User employeeUserOwner) { this.employeeUserOwner = employeeUserOwner; } + } diff --git a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java index 87166fe..190b973 100644 --- a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java +++ b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java @@ -94,7 +94,7 @@ public class CompanyHeadQuartersData implements HeadQuartersData { */ @Id @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false) + @Column (name = "headquarters_id", nullable = false, updatable = false) private Long headquartersId; /** diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java index 6ebfcb9..29d013b 100644 --- a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java +++ b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java @@ -61,14 +61,14 @@ public class EmployeePosition implements JobPosition { */ @Id @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "job_position_id", length = 20, nullable = false, updatable = false) + @Column (name = "job_position_id", nullable = false, updatable = false) private Long jobPositionId; /** * Name/description of the job position (example: CEO) */ @Basic (optional = false) - @Column (name = "job_position_name", length = 20, nullable = false, unique = true) + @Column (name = "job_position_name", nullable = false, unique = true) private String jobPositionName; @Override diff --git a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java index 3b98382..447af3f 100644 --- a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java +++ b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java @@ -67,7 +67,7 @@ public class CompanyLogo implements BusinessLogo { */ @Id @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "logo_id", length = 20, nullable = false, updatable = false) + @Column (name = "logo_id", nullable = false, updatable = false) private Long logoId; /** diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java b/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java new file mode 100644 index 0000000..e030964 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java @@ -0,0 +1,177 @@ +/* + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.opening_times; + +import java.time.DayOfWeek; +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * A POJO for business opening hours + *

+ * @author Roland Haeder + */ +@Entity (name = "opening_times") +@Table (name = "opening_times") +public class BusinessOpeningTimes implements OpeningTimes { + + /** + * Serial number + */ + private static final long serialVersionUID = 19_578_871_756_871L; + + /** + * Ending day of opening hours (if applyable) + */ + @Column (name = "opening_times_end_day") + @Enumerated (EnumType.STRING) + private DayOfWeek endDay; + + /** + * Ending time (hh:mm) + */ + @Basic (optional = false) + @Column (name = "opening_times_end_time") + @Temporal (TemporalType.TIME) + private Calendar endTime; + + /** + * Id number + */ + @Id + @Column (name = "opening_times_id", nullable = false, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long id; + + /** + * Starting day of opening times + */ + @Basic (optional = false) + @Column (name = "opening_times_start_day", nullable = false) + @Enumerated (EnumType.STRING) + private DayOfWeek startDay; + + /** + * Starting time (hh:mm) + */ + @Basic (optional = false) + @Column (name = "opening_times_start_time") + @Temporal (TemporalType.TIME) + private Calendar startTime; + + @Override + public boolean equals (final Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } + + final OpeningTimes openingTimes = (OpeningTimes) obj; + + if (!Objects.equals(this.getId(), openingTimes.getId())) { + return false; + } else if (this.getStartDay() != openingTimes.getStartDay()) { + return false; + } else if (this.getEndDay() != openingTimes.getEndDay()) { + return false; + } else if (!Objects.equals(this.getStartTime(), openingTimes.getStartTime())) { + return false; + } else if (!Objects.equals(this.getEndTime(), openingTimes.getEndTime())) { + return false; + } + + return true; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 97 * hash + Objects.hashCode(this.getId()); + hash = 97 * hash + Objects.hashCode(this.getStartDay()); + hash = 97 * hash + Objects.hashCode(this.getEndDay()); + hash = 97 * hash + Objects.hashCode(this.getStartTime()); + hash = 97 * hash + Objects.hashCode(this.getEndTime()); + + return hash; + } + + @Override + public DayOfWeek getEndDay () { + return this.endDay; + } + + @Override + public void setEndDay (final DayOfWeek endDay) { + this.endDay = endDay; + } + + @Override + public Calendar getEndTime () { + return this.endTime; + } + + @Override + public void setEndTime (final Calendar endTime) { + this.endTime = endTime; + } + + @Override + public Long getId () { + return this.id; + } + + @Override + public void setId (Long id) { + this.id = id; + } + + @Override + public DayOfWeek getStartDay () { + return this.startDay; + } + + @Override + public void setStartDay (final DayOfWeek startDay) { + this.startDay = startDay; + } + + @Override + public Calendar getStartTime () { + return this.startTime; + } + + @Override + public void setStartTime (final Calendar startTime) { + this.startTime = startTime; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java b/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java new file mode 100644 index 0000000..5b6c3fe --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/opening_times/OpeningTimes.java @@ -0,0 +1,106 @@ +/* + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.opening_times; + +import java.io.Serializable; +import java.time.DayOfWeek; +import java.util.Calendar; + +/** + * A POJI for opening times + * + * @author Roland Haeder + */ +public interface OpeningTimes extends Serializable { + + /** + * Getter for id number + *

+ * @return Id number + */ + Long getId (); + + /** + * Setter for id number + *

+ * @param id Id number + */ + void setId (final Long id); + + /** + * Getter for starting day + *

+ * @return Starting day + */ + DayOfWeek getStartDay (); + + /** + * Setter for starting day + *

+ * @param startDay Starting day + */ + void setStartDay (final DayOfWeek startDay); + + /** + * Getter for ending day + *

+ * @return Ending day + */ + DayOfWeek getEndDay (); + + /** + * Setter for ending day + *

+ * @param endDay Ending day + */ + void setEndDay (final DayOfWeek endDay); + + /** + * Getter for starting time + *

+ * @return Starting time + */ + Calendar getStartTime (); + + /** + * Setter for starting time + *

+ * @param startTime Starting time + */ + void setStartTime (final Calendar startTime); + + /** + * Getter for ending time + *

+ * @return Ending time + */ + Calendar getEndTime (); + + /** + * Setter for ending time + *

+ * @param endTime Ending time + */ + void setEndTime (final Calendar endTime); + + @Override + boolean equals (final Object obj); + + @Override + int hashCode (); + +}