+ @Override
+ public void afterAdminAddedCountry (@Observes final AdminAddedCountryEvent event) {
+ // Is all valid?
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedCountry() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.addedCountry is null"); //NOI18N
+ } else if (event.getAddedCountry().getCountryId() == null) {
+ // And again ...
+ throw new NullPointerException("event.addedCountry.countryId is null"); //NOI18N
+ } else if (event.getAddedCountry().getCountryId() < 1) {
+ // Id is invalid
+ throw new IllegalArgumentException(MessageFormat.format("event.addedCountry.countryId={0} is not valid.", event.getAddedCountry().getCountryId())); //NOI18N
+ }
+
+ // Add the event
+ this.countryList.add(event.getAddedCountry());
+ }
+