]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 7 Oct 2017 23:18:32 +0000 (01:18 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 7 Oct 2017 23:18:32 +0000 (01:18 +0200)
- added event for employees being added

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

diff --git a/src/org/mxchange/jcontactsbusiness/events/employee/added/EmployeeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/employee/added/EmployeeAddedEvent.java
new file mode 100644 (file)
index 0000000..483ee51
--- /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.employee.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.model.employee.Employee;
+
+/**
+ * An event being fired when a employee has been added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class EmployeeAddedEvent implements ObservableEmployeeAddedEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 572_367_561_659_112L;
+
+       /**
+        * Branch office instance being added
+        */
+       private final Employee employee;
+
+       /**
+        * Constructor with employee instance
+        * <p>
+        * @param employee Branch office instance
+        * @throws NullPointerException If the parameter is null
+        */
+       public EmployeeAddedEvent (final Employee employee) {
+               // Check parameter
+               if (null == employee) {
+                       // Throw NPE
+                       throw new NullPointerException("employee is null"); //NOI18N
+               } else if (employee.getEmployeeId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("employee.employeeId is null"); //NOI18N
+               } else if (employee.getEmployeeId() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("employee.employeeId={0} is not valid", employee.getEmployeeId())); //NOI18N
+               }
+
+               // Set it
+               this.employee = employee;
+       }
+
+       @Override
+       public Employee getEmployee () {
+               return this.employee;
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/employee/added/ObservableEmployeeAddedEvent.java
new file mode 100644 (file)
index 0000000..d7bac1a
--- /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.employee.added;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.model.employee.Employee;
+
+/**
+ * An interface for events being triggered when a employee has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableEmployeeAddedEvent extends Serializable {
+
+       /**
+        * Getter for employee instance
+        * <p>
+        * @return Employee instance
+        */
+       Employee getEmployee ();
+
+}