2 * Copyright (C) 2017, 2020 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jcontactsbusiness.events.basicdata.added;
19 import java.text.MessageFormat;
20 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
23 * An event being thrown when new basic business data has been added.
25 * @author Roland Häder<roland@mxchange.org>
27 public class AdminAddedBusinessBasicDataEvent implements ObservableAdminAddedBusinessBasicDataEvent {
32 private static final long serialVersionUID = 41_908_266_873_657_271L;
35 * Basic data instance just being created. It must bear aside company name
38 private final BasicData basicData;
41 * Constructor with basic data
43 * @param basicData Basic data with at least company name and primary key
45 public AdminAddedBusinessBasicDataEvent (final BasicData basicData) {
46 // Is company name and primary key set?
47 if (null == basicData) {
49 throw new NullPointerException("basicData is null"); //NOI18N
50 } else if (basicData.getCompanyShortName() == null) {
52 throw new NullPointerException("basicData.companyShortName is null"); //NOI18N
53 } else if (basicData.getCompanyShortName().isEmpty()) {
55 throw new IllegalArgumentException("basicData.companyShortName is empty"); //NOI18N
56 } else if (basicData.getBasicDataId() == null) {
58 throw new NullPointerException("basicData.basicDataId is null"); //NOI18N
59 } else if (basicData.getBasicDataId() < 1) {
61 throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is not valid.", basicData.getBasicDataId())); //NOI18N
65 this.basicData = basicData;
69 public BasicData getBasicData () {
70 return this.basicData;