From: Roland Häder Date: Sun, 15 Oct 2017 20:39:34 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9ac34bb3b05b43f131b9a5496827d5e068e2695b;p=jphone-core.git Continued: - moved exceptions to own packages - added exception when a mobile provider was not found - added constructor with only phoneId Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java deleted file mode 100644 index 18477fd..0000000 --- a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyAddedException.java +++ /dev/null @@ -1,45 +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.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; - -/** - * An exception thrown when the mobile provider is already added. This should be - * found out by checking dial prefix and country id in combination. - *

- * @author Roland Häder - */ -public class MobileProviderAlreadyAddedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 16_857_128_756_894_186L; - - /** - * Constructor with mobile provider instance - *

- * @param mobileProvider Mobile provider instance - */ - public MobileProviderAlreadyAddedException (final MobileProvider mobileProvider) { - // Create message an call super constructor - super(MessageFormat.format("Mobile provider {0} with dial prefix {1} and country {2} has already been added.", mobileProvider.getProviderName(), mobileProvider.getProviderDialPrefix(), mobileProvider.getProviderCountry().getCountryCode())); //NOI18N - } - -} diff --git a/src/org/mxchange/jphone/exceptions/PhoneEntityNotFoundException.java b/src/org/mxchange/jphone/exceptions/PhoneEntityNotFoundException.java deleted file mode 100644 index 6cd95bd..0000000 --- a/src/org/mxchange/jphone/exceptions/PhoneEntityNotFoundException.java +++ /dev/null @@ -1,44 +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.exceptions; - -import java.text.MessageFormat; - -/** - * An exception thrown when a phone entity is not found. - *

- * @author Roland Häder - */ -public class PhoneEntityNotFoundException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 18_964_581_681_985_597L; - - /** - * Counstructor with id number and causing exception - *

- * @param phoneId Id number that has no corresponding entity - * @param cause Causing exception - */ - public PhoneEntityNotFoundException (final Long phoneId, final Throwable cause) { - // Construct message and call super constructor - super(MessageFormat.format("Phone entity with id {0} not found.", phoneId), cause); //NOI18N - } - -} diff --git a/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java b/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java deleted file mode 100644 index 2b2f278..0000000 --- a/src/org/mxchange/jphone/exceptions/PhoneNumberAlreadyLinkedException.java +++ /dev/null @@ -1,67 +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.exceptions; - -import java.text.MessageFormat; -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 - * should be. - *

- * @author Roland Häder - */ -public class PhoneNumberAlreadyLinkedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 18_964_581_681_985_598L; - - /** - * Counstructor with fax number - *

- * @param faxNumber Fax number - */ - public PhoneNumberAlreadyLinkedException (final DialableFaxNumber faxNumber) { - // Call super constructor with message - super(MessageFormat.format("faxNumber={0} with phoneId={1} cannot be linked, link target has already fax number linked.", faxNumber, faxNumber.getPhoneId())); //NOI18N - } - - /** - * Counstructor with landLine number - *

- * @param landLineNumber Land-line number - */ - public PhoneNumberAlreadyLinkedException (final DialableLandLineNumber landLineNumber) { - // Call super constructor with message - super(MessageFormat.format("landLineNumber={0} with phoneId={1} cannot be linked, link target has already land-line number linked.", landLineNumber, landLineNumber.getPhoneId())); //NOI18N - } - - /** - * Counstructor with mobile number - *

- * @param mobileNumber Mobile number - */ - public PhoneNumberAlreadyLinkedException (final DialableMobileNumber mobileNumber) { - // Call super constructor with message - super(MessageFormat.format("mobileNumber={0} with phoneId={1} cannot be linked, link target has already mobile number linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N - } - -} diff --git a/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java b/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java deleted file mode 100644 index 7d12f65..0000000 --- a/src/org/mxchange/jphone/exceptions/PhoneNumberNotLinkedException.java +++ /dev/null @@ -1,67 +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.exceptions; - -import java.text.MessageFormat; -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 - * should be. - *

- * @author Roland Häder - */ -public class PhoneNumberNotLinkedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 18_964_581_681_985_599L; - - /** - * Counstructor with fax number - *

- * @param faxNumber Fax number - */ - public PhoneNumberNotLinkedException (final DialableFaxNumber faxNumber) { - // Call super constructor with message - super(MessageFormat.format("faxNumber={0} with phoneId={1} is not linked.", faxNumber, faxNumber.getPhoneId())); //NOI18N - } - - /** - * Counstructor with landLine number - *

- * @param landLineNumber Land-line number - */ - public PhoneNumberNotLinkedException (final DialableLandLineNumber landLineNumber) { - // Call super constructor with message - super(MessageFormat.format("landLineNumber={0} with phoneId={1} is not linked.", landLineNumber, landLineNumber.getPhoneId())); //NOI18N - } - - /** - * Counstructor with mobile number - *

- * @param mobileNumber Mobile number - */ - public PhoneNumberNotLinkedException (final DialableMobileNumber mobileNumber) { - // Call super constructor with message - super(MessageFormat.format("mobileNumber={0} with phoneId={1} is not linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N - } - -} diff --git a/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderAlreadyAddedException.java b/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderAlreadyAddedException.java new file mode 100644 index 0000000..f8a78bb --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderAlreadyAddedException.java @@ -0,0 +1,45 @@ +/* + * 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.exceptions.mobileprovider; + +import java.text.MessageFormat; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; + +/** + * An exception thrown when the mobile provider is already added. This should be + * found out by checking dial prefix and country id in combination. + *

+ * @author Roland Häder + */ +public class MobileProviderAlreadyAddedException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 16_857_128_756_894_186L; + + /** + * Constructor with mobile provider instance + *

+ * @param mobileProvider Mobile provider instance + */ + public MobileProviderAlreadyAddedException (final MobileProvider mobileProvider) { + // Create message an call super constructor + super(MessageFormat.format("Mobile provider {0} with dial prefix {1} and country {2} has already been added.", mobileProvider.getProviderName(), mobileProvider.getProviderDialPrefix(), mobileProvider.getProviderCountry().getCountryCode())); //NOI18N + } + +} diff --git a/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderNotFoundException.java b/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderNotFoundException.java new file mode 100644 index 0000000..d08af97 --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/mobileprovider/MobileProviderNotFoundException.java @@ -0,0 +1,43 @@ +/* + * 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.exceptions.mobileprovider; + +import java.text.MessageFormat; + +/** + * An exception thrown when the mobile provider was not found. + *

+ * @author Roland Häder + */ +public class MobileProviderNotFoundException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 16_857_128_756_894_187L; + + /** + * Constructor with primary key + *

+ * @param mobileProviderId Primary key + */ + public MobileProviderNotFoundException (final Long mobileProviderId) { + // Create message an call super constructor + super(MessageFormat.format("Mobile provider with id={0} was not found.", mobileProviderId)); //NOI18N + } + +} diff --git a/src/org/mxchange/jphone/exceptions/phone/PhoneEntityNotFoundException.java b/src/org/mxchange/jphone/exceptions/phone/PhoneEntityNotFoundException.java new file mode 100644 index 0000000..3ea07bd --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/phone/PhoneEntityNotFoundException.java @@ -0,0 +1,54 @@ +/* + * 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.exceptions.phone; + +import java.text.MessageFormat; + +/** + * An exception thrown when a phone entity is not found. + *

+ * @author Roland Häder + */ +public class PhoneEntityNotFoundException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 18_964_581_681_985_597L; + + /** + * Constructor with id number and causing exception + *

+ * @param phoneId Id number that has no corresponding entity + * @param cause Causing exception + */ + public PhoneEntityNotFoundException (final Long phoneId, final Throwable cause) { + // Construct message and call super constructor + super(MessageFormat.format("Phone entity with id {0} not found.", phoneId), cause); //NOI18N + } + + /** + * Constructor with id number + *

+ * @param phoneId Id number that has no corresponding entity + */ + public PhoneEntityNotFoundException (final Long phoneId) { + // Construct message and call super constructor + super(MessageFormat.format("Phone entity with id {0} not found.", phoneId)); //NOI18N + } + +} diff --git a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java new file mode 100644 index 0000000..56ebd4f --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java @@ -0,0 +1,67 @@ +/* + * 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.exceptions.phone; + +import java.text.MessageFormat; +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 + * should be. + *

+ * @author Roland Häder + */ +public class PhoneNumberAlreadyLinkedException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 18_964_581_681_985_598L; + + /** + * Counstructor with fax number + *

+ * @param faxNumber Fax number + */ + public PhoneNumberAlreadyLinkedException (final DialableFaxNumber faxNumber) { + // Call super constructor with message + super(MessageFormat.format("faxNumber={0} with phoneId={1} cannot be linked, link target has already fax number linked.", faxNumber, faxNumber.getPhoneId())); //NOI18N + } + + /** + * Counstructor with landLine number + *

+ * @param landLineNumber Land-line number + */ + public PhoneNumberAlreadyLinkedException (final DialableLandLineNumber landLineNumber) { + // Call super constructor with message + super(MessageFormat.format("landLineNumber={0} with phoneId={1} cannot be linked, link target has already land-line number linked.", landLineNumber, landLineNumber.getPhoneId())); //NOI18N + } + + /** + * Counstructor with mobile number + *

+ * @param mobileNumber Mobile number + */ + public PhoneNumberAlreadyLinkedException (final DialableMobileNumber mobileNumber) { + // Call super constructor with message + super(MessageFormat.format("mobileNumber={0} with phoneId={1} cannot be linked, link target has already mobile number linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N + } + +} diff --git a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java new file mode 100644 index 0000000..c138603 --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java @@ -0,0 +1,67 @@ +/* + * 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.exceptions.phone; + +import java.text.MessageFormat; +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 + * should be. + *

+ * @author Roland Häder + */ +public class PhoneNumberNotLinkedException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 18_964_581_681_985_599L; + + /** + * Counstructor with fax number + *

+ * @param faxNumber Fax number + */ + public PhoneNumberNotLinkedException (final DialableFaxNumber faxNumber) { + // Call super constructor with message + super(MessageFormat.format("faxNumber={0} with phoneId={1} is not linked.", faxNumber, faxNumber.getPhoneId())); //NOI18N + } + + /** + * Counstructor with landLine number + *

+ * @param landLineNumber Land-line number + */ + public PhoneNumberNotLinkedException (final DialableLandLineNumber landLineNumber) { + // Call super constructor with message + super(MessageFormat.format("landLineNumber={0} with phoneId={1} is not linked.", landLineNumber, landLineNumber.getPhoneId())); //NOI18N + } + + /** + * Counstructor with mobile number + *

+ * @param mobileNumber Mobile number + */ + public PhoneNumberNotLinkedException (final DialableMobileNumber mobileNumber) { + // Call super constructor with message + super(MessageFormat.format("mobileNumber={0} with phoneId={1} is not linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N + } + +}