From: Roland Häder Date: Thu, 21 Apr 2016 09:42:05 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a73db9b83a31daf8dfa3119d353306f9728249d5;p=juser-core.git Continued a bit: - moved "add-user" event to sub-package - added event when an administrator updated user data --- diff --git a/src/org/mxchange/jusercore/events/user/AdminAddedUserEvent.java b/src/org/mxchange/jusercore/events/user/AdminAddedUserEvent.java deleted file mode 100644 index 49cc25e..0000000 --- a/src/org/mxchange/jusercore/events/user/AdminAddedUserEvent.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.jusercore.events.user; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when an administrator added a new user - * account. - *

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

- * @return Added user instance - */ - User getAddedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/AdminUserAddedEvent.java b/src/org/mxchange/jusercore/events/user/AdminUserAddedEvent.java deleted file mode 100644 index a4d1fdd..0000000 --- a/src/org/mxchange/jusercore/events/user/AdminUserAddedEvent.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.jusercore.events.user; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has added a new user account - *

- * @author Roland Haeder - */ -public class AdminUserAddedEvent implements AdminAddedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Added user instance - */ - private final User addedUser; - - /** - * Constructor with added user instance - *

- * @param addedUser Added user instance - */ - public AdminUserAddedEvent (final User addedUser) { - // Is the user instance valid? - if (null == addedUser) { - // Throw NPE - throw new NullPointerException("addedUser is null"); //NOI18N - } else if (addedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("addedUser.userId is null"); //NOI18N - } else if (addedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("addedUser.userId={0} is invalid.", addedUser.getUserId())); //NOI18N - } - - // Set it here - this.addedUser = addedUser; - } - - @Override - public User getAddedUser () { - return this.addedUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java b/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java new file mode 100644 index 0000000..f1b8173 --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.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.jusercore.events.user.add; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.User; + +/** + * An interface for events being fired when an administrator added a new user + * account. + *

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

+ * @return Added user instance + */ + User getAddedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.java b/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.java new file mode 100644 index 0000000..8889084 --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.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.jusercore.events.user.add; + +import java.text.MessageFormat; +import org.mxchange.jusercore.model.user.User; + +/** + * An event being fired when the administrator has added a new user account + *

+ * @author Roland Haeder + */ +public class AdminUserAddedEvent implements AdminAddedUserEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_785_787_174_676_290L; + + /** + * Added user instance + */ + private final User addedUser; + + /** + * Constructor with added user instance + *

+ * @param addedUser Added user instance + */ + public AdminUserAddedEvent (final User addedUser) { + // Is the user instance valid? + if (null == addedUser) { + // Throw NPE + throw new NullPointerException("addedUser is null"); //NOI18N + } else if (addedUser.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("addedUser.userId is null"); //NOI18N + } else if (addedUser.getUserId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("addedUser.userId={0} is invalid.", addedUser.getUserId())); //NOI18N + } + + // Set it here + this.addedUser = addedUser; + } + + @Override + public User getAddedUser () { + return this.addedUser; + } + +} diff --git a/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java b/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java new file mode 100644 index 0000000..b1d675b --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.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.jusercore.events.user.update; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.User; + +/** + * An interface for events being fired when an administrator updated user data. + *

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

+ * @return Added user instance + */ + User getUpdatedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.java new file mode 100644 index 0000000..4a9fda3 --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.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.jusercore.events.user.update; + +import java.text.MessageFormat; +import org.mxchange.jusercore.model.user.User; + +/** + * An event being fired when the administrator has updated user data + *

+ * @author Roland Haeder + */ +public class AdminUserDataUpdatedEvent implements AdminUpdatedUserDataEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_785_787_174_676_290L; + + /** + * Updated user instance + */ + private final User updatedUser; + + /** + * Constructor with updated user instance + *

+ * @param updatedUser Updated user instance + */ + public AdminUserDataUpdatedEvent (final User updatedUser) { + // Is the user instance valid? + if (null == updatedUser) { + // Throw NPE + throw new NullPointerException("updatedUser is null"); //NOI18N + } else if (updatedUser.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("updatedUser.userId is null"); //NOI18N + } else if (updatedUser.getUserId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N + } + + // Set it here + this.updatedUser = updatedUser; + } + + @Override + public User getUpdatedUser () { + return this.updatedUser; + } + +}