From: Roland Häder Date: Mon, 15 Aug 2016 10:24:09 +0000 (+0200) Subject: Added event for deleting contact data X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=96596838569930013e99519b23742861a34eea6c;p=jcontacts-core.git Added event for deleting contact data --- diff --git a/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java b/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java index b34bafa..0e790c8 100644 --- a/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java +++ b/src/org/mxchange/jcontacts/events/contact/add/AdminAddedContactEvent.java @@ -1,37 +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 (); - -} +/* + * 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 new contact + * data. + *

+ * @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/deleted/AdminContactDeletedEvent.java b/src/org/mxchange/jcontacts/events/contact/deleted/AdminContactDeletedEvent.java new file mode 100644 index 0000000..457056e --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/deleted/AdminContactDeletedEvent.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.deleted; + +import java.text.MessageFormat; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An event being fired when the administrator has deleted a contact + *

+ * @author Roland Haeder + */ +public class AdminContactDeletedEvent implements AdminDeletedContactEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_785_787_174_676_290L; + + /** + * Deleted contact instance + */ + private final Contact deletedContact; + + /** + * Constructor with deleted contact instance + *

+ * @param deletedContact Deleted contact instance + */ + public AdminContactDeletedEvent (final Contact deletedContact) { + // Is the contact instance valid? + if (null == deletedContact) { + // Throw NPE + throw new NullPointerException("deletedContact is null"); //NOI18N + } else if (deletedContact.getContactId() == null) { + // Throw NPE again + throw new NullPointerException("deletedContact.contactId is null"); //NOI18N + } else if (deletedContact.getContactId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("deletedContact.contactId={0} is invalid.", deletedContact.getContactId())); //NOI18N + } + + // Set it here + this.deletedContact = deletedContact; + } + + @Override + public Contact getDeletedContact () { + return this.deletedContact; + } + +} diff --git a/src/org/mxchange/jcontacts/events/contact/deleted/AdminDeletedContactEvent.java b/src/org/mxchange/jcontacts/events/contact/deleted/AdminDeletedContactEvent.java new file mode 100644 index 0000000..d3a2a8c --- /dev/null +++ b/src/org/mxchange/jcontacts/events/contact/deleted/AdminDeletedContactEvent.java @@ -0,0 +1,36 @@ +/* + * 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.deleted; + +import java.io.Serializable; +import org.mxchange.jcontacts.contact.Contact; + +/** + * An interface for events being fired when an administrator deleted a contact. + *

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

+ * @return Deleted contact instance + */ + Contact getDeletedContact (); + +}