From: Roland Haeder Date: Thu, 21 Apr 2016 20:15:05 +0000 (+0200) Subject: Continued (similar to juser-core): X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4644b92a81e4e5ca7ee80e871baa9dbd40d21cba;p=jcontacts-core.git Continued (similar to juser-core): - moved added-contact event to own package - added updated-contact event --- diff --git a/src/org/mxchange/jcontacts/events/contact/AdminAddedContactEvent.java b/src/org/mxchange/jcontacts/events/contact/AdminAddedContactEvent.java deleted file mode 100644 index 2cbedf0..0000000 --- a/src/org/mxchange/jcontacts/events/contact/AdminAddedContactEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * 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 . - */ -package org.mxchange.jcontacts.events.contact; - -import java.io.Serializable; -import org.mxchange.jcontacts.contact.Contact; - -/** - * An interface for events being fired when an administrator added a new user - * account. - *

- * @author Roland Haeder - */ -public interface AdminAddedContactEvent extends Serializable { - - /** - * Getter for added contact instance - *

- * @return Added contact instance - */ - Contact getAddedContact (); - -} diff --git a/src/org/mxchange/jcontacts/events/contact/AdminContactAddedEvent.java b/src/org/mxchange/jcontacts/events/contact/AdminContactAddedEvent.java deleted file mode 100644 index c52e8bb..0000000 --- a/src/org/mxchange/jcontacts/events/contact/AdminContactAddedEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * 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 . - */ -package org.mxchange.jcontacts.events.contact; - -import java.text.MessageFormat; -import org.mxchange.jcontacts.contact.Contact; - -/** - * An event being fired when the administrator has added a new user account - *

- * @author Roland Haeder - */ -public class AdminContactAddedEvent implements AdminAddedContactEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Added contact instance - */ - private final Contact addedContact; - - /** - * Constructor with added contact instance - *

- * @param addedContact Added contact instance - */ - public AdminContactAddedEvent (final Contact addedContact) { - // Is the contact instance valid? - if (null == addedContact) { - // Throw NPE - throw new NullPointerException("addedContact is null"); //NOI18N - } else if (addedContact.getContactId() == null) { - // Throw NPE again - throw new NullPointerException("addedContact.contactId is null"); //NOI18N - } else if (addedContact.getContactId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("addedContact.contactId={0} is invalid.", addedContact.getContactId())); //NOI18N - } - - // Set it here - this.addedContact = addedContact; - } - - @Override - public Contact getAddedContact () { - return this.addedContact; - } - -} diff --git a/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java b/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java new file mode 100644 index 0000000..b34bafa --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 . + */ +package org.mxchange.jcontacts.events.contact.add; + +import java.io.Serializable; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An interface for events being fired when an administrator added a new user + * account. + *

+ * @author Roland Haeder + */ +public interface AdminAddedContactEvent extends Serializable { + + /** + * Getter for added contact instance + *

+ * @return Added contact instance + */ + Contact getAddedContact (); + +} diff --git a/src/org/mxchange/jcontacts/events/contact/add/AdminContactAddedEvent.java b/src/org/mxchange/jcontacts/events/contact/add/AdminContactAddedEvent.java new file mode 100644 index 0000000..bb7d004 --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/add/AdminContactAddedEvent.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 . + */ +package org.mxchange.jcontacts.events.contact.add; + +import java.text.MessageFormat; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An event being fired when the administrator has added a new user account + *

+ * @author Roland Haeder + */ +public class AdminContactAddedEvent implements AdminAddedContactEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_785_787_174_676_290L; + + /** + * Added contact instance + */ + private final Contact addedContact; + + /** + * Constructor with added contact instance + *

+ * @param addedContact Added contact instance + */ + public AdminContactAddedEvent (final Contact addedContact) { + // Is the contact instance valid? + if (null == addedContact) { + // Throw NPE + throw new NullPointerException("addedContact is null"); //NOI18N + } else if (addedContact.getContactId() == null) { + // Throw NPE again + throw new NullPointerException("addedContact.contactId is null"); //NOI18N + } else if (addedContact.getContactId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("addedContact.contactId={0} is invalid.", addedContact.getContactId())); //NOI18N + } + + // Set it here + this.addedContact = addedContact; + } + + @Override + public Contact getAddedContact () { + return this.addedContact; + } + +} diff --git a/src/org/mxchange/jcontacts/events/contact/update/AdminContactUpdatedEvent.java b/src/org/mxchange/jcontacts/events/contact/update/AdminContactUpdatedEvent.java new file mode 100644 index 0000000..fcaac04 --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/update/AdminContactUpdatedEvent.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 . + */ +package org.mxchange.jcontacts.events.contact.update; + +import java.text.MessageFormat; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An event being fired when the administrator has updated a new user account + *

+ * @author Roland Haeder + */ +public class AdminContactUpdatedEvent implements AdminUpdatedContactEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 185_381_945_234_802L; + + /** + * Updated contact instance + */ + private final Contact updatedContact; + + /** + * Constructor with updated contact instance + *

+ * @param updatedContact Updated contact instance + */ + public AdminContactUpdatedEvent (final Contact updatedContact) { + // Is the contact instance valid? + if (null == updatedContact) { + // Throw NPE + throw new NullPointerException("updatedContact is null"); //NOI18N + } else if (updatedContact.getContactId() == null) { + // Throw NPE again + throw new NullPointerException("updatedContact.contactId is null"); //NOI18N + } else if (updatedContact.getContactId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("updatedContact.contactId={0} is invalid.", updatedContact.getContactId())); //NOI18N + } + + // Set it here + this.updatedContact = updatedContact; + } + + @Override + public Contact getUpdatedContact () { + return this.updatedContact; + } + +} diff --git a/src/org/mxchange/jcontacts/events/contact/update/AdminUpdatedContactEvent.java b/src/org/mxchange/jcontacts/events/contact/update/AdminUpdatedContactEvent.java new file mode 100644 index 0000000..5a0d5a1 --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/update/AdminUpdatedContactEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 . + */ +package org.mxchange.jcontacts.events.contact.update; + +import java.io.Serializable; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An interface for events being fired when an administrator updated a new user + * account. + *

+ * @author Roland Haeder + */ +public interface AdminUpdatedContactEvent extends Serializable { + + /** + * Getter for updated contact instance + *

+ * @return Updated contact instance + */ + Contact getUpdatedContact (); + +}