From 4663aa495cf990daaf8affd56ebf56a12dc24b40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 15 Oct 2017 23:09:58 +0200 Subject: [PATCH] Continued: - moved event to own package - added exception for not-found country data MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../{ => added}/AdminAddedCountryEvent.java | 2 +- .../ObservableAdminAddedCountryEvent.java | 2 +- .../exceptions/CountryNotFoundException.java | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) rename src/org/mxchange/jcountry/events/{ => added}/AdminAddedCountryEvent.java (97%) rename src/org/mxchange/jcountry/events/{ => added}/ObservableAdminAddedCountryEvent.java (96%) create mode 100644 src/org/mxchange/jcountry/exceptions/CountryNotFoundException.java diff --git a/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java b/src/org/mxchange/jcountry/events/added/AdminAddedCountryEvent.java similarity index 97% rename from src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java rename to src/org/mxchange/jcountry/events/added/AdminAddedCountryEvent.java index 21c71db..d14df9c 100644 --- a/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java +++ b/src/org/mxchange/jcountry/events/added/AdminAddedCountryEvent.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcountry.events; +package org.mxchange.jcountry.events.added; import java.text.MessageFormat; import org.mxchange.jcountry.model.data.Country; diff --git a/src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java b/src/org/mxchange/jcountry/events/added/ObservableAdminAddedCountryEvent.java similarity index 96% rename from src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java rename to src/org/mxchange/jcountry/events/added/ObservableAdminAddedCountryEvent.java index ac8142d..64fd7a1 100644 --- a/src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java +++ b/src/org/mxchange/jcountry/events/added/ObservableAdminAddedCountryEvent.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcountry.events; +package org.mxchange.jcountry.events.added; import java.io.Serializable; import org.mxchange.jcountry.model.data.Country; diff --git a/src/org/mxchange/jcountry/exceptions/CountryNotFoundException.java b/src/org/mxchange/jcountry/exceptions/CountryNotFoundException.java new file mode 100644 index 0000000..1da0c6a --- /dev/null +++ b/src/org/mxchange/jcountry/exceptions/CountryNotFoundException.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 Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcountry.exceptions; + +import java.text.MessageFormat; + +/** + * An exception thrown when a country was not found. + *

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

+ * @param countryId Primary key + */ + public CountryNotFoundException (final Long countryId) { + // Call super constructor + super(MessageFormat.format("Country with with id {0} was not found.", countryId)); + } + +} -- 2.39.5