]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 21:05:05 +0000 (22:05 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 21:05:05 +0000 (22:05 +0100)
- added event being thrown when a new headquarters has been added

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/events/headquarters/added/HeadquartersAddedEvent.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/events/headquarters/added/ObservableHeadquartersAddedEvent.java [new file with mode: 0644]

diff --git a/src/org/mxchange/jcontactsbusiness/events/headquarters/added/HeadquartersAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/headquarters/added/HeadquartersAddedEvent.java
new file mode 100644 (file)
index 0000000..d03f1e1
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.headquarters.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
+
+/**
+ * An event being fired when a branch office has been added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class HeadquartersAddedEvent implements ObservableHeadquartersAddedEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 572_367_561_659_110L;
+
+       /**
+        * Headquarters office instance being added
+        */
+       private final Headquarter headquarters;
+
+       /**
+        * Constructor with branch office instance
+        * <p>
+        * @param headquarters Headquarters office instance
+        * @throws NullPointerException If the parameter is null
+        */
+       public HeadquartersAddedEvent (final Headquarter headquarters) {
+               // Check parameter
+               if (null == headquarters) {
+                       // Throw NPE
+                       throw new NullPointerException("headquarters is null"); //NOI18N
+               } else if (headquarters.getHeadquartersId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("headquarters.headquartersId is null"); //NOI18N
+               } else if (headquarters.getHeadquartersId() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("headquarters.headquartersId={0} is not valid", headquarters.getHeadquartersId())); //NOI18N
+               }
+
+               // Set it
+               this.headquarters = headquarters;
+       }
+
+       @Override
+       public Headquarter getHeadquarters () {
+               return this.headquarters;
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/events/headquarters/added/ObservableHeadquartersAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/headquarters/added/ObservableHeadquartersAddedEvent.java
new file mode 100644 (file)
index 0000000..7cacdc3
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.headquarters.added;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
+
+/**
+ * An interface for events being triggered when a headquarters has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableHeadquartersAddedEvent extends Serializable {
+
+       /**
+        * Getter for headquarters instance
+        * <p>
+        * @return Headquarters instance
+        */
+       Headquarter getHeadquarters ();
+
+}