]> git.mxchange.org Git - jcontacts-business-core.git/blobdiff - src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java
added constructors and made endTime/startTime not nullable
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / opening_times / BusinessOpeningTimes.java
index e030964db2dc12199494610d90ae299c7c23b957..f11ea40ec95be4df47306b81c9b1b52a1b84308c 100644 (file)
@@ -36,8 +36,8 @@ import javax.persistence.TemporalType;
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
-@Entity (name = "opening_times")
-@Table (name = "opening_times")
+@Entity (name = "company_opening_times")
+@Table (name = "company_opening_times")
 public class BusinessOpeningTimes implements OpeningTimes {
 
        /**
@@ -56,7 +56,7 @@ public class BusinessOpeningTimes implements OpeningTimes {
         * Ending time (hh:mm)
         */
        @Basic (optional = false)
-       @Column (name = "opening_times_end_time")
+       @Column (name = "opening_times_end_time", nullable = false)
        @Temporal (TemporalType.TIME)
        private Calendar endTime;
 
@@ -80,10 +80,49 @@ public class BusinessOpeningTimes implements OpeningTimes {
         * Starting time (hh:mm)
         */
        @Basic (optional = false)
-       @Column (name = "opening_times_start_time")
+       @Column (name = "opening_times_start_time", nullable = false)
        @Temporal (TemporalType.TIME)
        private Calendar startTime;
 
+       /**
+        * Default constructor
+        */
+       public BusinessOpeningTimes () {
+       }
+
+       /**
+        * Constructor with all field
+        * <p>
+        * @param endDay    End day
+        * @param endTime   End time
+        * @param id        Id number
+        * @param startDay  Start day
+        * @param startTime Start time
+        */
+       public BusinessOpeningTimes (final DayOfWeek endDay, final Calendar endTime, final Long id, final DayOfWeek startDay, final Calendar startTime) {
+               // Call other constructor
+               this(endDay, endTime, startDay, startTime);
+
+               // Set id number
+               this.id = id;
+       }
+
+       /**
+        * Constructor with all fields except id number
+        * <p>
+        * @param endDay    End day
+        * @param endTime   End time
+        * @param startDay  Start day
+        * @param startTime Start time
+        */
+       public BusinessOpeningTimes (final DayOfWeek endDay, final Calendar endTime, final DayOfWeek startDay, final Calendar startTime) {
+               // Set all fields
+               this.endDay = endDay;
+               this.endTime = endTime;
+               this.startDay = startDay;
+               this.startTime = startTime;
+       }
+
        @Override
        public boolean equals (final Object obj) {
                if (this == obj) {