From 7c9115d922274349079ad9d3efffddf8641d2f08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 24 Apr 2020 02:42:44 +0200 Subject: [PATCH] Continued: - renamed branchOffice -> addedBranchOffice - renamed BranchOfficeAddedEvent -> AdminBranchOfficeAddedEvent - renamed ObservableBranchOfficeAddedEvent -> ObservableAdminBranchOfficeAddedEvent - added event for when an administrator has updated a branch office MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- ....java => AdminBranchOfficeAddedEvent.java} | 29 ++++---- ...ObservableAdminBranchOfficeAddedEvent.java | 37 ++++++++++ .../AdminBranchOfficeUpdatedEvent.java | 69 +++++++++++++++++++ ...ervableAdminBranchOfficeUpdatedEvent.java} | 9 +-- .../added/DepartmentAddedEvent.java | 3 +- .../added/ObservableDepartmentAddedEvent.java | 2 +- .../added/ObservableEmployeeAddedEvent.java | 2 +- .../ObservableHeadquarterAddedEvent.java | 2 +- .../ObservableOpeningTimeAddedEvent.java | 2 +- .../added/OpeningTimeAddedEvent.java | 3 +- 10 files changed, 134 insertions(+), 24 deletions(-) rename src/org/mxchange/jcontactsbusiness/events/branchoffice/added/{BranchOfficeAddedEvent.java => AdminBranchOfficeAddedEvent.java} (59%) create mode 100644 src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableAdminBranchOfficeAddedEvent.java create mode 100644 src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/AdminBranchOfficeUpdatedEvent.java rename src/org/mxchange/jcontactsbusiness/events/branchoffice/{added/ObservableBranchOfficeAddedEvent.java => updated/ObservableAdminBranchOfficeUpdatedEvent.java} (77%) diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/AdminBranchOfficeAddedEvent.java similarity index 59% rename from src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java rename to src/org/mxchange/jcontactsbusiness/events/branchoffice/added/AdminBranchOfficeAddedEvent.java index 56e6128..8045429 100644 --- a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/BranchOfficeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/AdminBranchOfficeAddedEvent.java @@ -20,11 +20,11 @@ import java.text.MessageFormat; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** - * An event being fired when a branch office has been added + * An event being fired when a branch office has been added by an administrator. *

* @author Roland Häder */ -public class BranchOfficeAddedEvent implements ObservableBranchOfficeAddedEvent { +public class AdminBranchOfficeAddedEvent implements ObservableAdminBranchOfficeAddedEvent { /** * Serial number @@ -34,34 +34,35 @@ public class BranchOfficeAddedEvent implements ObservableBranchOfficeAddedEvent /** * Branch office instance being added */ - private final BranchOffice branchOffice; + private final BranchOffice addedBranchOffice; /** * Constructor with branch office instance *

- * @param branchOffice Branch office instance + * @param addedBranchOffice Branch office instance + * * @throws NullPointerException If the parameter is null */ - public BranchOfficeAddedEvent (final BranchOffice branchOffice) { + public AdminBranchOfficeAddedEvent (final BranchOffice addedBranchOffice) { // Check parameter - if (null == branchOffice) { + if (null == addedBranchOffice) { // Throw NPE - throw new NullPointerException("branchOffice is null"); //NOI18N - } else if (branchOffice.getBranchId() == null) { + throw new NullPointerException("addedBranchOffice is null"); //NOI18N + } else if (addedBranchOffice.getBranchId() == null) { // Throw NPE again - throw new NullPointerException("branchOffice.branchId is null"); //NOI18N - } else if (branchOffice.getBranchId() < 1) { + throw new NullPointerException("addedBranchOffice.branchId is null"); //NOI18N + } else if (addedBranchOffice.getBranchId() < 1) { // Throw NPE again - throw new NullPointerException(MessageFormat.format("branchOffice.branchId={0} is not valid", branchOffice.getBranchId())); //NOI18N + throw new NullPointerException(MessageFormat.format("addedBranchOffice.branchId={0} is not valid", addedBranchOffice.getBranchId())); //NOI18N } // Set it - this.branchOffice = branchOffice; + this.addedBranchOffice = addedBranchOffice; } @Override - public BranchOffice getBranchOffice () { - return this.branchOffice; + public BranchOffice getAddedBranchOffice () { + return this.addedBranchOffice; } } diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableAdminBranchOfficeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableAdminBranchOfficeAddedEvent.java new file mode 100644 index 0000000..8d85388 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableAdminBranchOfficeAddedEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 - 2020 Free Software Foundation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.events.branchoffice.added; + +import java.io.Serializable; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; + +/** + * An interface for events being fired when a branch office has been added by an + * administrator. + *

+ * @author Roland Häder + */ +public interface ObservableAdminBranchOfficeAddedEvent extends Serializable { + + /** + * Getter for added branch office instance + *

+ * @return Added branch office instance + */ + BranchOffice getAddedBranchOffice (); + +} diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/AdminBranchOfficeUpdatedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/AdminBranchOfficeUpdatedEvent.java new file mode 100644 index 0000000..ffa308d --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/AdminBranchOfficeUpdatedEvent.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2017 - 2020 Free Software Foundation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcontactsbusiness.events.branchoffice.updated; + +import java.text.MessageFormat; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; + +/** + * An event being fired when a branch office has been updated by an + * administrator. + *

+ * @author Roland Häder + */ +public class AdminBranchOfficeUpdatedEvent implements ObservableAdminBranchOfficeUpdatedEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 572_367_561_659_114L; + + /** + * Branch office instance being added + */ + private final BranchOffice updatedBranchOffice; + + /** + * Constructor with branch office instance + *

+ * @param updatedBranchOffice Branch office instance + *

+ * @throws NullPointerException If the parameter is null + */ + public AdminBranchOfficeUpdatedEvent (final BranchOffice updatedBranchOffice) { + // Check parameter + if (null == updatedBranchOffice) { + // Throw NPE + throw new NullPointerException("updatedBranchOffice is null"); //NOI18N + } else if (updatedBranchOffice.getBranchId() == null) { + // Throw NPE again + throw new NullPointerException("updatedBranchOffice.branchId is null"); //NOI18N + } else if (updatedBranchOffice.getBranchId() < 1) { + // Throw NPE again + throw new NullPointerException(MessageFormat.format("updatedBranchOffice.branchId={0} is not valid", updatedBranchOffice.getBranchId())); //NOI18N + } + + // Set it + this.updatedBranchOffice = updatedBranchOffice; + } + + @Override + public BranchOffice getUpdatedBranchOffice () { + return this.updatedBranchOffice; + } + +} diff --git a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/ObservableAdminBranchOfficeUpdatedEvent.java similarity index 77% rename from src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java rename to src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/ObservableAdminBranchOfficeUpdatedEvent.java index 6d7ae85..70c37d1 100644 --- a/src/org/mxchange/jcontactsbusiness/events/branchoffice/added/ObservableBranchOfficeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/branchoffice/updated/ObservableAdminBranchOfficeUpdatedEvent.java @@ -14,23 +14,24 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.events.branchoffice.added; +package org.mxchange.jcontactsbusiness.events.branchoffice.updated; import java.io.Serializable; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; /** - * An interface for events being triggered when a branch office has been added. + * An interface for events being fired when an administrator has updated a + * branch office. *

* @author Roland Häder */ -public interface ObservableBranchOfficeAddedEvent extends Serializable { +public interface ObservableAdminBranchOfficeUpdatedEvent extends Serializable { /** * Getter for branch office instance *

* @return Branch office instance */ - BranchOffice getBranchOffice (); + BranchOffice getUpdatedBranchOffice (); } diff --git a/src/org/mxchange/jcontactsbusiness/events/department/added/DepartmentAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/department/added/DepartmentAddedEvent.java index 92987f1..97de10d 100644 --- a/src/org/mxchange/jcontactsbusiness/events/department/added/DepartmentAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/department/added/DepartmentAddedEvent.java @@ -29,7 +29,7 @@ public class DepartmentAddedEvent implements ObservableDepartmentAddedEvent { /** * Serial number */ - private static final long serialVersionUID = 572_367_561_659_110L; + private static final long serialVersionUID = 572_367_561_659_111L; /** * Branch office instance being added @@ -40,6 +40,7 @@ public class DepartmentAddedEvent implements ObservableDepartmentAddedEvent { * Constructor with department instance *

* @param department Branch office instance + *

* @throws NullPointerException If the parameter is null */ public DepartmentAddedEvent (final Department department) { diff --git a/src/org/mxchange/jcontactsbusiness/events/department/added/ObservableDepartmentAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/department/added/ObservableDepartmentAddedEvent.java index 3181de1..bbdae8c 100644 --- a/src/org/mxchange/jcontactsbusiness/events/department/added/ObservableDepartmentAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/department/added/ObservableDepartmentAddedEvent.java @@ -20,7 +20,7 @@ import java.io.Serializable; import org.mxchange.jcontactsbusiness.model.department.Department; /** - * An interface for events being triggered when a department has been added. + * An interface for events being fired when a department has been added. *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java index a5c6e9d..1b37a5a 100644 --- a/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java @@ -20,7 +20,7 @@ import java.io.Serializable; import org.mxchange.jcontactsbusiness.model.employee.Employable; /** - * An interface for events being triggered when a employee has been added. + * An interface for events being fired when a employee has been added. *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/events/headquarter/added/ObservableHeadquarterAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/headquarter/added/ObservableHeadquarterAddedEvent.java index 09a9556..1ac8561 100644 --- a/src/org/mxchange/jcontactsbusiness/events/headquarter/added/ObservableHeadquarterAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/headquarter/added/ObservableHeadquarterAddedEvent.java @@ -20,7 +20,7 @@ import java.io.Serializable; import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; /** - * An interface for events being triggered when a headquarter has been added. + * An interface for events being fired when a headquarter has been added. *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/ObservableOpeningTimeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/ObservableOpeningTimeAddedEvent.java index 037def4..3963de8 100644 --- a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/ObservableOpeningTimeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/ObservableOpeningTimeAddedEvent.java @@ -20,7 +20,7 @@ import java.io.Serializable; import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime; /** - * An interface for events being triggered when a opening time has been added. + * An interface for events being fired when a opening time has been added. *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java index 5266883..66f12d1 100644 --- a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java @@ -29,7 +29,7 @@ public class OpeningTimeAddedEvent implements ObservableOpeningTimeAddedEvent { /** * Serial number */ - private static final long serialVersionUID = 572_367_561_659_111L; + private static final long serialVersionUID = 572_367_561_659_113L; /** * Branch office instance being added @@ -40,6 +40,7 @@ public class OpeningTimeAddedEvent implements ObservableOpeningTimeAddedEvent { * Constructor with opening time instance *

* @param openingTime Branch office instance + *

* @throws NullPointerException If the parameter is null */ public OpeningTimeAddedEvent (final OpeningTime openingTime) { -- 2.39.5