+ this.uniqueAddDepartment(event.getAddedDepartment());
+ }
+
+ /**
+ * Observes events being fired when a department has been updated by an
+ * administrator.
+ * <p>
+ * @param event Event being fired
+ */
+ public void afterAdminDepartmentUpdatedEvent (@Observes final ObservableAdminDepartmentUpdatedEvent event) {
+ // Validate parameter
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getUpdatedDepartment() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.updatedDepartment is null"); //NOI18N
+ } else if (event.getUpdatedDepartment().getDepartmentId() == null) {
+ // Throw it again
+ throw new NullPointerException("event.updatedDepartment.branchId is null"); //NOI18N
+ } else if (event.getUpdatedDepartment().getDepartmentId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("event.updatedDepartment.branchId={0} is not valid", event.getUpdatedDepartment().getDepartmentId())); //NOI18N
+ }
+
+ // Add instance to cache
+ this.departmentCache.put(event.getUpdatedDepartment().getDepartmentId(), event.getUpdatedDepartment());
+
+ // Uniquely add (update) instance
+ this.uniqueAddDepartment(event.getUpdatedDepartment());