]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 02:54:01 +0000 (04:54 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 02:54:01 +0000 (04:54 +0200)
- moved DayOfTheWeek to jcore-utils.jar

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/jobposition/status/JobPositionStatus.java
src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java
src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java
src/org/mxchange/jcontactsbusiness/model/opening_time/dayofweek/DayOfTheWeek.java [deleted file]

index 59b5bb52fb00fda7d8c58b397fcbb3a0e22bedb5..f2025f0b2bd9c56e13c8e980edee6e1566d0ba0f 100644 (file)
@@ -65,6 +65,21 @@ public enum JobPositionStatus {
         * @param styleClass CSS class
         */
        private JobPositionStatus (final String messageKey, final String styleClass) {
+               // Validate parameter
+               if (null == messageKey) {
+                       // Throw NPE
+                       throw new NullPointerException("messageKey is null"); //NOI18N
+               } else if (messageKey.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("messageKey is empty"); //NOI18N
+               } else if (null == styleClass) {
+                       // Throw NPE
+                       throw new NullPointerException("styleClass is null"); //NOI18N
+               } else if (styleClass.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("styleClass is empty"); //NOI18N
+               }
+
                // Set all
                this.messageKey = messageKey;
                this.styleClass = styleClass;
index 86a238f6ea7f6d801adc02c60e9047edad62a486..8617551903a9e4326234ed0bd8c7ba95aa257566 100644 (file)
@@ -32,8 +32,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
-import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
 import org.mxchange.jcoreutils.Comparables;
+import org.mxchange.jcoreutils.dayoftheweek.DayOfTheWeek;
 
 /**
  * A POJO for business opening hours
index 3b8e4554894f4ce00940f6017f340d95af7f3e81..e906d473cb00e93ebea06209d7584433060062e8 100644 (file)
@@ -18,7 +18,7 @@ package org.mxchange.jcontactsbusiness.model.opening_time;
 
 import java.io.Serializable;
 import java.util.Date;
-import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
+import org.mxchange.jcoreutils.dayoftheweek.DayOfTheWeek;
 
 /**
  * A POJI for opening times
diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_time/dayofweek/DayOfTheWeek.java b/src/org/mxchange/jcontactsbusiness/model/opening_time/dayofweek/DayOfTheWeek.java
deleted file mode 100644 (file)
index 1640463..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.model.opening_time.dayofweek;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-/**
- * An enumeration suitable for persisting
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public enum DayOfTheWeek {
-       SUNDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.SUNDAY;
-               }
-
-       },
-       MONDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.MONDAY;
-               }
-       },
-       TUESDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.TUESDAY;
-               }
-       },
-       WEDNESDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.WEDNESDAY;
-               }
-       },
-       THURSDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.THURSDAY;
-               }
-       },
-       FRIDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.FRIDAY;
-               }
-       },
-       SATURDAY {
-               @Override
-               public int toCalendar () {
-                       return Calendar.SATURDAY;
-               }
-       };
-
-       public abstract int toCalendar ();
-
-       public static DayOfTheWeek fromCalendarDay (final int day) {
-
-               for (DayOfTheWeek dayOfWeek : DayOfTheWeek.values()) {
-                       if (dayOfWeek.toCalendar() == day) {
-                               return dayOfWeek;
-                       }
-               }
-
-               return null; // Consider throwing IllegalArgumentException
-       }
-
-       public static DayOfTheWeek getByDate (final Date date) {
-               Calendar calendar = GregorianCalendar.getInstance();
-               calendar.setTime(date);
-               return fromCalendarDay(calendar.get(Calendar.DAY_OF_WEEK));
-       }
-
-       /*
-        * Should return the localized day of the week
-        */
-       @Override
-       public String toString () {
-               Calendar c = new GregorianCalendar();
-               c.set(Calendar.DAY_OF_WEEK, this.toCalendar());
-               SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat
-                                                .getInstance();
-               sdf.applyPattern("EEEEEEEEEE"); //NOI18N
-
-               return sdf.format(c.getTime());
-       }
-
-}