From: Roland Häder Date: Sun, 10 Sep 2017 14:44:09 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ae9626e73146846f5bba194f2316ac9d41aae43f;p=jphone-core.git Continued: - moved model-related classes/interfaces to own 'model' package Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java index cfa093c..351d95e 100644 --- a/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java +++ b/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.fax.created; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An event being fired when a fax number instance has been successfully diff --git a/src/org/mxchange/jphone/events/fax/created/ObservableCreatedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/created/ObservableCreatedFaxNumberEvent.java index dff42a0..4e22408 100644 --- a/src/org/mxchange/jphone/events/fax/created/ObservableCreatedFaxNumberEvent.java +++ b/src/org/mxchange/jphone/events/fax/created/ObservableCreatedFaxNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.fax.created; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An event being fired when a fax number instance has been successfully diff --git a/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java index 128641f..08935d8 100644 --- a/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java +++ b/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.fax.deleted; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An interface for an event when a fax number has been deleted diff --git a/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java b/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java index 085e6af..f48b517 100644 --- a/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.fax.deleted; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An event when a land-line number has been deleted diff --git a/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java index d3862b6..882f10d 100644 --- a/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.fax.removed; import java.util.List; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An event when a mobile number list needs been cleared diff --git a/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java b/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java index 4eebc28..3742ed0 100644 --- a/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java +++ b/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java @@ -18,7 +18,7 @@ package org.mxchange.jphone.events.fax.removed; import java.io.Serializable; import java.util.List; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An interface for an event when a list needs to be cleared from fax diff --git a/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java index 436c67a..84379b8 100644 --- a/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.fax.updated; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An event when a fax number has been updated diff --git a/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java index 940f575..b31a291 100644 --- a/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java +++ b/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.fax.updated; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** * An interface for an event when a fax number has been updated diff --git a/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java index 981e43f..73809e0 100644 --- a/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java +++ b/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.landline.created; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event being fired when a land-line number instance has been successfully diff --git a/src/org/mxchange/jphone/events/landline/created/ObservableCreatedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/created/ObservableCreatedLandLineNumberEvent.java index 70f9d20..1fa6cb1 100644 --- a/src/org/mxchange/jphone/events/landline/created/ObservableCreatedLandLineNumberEvent.java +++ b/src/org/mxchange/jphone/events/landline/created/ObservableCreatedLandLineNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.landline.created; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event being fired when a land-line number instance has been successfully diff --git a/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java index a0848d5..bf46e23 100644 --- a/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java +++ b/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.landline.deleted; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An interface for an event when a land-line number has been deleted diff --git a/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java b/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java index 3d80354..0e39428 100644 --- a/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.landline.deleted; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event when a land-line number has been deleted diff --git a/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java index fab1989..a1d1795 100644 --- a/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.landline.removed; import java.util.List; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event when a mobile number list needs been cleared diff --git a/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java b/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java index aa342c6..123a021 100644 --- a/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java +++ b/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java @@ -18,7 +18,7 @@ package org.mxchange.jphone.events.landline.removed; import java.io.Serializable; import java.util.List; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An interface for an event when a list needs to be cleared from land-line diff --git a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java index 152eb65..ec76cef 100644 --- a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.landline.updated; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event when a mobile number has been updated diff --git a/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java index a6e68c9..596273d 100644 --- a/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java +++ b/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.landline.updated; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An interface for an event when a land-line number has been updated diff --git a/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java index bd28112..6100407 100644 --- a/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java +++ b/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.mobile.created; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An event being fired when a mobile number instance has been successfully diff --git a/src/org/mxchange/jphone/events/mobile/created/ObservableCreatedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/created/ObservableCreatedMobileNumberEvent.java index f72c9fe..9b56e6f 100644 --- a/src/org/mxchange/jphone/events/mobile/created/ObservableCreatedMobileNumberEvent.java +++ b/src/org/mxchange/jphone/events/mobile/created/ObservableCreatedMobileNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.mobile.created; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An event being fired when a mobile number instance has been successfully diff --git a/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java index 85d0218..f3d4f7c 100644 --- a/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java +++ b/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.mobile.deleted; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An interface for an event when a mobile number has been deleted diff --git a/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java b/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java index f74ed6c..75196c3 100644 --- a/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.mobile.deleted; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An event when a mobile number has been deleted diff --git a/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java index 1ba5d45..51ac32a 100644 --- a/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.mobile.remove; import java.util.List; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An event when a mobile number list needs been cleared diff --git a/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java b/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java index 25ec85e..9ef0c0c 100644 --- a/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java +++ b/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java @@ -18,7 +18,7 @@ package org.mxchange.jphone.events.mobile.remove; import java.io.Serializable; import java.util.List; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An interface for an event when a list needs to be cleared from mobile diff --git a/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java index dd75f83..72e05e7 100644 --- a/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.mobile.updated; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An event when a mobile number has been updated diff --git a/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java index 3e2b32a..5572fcd 100644 --- a/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java +++ b/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.mobile.updated; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An interface for an event when a mobile number has been updated diff --git a/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java b/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java index f5d3817..0345584 100644 --- a/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java +++ b/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.events.mobileprovider.added; import java.io.Serializable; -import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; /** * An interface for an event when a new mobile provider has been added. @@ -32,4 +32,5 @@ public interface AdminAddedMobileProviderEvent extends Serializable { * @return Added mobile provider */ MobileProvider getAddedMobileProvider (); + } diff --git a/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java b/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java index 3c47694..5a82602 100644 --- a/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java +++ b/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java @@ -16,7 +16,7 @@ */ package org.mxchange.jphone.events.mobileprovider.added; -import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; /** * An event when a new mobile provider has been added diff --git a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java index 2e5bedf..18477fd 100644 --- a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java +++ b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.exceptions; import java.text.MessageFormat; -import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; /** * An exception thrown when the mobile provider is already added. This should be diff --git a/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java b/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java index 3311e1f..2b2f278 100644 --- a/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java +++ b/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java @@ -17,9 +17,9 @@ package org.mxchange.jphone.exceptions; import java.text.MessageFormat; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An exception thrown when a fax, land-line or mobile number is not linked but diff --git a/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java b/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java index ea9b56f..7d12f65 100644 --- a/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java +++ b/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java @@ -17,9 +17,9 @@ package org.mxchange.jphone.exceptions; import java.text.MessageFormat; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** * An exception thrown when a fax, land-line or mobile number is not linked but diff --git a/src/org/mxchange/jphone/model/phonenumbers/DialableNumber.java b/src/org/mxchange/jphone/model/phonenumbers/DialableNumber.java new file mode 100644 index 0000000..7fea4a8 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/DialableNumber.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcountry.model.data.Country; + +/** + * A POJI for dial-able numbers + *

+ * @author Roland Häder + */ +public interface DialableNumber extends Serializable { + + /** + * Getter for country instance ('s dial data) + *

+ * @return Country instance + */ + Country getPhoneCountry (); + + /** + * Setter for country instance ('s dial data) + *

+ * @param country Country instance + */ + void setPhoneCountry (final Country country); + + /** + * Getter for id number + *

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

+ * @param phoneId Id number + */ + void setPhoneId (final Long phoneId); + + /** + * Getter for dial number without prefix + *

+ * @return Dial number without prefix + */ + Long getPhoneNumber (); + + /** + * Setter for dial number without prefix + *

+ * @param phoneNumber Dial number without prefix + */ + void setPhoneNumber (final Long phoneNumber); + + /** + * Getter for area code without dial prefix (example: 2151 for Krefeld) + *

+ * @return Area code without dial prefix + */ + Integer getPhoneAreaCode (); + + /** + * Setter for area code without dial prefix (example: 2151 for Krefeld) + *

+ * @param phoneAreaCode Area code without dial prefix + */ + void setPhoneAreaCode (final Integer phoneAreaCode); + + /** + * Getter for timestamp when this entry has been created + *

+ * @return Timestamp when this entry has been created + */ + Calendar getPhoneEntryCreated (); + + /** + * Setter for timestamp when this entry has been created + *

+ * @param phoneEntryCreated Timestamp when this entry has been created + */ + void setPhoneEntryCreated (final Calendar phoneEntryCreated); + + /** + * Getter for timestamp when this entry has been updated + *

+ * @return Timestamp when this entry has been updated + */ + Calendar getPhoneEntryUpdated (); + + /** + * Setter for timestamp when this entry has been updated + *

+ * @param phoneEntryUpdated Timestamp when this entry has been updated + */ + void setPhoneEntryUpdated (final Calendar phoneEntryUpdated); + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java b/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java new file mode 100644 index 0000000..9d3c552 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.fax; + +import org.mxchange.jphone.model.phonenumbers.DialableNumber; + +/** + * A POJI for dialable fax numbers + *

+ * @author Roland Häder + */ +public interface DialableFaxNumber extends DialableNumber { + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java new file mode 100644 index 0000000..d189e89 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.fax; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; + +/** + * A POJO for dialable fax numbers + *

+ * @author Roland Häder + */ +@Entity (name = "fax_numbers") +@Table (name = "fax_numbers") +@NamedQueries ( + { + @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC"), + @NamedQuery (name = "SearchFaxNumberId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxNumberId") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class FaxNumber implements DialableFaxNumber { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 17_687_687_191_375L; + + /** + * Area code (example: 2151 for Krefeld) + */ + @Basic (optional = false) + @Column (name = "fax_area_code", length = 10, nullable = false) + private Integer faxAreaCode; + + /** + * Country instance ('s dial data) + */ + @JoinColumn (name = "fax_country_id", nullable = false) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) + private Country faxCountry; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "fax_entry_created", nullable = false, updatable = false) + private Calendar phoneEntryCreated; + + /** + * Timestamp when this entry has been created + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "phone_entry_updated", updatable = false) + private Calendar phoneEntryUpdated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "fax_id", nullable = false, updatable = false) + private Long phoneId; + + /** + * Fax number without prefix + */ + @Basic (optional = false) + @Column (name = "fax_number", nullable = false) + private Long phoneNumber; + + /** + * Default constructor + */ + public FaxNumber () { + } + + /** + * Constructor with country, area code and number + *

+ * @param faxCountry Country instance + * @param faxAreaCode Area code (without leading zeros) + * @param faxNumber Fax number (without area code and leading zero) + */ + public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) { + // Call default constructor + this(); + + // Set all values + this.faxCountry = faxCountry; + this.faxAreaCode = faxAreaCode; + this.phoneNumber = faxNumber; + } + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final DialableFaxNumber other = (DialableFaxNumber) object; + + if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + return false; + } else if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + return false; + } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { + return false; + } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { + return false; + } + + return true; + } + + @Override + public Integer getPhoneAreaCode () { + return this.faxAreaCode; + } + + @Override + public void setPhoneAreaCode (final Integer faxAreaCode) { + this.faxAreaCode = faxAreaCode; + } + + @Override + public Country getPhoneCountry () { + return this.faxCountry; + } + + @Override + public void setPhoneCountry (final Country faxCountry) { + this.faxCountry = faxCountry; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryCreated () { + return this.phoneEntryCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { + this.phoneEntryCreated = phoneEntryCreated; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryUpdated () { + return this.phoneEntryUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { + this.phoneEntryUpdated = phoneEntryUpdated; + } + + @Override + public Long getPhoneId () { + return this.phoneId; + } + + @Override + public void setPhoneId (final Long phoneId) { + this.phoneId = phoneId; + } + + @Override + public Long getPhoneNumber () { + return this.phoneNumber; + } + + @Override + public void setPhoneNumber (final Long phoneNumber) { + this.phoneNumber = phoneNumber; + } + + @Override + public int hashCode () { + int hash = 3; + + hash = 23 * hash + Objects.hashCode(this.getPhoneId()); + hash = 23 * hash + Objects.hashCode(this.getPhoneNumber()); + hash = 23 * hash + Objects.hashCode(this.getPhoneAreaCode()); + hash = 23 * hash + Objects.hashCode(this.getPhoneCountry()); + + return hash; + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java new file mode 100644 index 0000000..2fd3cc5 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.fax; + +import java.io.Serializable; + +/** + * An utilities class for fax numbers + *

+ * @author Roland Häder + */ +public class FaxNumbers implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 1_948_653_672_761L; + + /** + * Copy all fields from source object to this + *

+ * @param sourceNumber Source number object + * @param targetNumber Target number object + */ + public static void copyAll (final DialableFaxNumber sourceNumber, final DialableFaxNumber targetNumber) { + // Validate instance + if (null == sourceNumber) { + // Throw NPE + throw new NullPointerException("sourceNumber is null"); //NOI18N + } else if (null == targetNumber) { + // Throw NPE + throw new NullPointerException("targetNumber is null"); //NOI18N + } + + // Copy all + targetNumber.setPhoneAreaCode(sourceNumber.getPhoneAreaCode()); + targetNumber.setPhoneCountry(sourceNumber.getPhoneCountry()); + targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); + targetNumber.setPhoneId(sourceNumber.getPhoneId()); + targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); + } + + /** + * No constructor for utilities classes + */ + private FaxNumbers () { + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java b/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java new file mode 100644 index 0000000..1666db7 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.landline; + +import org.mxchange.jphone.model.phonenumbers.DialableNumber; + +/** + * A POJI for dialable land-line numbers + *

+ * @author Roland Häder + */ +public interface DialableLandLineNumber extends DialableNumber { + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java new file mode 100644 index 0000000..40f7117 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.landline; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; + +/** + * A POJO for dialable phone numbers + *

+ * @author Roland Häder + */ +@Entity (name = "landline_numbers") +@Table (name = "landline_numbers") +@NamedQueries ( + { + @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM landline_numbers AS p ORDER BY p.phoneId ASC"), + @NamedQuery (name = "SearchLandLineNumberId", query = "SELECT p FROM landline_numbers AS p WHERE p.phoneId = :landLineNumberId") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class LandLineNumber implements DialableLandLineNumber { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 18_563_748_781_956L; + + /** + * Area code (example: 2151 for Krefeld) + */ + @Basic (optional = false) + @Column (name = "landline_area_code", length = 10, nullable = false) + private Integer phoneAreaCode; + + /** + * Connection to table "country_data" + */ + @JoinColumn (name = "landline_country_id", nullable = false, updatable = false) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) + private Country phoneCountry; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "landline_entry_created", nullable = false, updatable = false) + private Calendar phoneEntryCreated; + + /** + * Timestamp when this entry has been created + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "landline_entry_updated", updatable = false) + private Calendar phoneEntryUpdated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "landline_id", length = 10, nullable = false, updatable = false) + private Long phoneId; + + /** + * Phone number with out dial prefix + */ + @Basic (optional = false) + @Column (name = "landline_number", nullable = false) + private Long phoneNumber; + + /** + * Default constructor + */ + public LandLineNumber () { + } + + /** + * Constructor with country instance, area code and number + *

+ * @param phoneCountry Country instance + * @param phoneAreaCode Phone area code + * @param phoneNumber Phone number + */ + public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) { + // Call default constructor + this(); + + // Set all values + this.phoneCountry = phoneCountry; + this.phoneAreaCode = phoneAreaCode; + this.phoneNumber = phoneNumber; + } + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final DialableLandLineNumber other = (DialableLandLineNumber) object; + + if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + return false; + } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + return false; + } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { + return false; + } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { + return false; + } + + return true; + } + + @Override + public Integer getPhoneAreaCode () { + return this.phoneAreaCode; + } + + @Override + public void setPhoneAreaCode (final Integer phoneAreaCode) { + this.phoneAreaCode = phoneAreaCode; + } + + @Override + public Country getPhoneCountry () { + return this.phoneCountry; + } + + @Override + public void setPhoneCountry (final Country phoneCountry) { + this.phoneCountry = phoneCountry; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryCreated () { + return this.phoneEntryCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { + this.phoneEntryCreated = phoneEntryCreated; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryUpdated () { + return this.phoneEntryUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { + this.phoneEntryUpdated = phoneEntryUpdated; + } + + @Override + public Long getPhoneId () { + return this.phoneId; + } + + @Override + public void setPhoneId (final Long phoneId) { + this.phoneId = phoneId; + } + + @Override + public Long getPhoneNumber () { + return this.phoneNumber; + } + + @Override + public void setPhoneNumber (final Long phoneNumber) { + this.phoneNumber = phoneNumber; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 47 * hash + Objects.hashCode(this.getPhoneId()); + hash = 47 * hash + Objects.hashCode(this.getPhoneNumber()); + hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode()); + hash = 47 * hash + Objects.hashCode(this.getPhoneCountry()); + + return hash; + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java new file mode 100644 index 0000000..e9e70c6 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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 targetNumber program. If not, see . + */ +package org.mxchange.jphone.model.phonenumbers.landline; + +import java.io.Serializable; + +/** + * An utilities class for land-line numbers + *

+ * @author Roland Häder + */ +public class LandLineNumbers implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 18_698_467_372_167_561L; + + /** + * Copy all fields from source object to this + *

+ * @param sourceNumber Source number object + * @param targetNumber Target number object + */ + public static void copyAll (final DialableLandLineNumber sourceNumber, final DialableLandLineNumber targetNumber) { + // Validate instance + if (null == sourceNumber) { + // Throw NPE + throw new NullPointerException("sourceNumber is null"); //NOI18N + } else if (null == targetNumber) { + // Throw NPE + throw new NullPointerException("targetNumber is null"); //NOI18N + } + + // Copy all + targetNumber.setPhoneAreaCode(sourceNumber.getPhoneAreaCode()); + targetNumber.setPhoneCountry(sourceNumber.getPhoneCountry()); + targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); + targetNumber.setPhoneId(sourceNumber.getPhoneId()); + targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); + } + + /** + * No constructor for utilities classes + */ + private LandLineNumbers () { + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java new file mode 100644 index 0000000..abb4632 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.mobile; + +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jphone.model.phonenumbers.DialableNumber; + +/** + * A POJO for dialable mobile numbers with carriers. + *

+ * @author Roland Häder + */ +public interface DialableMobileNumber extends DialableNumber { + + /** + * Getter for mobile provider + *

+ * @return Mobile provider + */ + MobileProvider getMobileProvider (); + + /** + * Setter for mobile provider + *

+ * @param mobileProvider Mobile provider + */ + void setMobileProvider (final MobileProvider mobileProvider); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java new file mode 100644 index 0000000..e8ca760 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.mobile; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.CellphoneProvider; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; + +/** + * A POJO for dialable cellphone numbers + *

+ * @author Roland Häder + */ +@Entity (name = "mobile_numbers") +@Table (name = "mobile_numbers") +@NamedQueries ( + { + @NamedQuery (name = "AllMobileNumbers", query = "SELECT c FROM mobile_numbers AS c ORDER BY c.phoneId ASC"), + @NamedQuery (name = "SearchMobileNumberId", query = "SELECT c FROM mobile_numbers AS c WHERE c.phoneId = :mobileNumberId") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class MobileNumber implements DialableMobileNumber { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 13_859_879_482_106L; + + /** + * Connection to table "mobile_provider" (for dial prefix and more data) + */ + @JoinColumn (name = "mobile_provider_id", nullable = false) + @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.REFRESH, optional = false) + private MobileProvider mobileProvider; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "mobile_entry_created", nullable = false, updatable = false) + private Calendar phoneEntryCreated; + + /** + * Timestamp when this entry has been created + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "mobile_entry_updated", updatable = false) + private Calendar phoneEntryUpdated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "mobile_id", nullable = false, updatable = false) + private Long phoneId; + + /** + * Number without prefix to dial + */ + @Basic (optional = false) + @Column (name = "mobile_number", nullable = false) + private Long phoneNumber; + + /** + * Default constructor + */ + public MobileNumber () { + } + + /** + * Constructor with cellphone provider and number + *

+ * @param mobileProvider Mobile provider + * @param mobileNumber Mobile number + */ + public MobileNumber (final MobileProvider mobileProvider, final Long mobileNumber) { + // Call default constructor + this(); + + // Set all values + this.mobileProvider = mobileProvider; + this.phoneNumber = mobileNumber; + } + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final DialableMobileNumber other = (DialableMobileNumber) object; + + if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + return false; + } else if (!Objects.equals(this.getMobileProvider(), other.getMobileProvider())) { + return false; + } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + return false; + } + + return true; + } + + @Override + public MobileProvider getMobileProvider () { + return this.mobileProvider; + } + + @Override + public void setMobileProvider (final MobileProvider mobileProvider) { + this.mobileProvider = mobileProvider; + } + + @Override + @Deprecated + public Integer getPhoneAreaCode () { + throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N + } + + @Override + @Deprecated + public void setPhoneAreaCode (final Integer phoneAreaCode) { + throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N + } + + @Override + @Deprecated + public Country getPhoneCountry () { + throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + @Deprecated + public void setPhoneCountry (final Country country) { + throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryCreated () { + return this.phoneEntryCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { + this.phoneEntryCreated = phoneEntryCreated; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getPhoneEntryUpdated () { + return this.phoneEntryUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { + this.phoneEntryUpdated = phoneEntryUpdated; + } + + @Override + public Long getPhoneId () { + return this.phoneId; + } + + @Override + public void setPhoneId (final Long phoneId) { + this.phoneId = phoneId; + } + + @Override + public Long getPhoneNumber () { + return this.phoneNumber; + } + + @Override + public void setPhoneNumber (final Long phoneNumber) { + this.phoneNumber = phoneNumber; + } + + @Override + public int hashCode () { + int hash = 5; + + hash = 97 * hash + Objects.hashCode(this.getPhoneId()); + hash = 97 * hash + Objects.hashCode(this.getMobileProvider()); + hash = 97 * hash + Objects.hashCode(this.getPhoneNumber()); + + return hash; + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java new file mode 100644 index 0000000..6c92014 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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 targetNumber program. If not, see . + */ +package org.mxchange.jphone.model.phonenumbers.mobile; + +import java.io.Serializable; + +/** + * An utilities class for mobile numbers + *

+ * @author Roland Häder + */ +public class MobileNumbers implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 291_608_496_882_761L; + + /** + * Copy all fields from source object to this + *

+ * @param sourceNumber Source number object + * @param targetNumber Target number object + */ + public static void copyAll (final DialableMobileNumber sourceNumber, final DialableMobileNumber targetNumber) { + // Validate instance + if (null == sourceNumber) { + // Throw NPE + throw new NullPointerException("sourceNumber is null"); //NOI18N + } else if (null == targetNumber) { + // Throw NPE + throw new NullPointerException("targetNumber is null"); //NOI18N + } + + // Copy all fields + targetNumber.setMobileProvider(sourceNumber.getMobileProvider()); + targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); + targetNumber.setPhoneId(sourceNumber.getPhoneId()); + targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); + } + + /** + * No constructor for utilities classes + */ + private MobileNumbers () { + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java new file mode 100644 index 0000000..7759610 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.mobileprovider; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; + +/** + * A POJO for cellphone providers + *

+ * @author Roland Häder + */ +@Entity (name = "mobile_provider") +@Table (name = "mobile_provider") +@NamedQueries ( + @NamedQuery (name = "AllMobileProvider", query = "SELECT p FROM mobile_provider AS p ORDER BY p.providerId ASC") +) +@SuppressWarnings ("PersistenceUnitPresent") +public class CellphoneProvider implements MobileProvider { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 185_878_567_810_590L; + + /** + * Country instance ('s dial data) + */ + @JoinColumn (name = "provider_country_id", nullable = false) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) + private Country providerCountry; + + /** + * Provider dial prefix (example: 0177 for German E+) + */ + @Basic (optional = false) + @Column (name = "provider_dial_prefix", length = 10, nullable = false) + private Long providerDialPrefix; + + /** + * Timestamp when this entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "provider_entry_created", nullable = false, updatable = false) + private Calendar providerEntryCreated; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "provider_id", nullable = false, updatable = false) + private Long providerId; + + /** + * Pattern for mail gateway + */ + @Column (name = "provider_mail_pattern", length = 30) + private String providerMailPattern; + + /** + * Name of the provider + */ + @Basic (optional = false) + @Column (name = "provider_name", length = 30, nullable = false) + private String providerName; + + /** + * Default constructor + */ + public CellphoneProvider () { + } + + /** + * Constructor with all required data + *

+ * @param providerDialPrefix Dial prefix + * @param providerName Name + * @param providerCountry Country + * @param providerMailPattern Pattern for email + */ + public CellphoneProvider (final Long providerDialPrefix, final String providerName, final Country providerCountry, final String providerMailPattern) { + // Call default constructor + this(); + + // Set all values + this.providerDialPrefix = providerDialPrefix; + this.providerName = providerName; + this.providerCountry = providerCountry; + this.providerMailPattern = providerMailPattern; + } + + @Override + public boolean equals (final Object object) { + if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final MobileProvider other = (MobileProvider) object; + + if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) { + return false; + } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) { + return false; + } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) { + return false; + } + + return true; + } + + @Override + public int hashCode () { + int hash = 7; + hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); + hash = 19 * hash + Objects.hashCode(this.getProviderName()); + hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); + return hash; + } + + @Override + public Country getProviderCountry () { + return this.providerCountry; + } + + @Override + public void setProviderCountry (final Country providerCountry) { + this.providerCountry = providerCountry; + } + + @Override + public Long getProviderDialPrefix () { + return this.providerDialPrefix; + } + + @Override + public void setProviderDialPrefix (final Long providerDialPrefix) { + this.providerDialPrefix = providerDialPrefix; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getProviderEntryCreated () { + return this.providerEntryCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setProviderEntryCreated (final Calendar providerEntryCreated) { + this.providerEntryCreated = providerEntryCreated; + } + + @Override + public Long getProviderId () { + return this.providerId; + } + + @Override + public void setProviderId (final Long providerId) { + this.providerId = providerId; + } + + @Override + public String getProviderName () { + return this.providerName; + } + + @Override + public void setProviderName (final String providerName) { + this.providerName = providerName; + } + + @Override + public String getProviderMailPattern () { + return this.providerMailPattern; + } + + @Override + public void setProviderMailPattern (final String providerMailPattern) { + this.providerMailPattern = providerMailPattern; + } + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java new file mode 100644 index 0000000..6b7a775 --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.jphone.model.phonenumbers.mobileprovider; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcountry.model.data.Country; + +/** + * A POJI for mobile providers + *

+ * @author Roland Häder + */ +public interface MobileProvider extends Serializable { + + /** + * Getter for id number + *

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

+ * @param providerId Id number + */ + void setProviderId (final Long providerId); + + /** + * Getter for provider dial prefix + *

+ * @return Provider dial prefix + */ + Long getProviderDialPrefix (); + + /** + * Setter for provider dial prefix + *

+ * @param providerDialPrefix Provider dial prefix + */ + void setProviderDialPrefix (final Long providerDialPrefix); + + /** + * Getter for provider name + *

+ * @return Provider name + */ + String getProviderName (); + + /** + * Setter for provider name + *

+ * @param providerName Provider name + */ + void setProviderName (final String providerName); + + /** + * Getter for country instance ('s dial data) + *

+ * @return Country instance + */ + Country getProviderCountry (); + + /** + * Setter for country instance ('s dial data) + *

+ * @param country Country instance + */ + void setProviderCountry (final Country country); + + /** + * Getter for timestamp when this entry has been created + *

+ * @return Timestamp when this entry has been created + */ + Calendar getProviderEntryCreated (); + + /** + * Setter for timestamp when this entry has been created + *

+ * @param providerEntryCreated Timestamp when this entry has been created + */ + void setProviderEntryCreated (final Calendar providerEntryCreated); + + /** + * Getter for pattern for mail gateway + *

+ * @return Pattern for mail gateway + */ + String getProviderMailPattern (); + + /** + * Setter for pattern for mail gateway + *

+ * @param providerMailRegex Pattern for mail gateway + */ + void setProviderMailPattern (final String providerMailRegex); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java new file mode 100644 index 0000000..ac0c52f --- /dev/null +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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 targetMobileProvider program. If not, see . + */ +package org.mxchange.jphone.model.phonenumbers.mobileprovider; + +import java.io.Serializable; + +/** + * An utilities class for mobile providers + *

+ * @author Roland Häder + */ +public class MobileProviders implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 15_468_608_721_651L; + + /** + * Copies all values from source mobile provider to this + *

+ * @param sourceMobileProvider Source mobile provider + * @param targetMobileProvider Target mobile provider + */ + public static void copyAll (final MobileProvider sourceMobileProvider, final MobileProvider targetMobileProvider) { + // Parameter should not be null + if (null == sourceMobileProvider) { + // Throw NPE + throw new NullPointerException("sourceMobileProvider is null"); //NOI18N + } else if (null == targetMobileProvider) { + // Throw NPE + throw new NullPointerException("targetMobileProvider is null"); //NOI18N + } + + // Copy all values + targetMobileProvider.getProviderCountry().copyAll(sourceMobileProvider.getProviderCountry()); + targetMobileProvider.setProviderDialPrefix(sourceMobileProvider.getProviderDialPrefix()); + targetMobileProvider.setProviderEntryCreated(sourceMobileProvider.getProviderEntryCreated()); + targetMobileProvider.setProviderId(sourceMobileProvider.getProviderId()); + targetMobileProvider.setProviderMailPattern(sourceMobileProvider.getProviderMailPattern()); + targetMobileProvider.setProviderName(sourceMobileProvider.getProviderName()); + } + + /** + * Private constructor, because there is no need for an instance of + * targetMobileProvider class. + */ + private MobileProviders () { + } + +} diff --git a/src/org/mxchange/jphone/phonenumbers/DialableNumber.java b/src/org/mxchange/jphone/phonenumbers/DialableNumber.java deleted file mode 100644 index 29c3897..0000000 --- a/src/org/mxchange/jphone/phonenumbers/DialableNumber.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcountry.data.Country; - -/** - * A POJI for dial-able numbers - *

- * @author Roland Häder - */ -public interface DialableNumber extends Serializable { - - /** - * Getter for country instance ('s dial data) - *

- * @return Country instance - */ - Country getPhoneCountry (); - - /** - * Setter for country instance ('s dial data) - *

- * @param country Country instance - */ - void setPhoneCountry (final Country country); - - /** - * Getter for id number - *

- * @return Id number - */ - Long getPhoneId (); - - /** - * Setter for id number - *

- * @param phoneId Id number - */ - void setPhoneId (final Long phoneId); - - /** - * Getter for dial number without prefix - *

- * @return Dial number without prefix - */ - Long getPhoneNumber (); - - /** - * Setter for dial number without prefix - *

- * @param phoneNumber Dial number without prefix - */ - void setPhoneNumber (final Long phoneNumber); - - /** - * Getter for area code without dial prefix (example: 2151 for Krefeld) - *

- * @return Area code without dial prefix - */ - Integer getPhoneAreaCode (); - - /** - * Setter for area code without dial prefix (example: 2151 for Krefeld) - *

- * @param phoneAreaCode Area code without dial prefix - */ - void setPhoneAreaCode (final Integer phoneAreaCode); - - /** - * Getter for timestamp when this entry has been created - *

- * @return Timestamp when this entry has been created - */ - Calendar getPhoneEntryCreated (); - - /** - * Setter for timestamp when this entry has been created - *

- * @param phoneEntryCreated Timestamp when this entry has been created - */ - void setPhoneEntryCreated (final Calendar phoneEntryCreated); - - /** - * Getter for timestamp when this entry has been updated - *

- * @return Timestamp when this entry has been updated - */ - Calendar getPhoneEntryUpdated (); - - /** - * Setter for timestamp when this entry has been updated - *

- * @param phoneEntryUpdated Timestamp when this entry has been updated - */ - void setPhoneEntryUpdated (final Calendar phoneEntryUpdated); - -} diff --git a/src/org/mxchange/jphone/phonenumbers/fax/DialableFaxNumber.java b/src/org/mxchange/jphone/phonenumbers/fax/DialableFaxNumber.java deleted file mode 100644 index a8976c1..0000000 --- a/src/org/mxchange/jphone/phonenumbers/fax/DialableFaxNumber.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.fax; - -import org.mxchange.jphone.phonenumbers.DialableNumber; - -/** - * A POJI for dialable fax numbers - *

- * @author Roland Häder - */ -public interface DialableFaxNumber extends DialableNumber { - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java b/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java deleted file mode 100644 index bcea5cb..0000000 --- a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.fax; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; - -/** - * A POJO for dialable fax numbers - *

- * @author Roland Häder - */ -@Entity (name = "fax_numbers") -@Table (name = "fax_numbers") -@NamedQueries ( - { - @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC"), - @NamedQuery (name = "SearchFaxNumberId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxNumberId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class FaxNumber implements DialableFaxNumber { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 17_687_687_191_375L; - - /** - * Area code (example: 2151 for Krefeld) - */ - @Basic (optional = false) - @Column (name = "fax_area_code", length = 10, nullable = false) - private Integer faxAreaCode; - - /** - * Country instance ('s dial data) - */ - @JoinColumn (name = "fax_country_id", nullable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) - private Country faxCountry; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "fax_entry_created", nullable = false, updatable = false) - private Calendar phoneEntryCreated; - - /** - * Timestamp when this entry has been created - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "phone_entry_updated", updatable = false) - private Calendar phoneEntryUpdated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "fax_id", nullable = false, updatable = false) - private Long phoneId; - - /** - * Fax number without prefix - */ - @Basic (optional = false) - @Column (name = "fax_number", nullable = false) - private Long phoneNumber; - - /** - * Default constructor - */ - public FaxNumber () { - } - - /** - * Constructor with country, area code and number - *

- * @param faxCountry Country instance - * @param faxAreaCode Area code (without leading zeros) - * @param faxNumber Fax number (without area code and leading zero) - */ - public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) { - // Call default constructor - this(); - - // Set all values - this.faxCountry = faxCountry; - this.faxAreaCode = faxAreaCode; - this.phoneNumber = faxNumber; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final DialableFaxNumber other = (DialableFaxNumber) object; - - if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { - return false; - } else if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { - return false; - } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { - return false; - } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { - return false; - } - - return true; - } - - @Override - public Integer getPhoneAreaCode () { - return this.faxAreaCode; - } - - @Override - public void setPhoneAreaCode (final Integer faxAreaCode) { - this.faxAreaCode = faxAreaCode; - } - - @Override - public Country getPhoneCountry () { - return this.faxCountry; - } - - @Override - public void setPhoneCountry (final Country faxCountry) { - this.faxCountry = faxCountry; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryCreated () { - return this.phoneEntryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { - this.phoneEntryCreated = phoneEntryCreated; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryUpdated () { - return this.phoneEntryUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { - this.phoneEntryUpdated = phoneEntryUpdated; - } - - @Override - public Long getPhoneId () { - return this.phoneId; - } - - @Override - public void setPhoneId (final Long phoneId) { - this.phoneId = phoneId; - } - - @Override - public Long getPhoneNumber () { - return this.phoneNumber; - } - - @Override - public void setPhoneNumber (final Long phoneNumber) { - this.phoneNumber = phoneNumber; - } - - @Override - public int hashCode () { - int hash = 3; - - hash = 23 * hash + Objects.hashCode(this.getPhoneId()); - hash = 23 * hash + Objects.hashCode(this.getPhoneNumber()); - hash = 23 * hash + Objects.hashCode(this.getPhoneAreaCode()); - hash = 23 * hash + Objects.hashCode(this.getPhoneCountry()); - - return hash; - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumbers.java b/src/org/mxchange/jphone/phonenumbers/fax/FaxNumbers.java deleted file mode 100644 index 580f4df..0000000 --- a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumbers.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * 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.jphone.phonenumbers.fax; - -import java.io.Serializable; - -/** - * An utilities class for fax numbers - *

- * @author Roland Häder - */ -public class FaxNumbers implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 1_948_653_672_761L; - - /** - * Copy all fields from source object to this - *

- * @param sourceNumber Source number object - * @param targetNumber Target number object - */ - public static void copyAll (final DialableFaxNumber sourceNumber, final DialableFaxNumber targetNumber) { - // Validate instance - if (null == sourceNumber) { - // Throw NPE - throw new NullPointerException("sourceNumber is null"); //NOI18N - } else if (null == targetNumber) { - // Throw NPE - throw new NullPointerException("targetNumber is null"); //NOI18N - } - - // Copy all - targetNumber.setPhoneAreaCode(sourceNumber.getPhoneAreaCode()); - targetNumber.setPhoneCountry(sourceNumber.getPhoneCountry()); - targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); - targetNumber.setPhoneId(sourceNumber.getPhoneId()); - targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); - } - - /** - * No constructor for utilities classes - */ - private FaxNumbers () { - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/landline/DialableLandLineNumber.java b/src/org/mxchange/jphone/phonenumbers/landline/DialableLandLineNumber.java deleted file mode 100644 index 5b5a04b..0000000 --- a/src/org/mxchange/jphone/phonenumbers/landline/DialableLandLineNumber.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.landline; - -import org.mxchange.jphone.phonenumbers.DialableNumber; - -/** - * A POJI for dialable land-line numbers - *

- * @author Roland Häder - */ -public interface DialableLandLineNumber extends DialableNumber { - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java b/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java deleted file mode 100644 index f7c809b..0000000 --- a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.landline; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; - -/** - * A POJO for dialable phone numbers - *

- * @author Roland Häder - */ -@Entity (name = "landline_numbers") -@Table (name = "landline_numbers") -@NamedQueries ( - { - @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM landline_numbers AS p ORDER BY p.phoneId ASC"), - @NamedQuery (name = "SearchLandLineNumberId", query = "SELECT p FROM landline_numbers AS p WHERE p.phoneId = :landLineNumberId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class LandLineNumber implements DialableLandLineNumber { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 18_563_748_781_956L; - - /** - * Area code (example: 2151 for Krefeld) - */ - @Basic (optional = false) - @Column (name = "landline_area_code", length = 10, nullable = false) - private Integer phoneAreaCode; - - /** - * Connection to table "country_data" - */ - @JoinColumn (name = "landline_country_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) - private Country phoneCountry; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "landline_entry_created", nullable = false, updatable = false) - private Calendar phoneEntryCreated; - - /** - * Timestamp when this entry has been created - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "landline_entry_updated", updatable = false) - private Calendar phoneEntryUpdated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "landline_id", length = 10, nullable = false, updatable = false) - private Long phoneId; - - /** - * Phone number with out dial prefix - */ - @Basic (optional = false) - @Column (name = "landline_number", nullable = false) - private Long phoneNumber; - - /** - * Default constructor - */ - public LandLineNumber () { - } - - /** - * Constructor with country instance, area code and number - *

- * @param phoneCountry Country instance - * @param phoneAreaCode Phone area code - * @param phoneNumber Phone number - */ - public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) { - // Call default constructor - this(); - - // Set all values - this.phoneCountry = phoneCountry; - this.phoneAreaCode = phoneAreaCode; - this.phoneNumber = phoneNumber; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final DialableLandLineNumber other = (DialableLandLineNumber) object; - - if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { - return false; - } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { - return false; - } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { - return false; - } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { - return false; - } - - return true; - } - - @Override - public Integer getPhoneAreaCode () { - return this.phoneAreaCode; - } - - @Override - public void setPhoneAreaCode (final Integer phoneAreaCode) { - this.phoneAreaCode = phoneAreaCode; - } - - @Override - public Country getPhoneCountry () { - return this.phoneCountry; - } - - @Override - public void setPhoneCountry (final Country phoneCountry) { - this.phoneCountry = phoneCountry; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryCreated () { - return this.phoneEntryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { - this.phoneEntryCreated = phoneEntryCreated; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryUpdated () { - return this.phoneEntryUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { - this.phoneEntryUpdated = phoneEntryUpdated; - } - - @Override - public Long getPhoneId () { - return this.phoneId; - } - - @Override - public void setPhoneId (final Long phoneId) { - this.phoneId = phoneId; - } - - @Override - public Long getPhoneNumber () { - return this.phoneNumber; - } - - @Override - public void setPhoneNumber (final Long phoneNumber) { - this.phoneNumber = phoneNumber; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 47 * hash + Objects.hashCode(this.getPhoneId()); - hash = 47 * hash + Objects.hashCode(this.getPhoneNumber()); - hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode()); - hash = 47 * hash + Objects.hashCode(this.getPhoneCountry()); - - return hash; - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumbers.java b/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumbers.java deleted file mode 100644 index 6f67f7a..0000000 --- a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumbers.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * 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 targetNumber program. If not, see . - */ -package org.mxchange.jphone.phonenumbers.landline; - -import java.io.Serializable; - -/** - * An utilities class for land-line numbers - *

- * @author Roland Häder - */ -public class LandLineNumbers implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 18_698_467_372_167_561L; - - /** - * Copy all fields from source object to this - *

- * @param sourceNumber Source number object - * @param targetNumber Target number object - */ - public static void copyAll (final DialableLandLineNumber sourceNumber, final DialableLandLineNumber targetNumber) { - // Validate instance - if (null == sourceNumber) { - // Throw NPE - throw new NullPointerException("sourceNumber is null"); //NOI18N - } else if (null == targetNumber) { - // Throw NPE - throw new NullPointerException("targetNumber is null"); //NOI18N - } - - // Copy all - targetNumber.setPhoneAreaCode(sourceNumber.getPhoneAreaCode()); - targetNumber.setPhoneCountry(sourceNumber.getPhoneCountry()); - targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); - targetNumber.setPhoneId(sourceNumber.getPhoneId()); - targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); - } - - /** - * No constructor for utilities classes - */ - private LandLineNumbers () { - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobile/DialableMobileNumber.java b/src/org/mxchange/jphone/phonenumbers/mobile/DialableMobileNumber.java deleted file mode 100644 index 554b214..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobile/DialableMobileNumber.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.mobile; - -import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; - -/** - * A POJO for dialable mobile numbers with carriers. - *

- * @author Roland Häder - */ -public interface DialableMobileNumber extends DialableNumber { - - /** - * Getter for mobile provider - *

- * @return Mobile provider - */ - MobileProvider getMobileProvider (); - - /** - * Setter for mobile provider - *

- * @param mobileProvider Mobile provider - */ - void setMobileProvider (final MobileProvider mobileProvider); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumber.java b/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumber.java deleted file mode 100644 index 94162b3..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumber.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.mobile; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jphone.phonenumbers.mobileprovider.CellphoneProvider; -import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; - -/** - * A POJO for dialable cellphone numbers - *

- * @author Roland Häder - */ -@Entity (name = "mobile_numbers") -@Table (name = "mobile_numbers") -@NamedQueries ( - { - @NamedQuery (name = "AllMobileNumbers", query = "SELECT c FROM mobile_numbers AS c ORDER BY c.phoneId ASC"), - @NamedQuery (name = "SearchMobileNumberId", query = "SELECT c FROM mobile_numbers AS c WHERE c.phoneId = :mobileNumberId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class MobileNumber implements DialableMobileNumber { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 13_859_879_482_106L; - - /** - * Connection to table "mobile_provider" (for dial prefix and more data) - */ - @JoinColumn (name = "mobile_provider_id", nullable = false) - @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.REFRESH, optional = false) - private MobileProvider mobileProvider; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "mobile_entry_created", nullable = false, updatable = false) - private Calendar phoneEntryCreated; - - /** - * Timestamp when this entry has been created - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "mobile_entry_updated", updatable = false) - private Calendar phoneEntryUpdated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "mobile_id", nullable = false, updatable = false) - private Long phoneId; - - /** - * Number without prefix to dial - */ - @Basic (optional = false) - @Column (name = "mobile_number", nullable = false) - private Long phoneNumber; - - /** - * Default constructor - */ - public MobileNumber () { - } - - /** - * Constructor with cellphone provider and number - *

- * @param mobileProvider Mobile provider - * @param mobileNumber Mobile number - */ - public MobileNumber (final MobileProvider mobileProvider, final Long mobileNumber) { - // Call default constructor - this(); - - // Set all values - this.mobileProvider = mobileProvider; - this.phoneNumber = mobileNumber; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final DialableMobileNumber other = (DialableMobileNumber) object; - - if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { - return false; - } else if (!Objects.equals(this.getMobileProvider(), other.getMobileProvider())) { - return false; - } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { - return false; - } - - return true; - } - - @Override - public MobileProvider getMobileProvider () { - return this.mobileProvider; - } - - @Override - public void setMobileProvider (final MobileProvider mobileProvider) { - this.mobileProvider = mobileProvider; - } - - @Override - @Deprecated - public Integer getPhoneAreaCode () { - throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N - } - - @Override - @Deprecated - public void setPhoneAreaCode (final Integer phoneAreaCode) { - throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N - } - - @Override - @Deprecated - public Country getPhoneCountry () { - throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - @Deprecated - public void setPhoneCountry (final Country country) { - throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryCreated () { - return this.phoneEntryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { - this.phoneEntryCreated = phoneEntryCreated; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getPhoneEntryUpdated () { - return this.phoneEntryUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { - this.phoneEntryUpdated = phoneEntryUpdated; - } - - @Override - public Long getPhoneId () { - return this.phoneId; - } - - @Override - public void setPhoneId (final Long phoneId) { - this.phoneId = phoneId; - } - - @Override - public Long getPhoneNumber () { - return this.phoneNumber; - } - - @Override - public void setPhoneNumber (final Long phoneNumber) { - this.phoneNumber = phoneNumber; - } - - @Override - public int hashCode () { - int hash = 5; - - hash = 97 * hash + Objects.hashCode(this.getPhoneId()); - hash = 97 * hash + Objects.hashCode(this.getMobileProvider()); - hash = 97 * hash + Objects.hashCode(this.getPhoneNumber()); - - return hash; - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumbers.java b/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumbers.java deleted file mode 100644 index 89e57f8..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobile/MobileNumbers.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * 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 targetNumber program. If not, see . - */ -package org.mxchange.jphone.phonenumbers.mobile; - -import java.io.Serializable; - -/** - * An utilities class for mobile numbers - *

- * @author Roland Häder - */ -public class MobileNumbers implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 291_608_496_882_761L; - - /** - * Copy all fields from source object to this - *

- * @param sourceNumber Source number object - * @param targetNumber Target number object - */ - public static void copyAll (final DialableMobileNumber sourceNumber, final DialableMobileNumber targetNumber) { - // Validate instance - if (null == sourceNumber) { - // Throw NPE - throw new NullPointerException("sourceNumber is null"); //NOI18N - } else if (null == targetNumber) { - // Throw NPE - throw new NullPointerException("targetNumber is null"); //NOI18N - } - - // Copy all fields - targetNumber.setMobileProvider(sourceNumber.getMobileProvider()); - targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); - targetNumber.setPhoneId(sourceNumber.getPhoneId()); - targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); - } - - /** - * No constructor for utilities classes - */ - private MobileNumbers () { - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobileprovider/CellphoneProvider.java b/src/org/mxchange/jphone/phonenumbers/mobileprovider/CellphoneProvider.java deleted file mode 100644 index 431a945..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobileprovider/CellphoneProvider.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.mobileprovider; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; - -/** - * A POJO for cellphone providers - *

- * @author Roland Häder - */ -@Entity (name = "mobile_provider") -@Table (name = "mobile_provider") -@NamedQueries ( - @NamedQuery (name = "AllMobileProvider", query = "SELECT p FROM mobile_provider AS p ORDER BY p.providerId ASC") -) -@SuppressWarnings ("PersistenceUnitPresent") -public class CellphoneProvider implements MobileProvider { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 185_878_567_810_590L; - - /** - * Country instance ('s dial data) - */ - @JoinColumn (name = "provider_country_id", nullable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) - private Country providerCountry; - - /** - * Provider dial prefix (example: 0177 for German E+) - */ - @Basic (optional = false) - @Column (name = "provider_dial_prefix", length = 10, nullable = false) - private Long providerDialPrefix; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "provider_entry_created", nullable = false, updatable = false) - private Calendar providerEntryCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "provider_id", nullable = false, updatable = false) - private Long providerId; - - /** - * Pattern for mail gateway - */ - @Column (name = "provider_mail_pattern", length = 30) - private String providerMailPattern; - - /** - * Name of the provider - */ - @Basic (optional = false) - @Column (name = "provider_name", length = 30, nullable = false) - private String providerName; - - /** - * Default constructor - */ - public CellphoneProvider () { - } - - /** - * Constructor with all required data - *

- * @param providerDialPrefix Dial prefix - * @param providerName Name - * @param providerCountry Country - * @param providerMailPattern Pattern for email - */ - public CellphoneProvider (final Long providerDialPrefix, final String providerName, final Country providerCountry, final String providerMailPattern) { - // Call default constructor - this(); - - // Set all values - this.providerDialPrefix = providerDialPrefix; - this.providerName = providerName; - this.providerCountry = providerCountry; - this.providerMailPattern = providerMailPattern; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final MobileProvider other = (MobileProvider) object; - - if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) { - return false; - } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) { - return false; - } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) { - return false; - } - - return true; - } - - @Override - public int hashCode () { - int hash = 7; - hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); - hash = 19 * hash + Objects.hashCode(this.getProviderName()); - hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); - return hash; - } - - @Override - public Country getProviderCountry () { - return this.providerCountry; - } - - @Override - public void setProviderCountry (final Country providerCountry) { - this.providerCountry = providerCountry; - } - - @Override - public Long getProviderDialPrefix () { - return this.providerDialPrefix; - } - - @Override - public void setProviderDialPrefix (final Long providerDialPrefix) { - this.providerDialPrefix = providerDialPrefix; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getProviderEntryCreated () { - return this.providerEntryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setProviderEntryCreated (final Calendar providerEntryCreated) { - this.providerEntryCreated = providerEntryCreated; - } - - @Override - public Long getProviderId () { - return this.providerId; - } - - @Override - public void setProviderId (final Long providerId) { - this.providerId = providerId; - } - - @Override - public String getProviderName () { - return this.providerName; - } - - @Override - public void setProviderName (final String providerName) { - this.providerName = providerName; - } - - @Override - public String getProviderMailPattern () { - return this.providerMailPattern; - } - - @Override - public void setProviderMailPattern (final String providerMailPattern) { - this.providerMailPattern = providerMailPattern; - } - -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProvider.java b/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProvider.java deleted file mode 100644 index a5b328d..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProvider.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.jphone.phonenumbers.mobileprovider; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcountry.data.Country; - -/** - * A POJI for mobile providers - *

- * @author Roland Häder - */ -public interface MobileProvider extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getProviderId (); - - /** - * Setter for id number - *

- * @param providerId Id number - */ - void setProviderId (final Long providerId); - - /** - * Getter for provider dial prefix - *

- * @return Provider dial prefix - */ - Long getProviderDialPrefix (); - - /** - * Setter for provider dial prefix - *

- * @param providerDialPrefix Provider dial prefix - */ - void setProviderDialPrefix (final Long providerDialPrefix); - - /** - * Getter for provider name - *

- * @return Provider name - */ - String getProviderName (); - - /** - * Setter for provider name - *

- * @param providerName Provider name - */ - void setProviderName (final String providerName); - - /** - * Getter for country instance ('s dial data) - *

- * @return Country instance - */ - Country getProviderCountry (); - - /** - * Setter for country instance ('s dial data) - *

- * @param country Country instance - */ - void setProviderCountry (final Country country); - - /** - * Getter for timestamp when this entry has been created - *

- * @return Timestamp when this entry has been created - */ - Calendar getProviderEntryCreated (); - - /** - * Setter for timestamp when this entry has been created - *

- * @param providerEntryCreated Timestamp when this entry has been created - */ - void setProviderEntryCreated (final Calendar providerEntryCreated); - - /** - * Getter for pattern for mail gateway - *

- * @return Pattern for mail gateway - */ - String getProviderMailPattern (); - - /** - * Setter for pattern for mail gateway - *

- * @param providerMailRegex Pattern for mail gateway - */ - void setProviderMailPattern (final String providerMailRegex); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProviders.java b/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProviders.java deleted file mode 100644 index c2e0b1e..0000000 --- a/src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProviders.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * 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 targetMobileProvider program. If not, see . - */ -package org.mxchange.jphone.phonenumbers.mobileprovider; - -import java.io.Serializable; - -/** - * An utilities class for mobile providers - *

- * @author Roland Häder - */ -public class MobileProviders implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 15_468_608_721_651L; - - /** - * Copies all values from source mobile provider to this - *

- * @param sourceMobileProvider Source mobile provider - * @param targetMobileProvider Target mobile provider - */ - public static void copyAll (final MobileProvider sourceMobileProvider, final MobileProvider targetMobileProvider) { - // Parameter should not be null - if (null == sourceMobileProvider) { - // Throw NPE - throw new NullPointerException("sourceMobileProvider is null"); //NOI18N - } else if (null == targetMobileProvider) { - // Throw NPE - throw new NullPointerException("targetMobileProvider is null"); //NOI18N - } - - // Copy all values - targetMobileProvider.getProviderCountry().copyAll(sourceMobileProvider.getProviderCountry()); - targetMobileProvider.setProviderDialPrefix(sourceMobileProvider.getProviderDialPrefix()); - targetMobileProvider.setProviderEntryCreated(sourceMobileProvider.getProviderEntryCreated()); - targetMobileProvider.setProviderId(sourceMobileProvider.getProviderId()); - targetMobileProvider.setProviderMailPattern(sourceMobileProvider.getProviderMailPattern()); - targetMobileProvider.setProviderName(sourceMobileProvider.getProviderName()); - } - - /** - * Private constructor, because there is no need for an instance of - * targetMobileProvider class. - */ - private MobileProviders () { - } - -} diff --git a/src/org/mxchange/jphone/utils/PhoneUtils.java b/src/org/mxchange/jphone/utils/PhoneUtils.java index 636627c..3bd5c91 100644 --- a/src/org/mxchange/jphone/utils/PhoneUtils.java +++ b/src/org/mxchange/jphone/utils/PhoneUtils.java @@ -18,9 +18,9 @@ package org.mxchange.jphone.utils; import java.io.Serializable; import java.util.Objects; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** *