From ad101fa937310e92bd836cc0e4b0c10d1f125bc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 30 Jul 2017 21:49:30 +0200 Subject: [PATCH] Continued a bit: - added new event for when a bean helper has successfully created a user instance MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../events/user/add/AdminAddedUserEvent.java | 132 +++++++-------- .../add/ObservableAdminAddedUserEvent.java | 74 ++++----- .../user/delete/AdminDeletedUserEvent.java | 156 +++++++++--------- .../ObservableAdminDeletedUserEvent.java | 88 +++++----- .../created/HelperCreatedUserEvent.java | 54 ++++++ .../ObservableHelperCreatedUserEvent.java | 37 +++++ .../update/AdminUpdatedUserDataEvent.java | 132 +++++++-------- .../ObservableAdminUpdatedUserDataEvent.java | 72 ++++---- ...bservableUpdatedUserPersonalDataEvent.java | 72 ++++---- .../update/UpdatedUserPersonalDataEvent.java | 132 +++++++-------- 10 files changed, 520 insertions(+), 429 deletions(-) create mode 100644 src/org/mxchange/jusercore/events/user/helper/created/HelperCreatedUserEvent.java create mode 100644 src/org/mxchange/jusercore/events/user/helper/created/ObservableHelperCreatedUserEvent.java diff --git a/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java b/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java index 9a739c6..cdfc591 100644 --- a/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java +++ b/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java @@ -1,66 +1,66 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 Häder - */ -public class AdminAddedUserEvent implements ObservableAdminAddedUserEvent { - - /** - * 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 AdminAddedUserEvent (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; - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 Häder + */ +public class AdminAddedUserEvent implements ObservableAdminAddedUserEvent { + + /** + * 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 AdminAddedUserEvent (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/ObservableAdminAddedUserEvent.java b/src/org/mxchange/jusercore/events/user/add/ObservableAdminAddedUserEvent.java index c76f57d..c8961af 100644 --- a/src/org/mxchange/jusercore/events/user/add/ObservableAdminAddedUserEvent.java +++ b/src/org/mxchange/jusercore/events/user/add/ObservableAdminAddedUserEvent.java @@ -1,37 +1,37 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 Häder - */ -public interface ObservableAdminAddedUserEvent extends Serializable { - - /** - * Getter for added user instance - *

- * @return Added user instance - */ - User getAddedUser (); - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 Häder + */ +public interface ObservableAdminAddedUserEvent extends Serializable { + + /** + * Getter for added user instance + *

+ * @return Added user instance + */ + User getAddedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/delete/AdminDeletedUserEvent.java b/src/org/mxchange/jusercore/events/user/delete/AdminDeletedUserEvent.java index 8001a85..7449f94 100644 --- a/src/org/mxchange/jusercore/events/user/delete/AdminDeletedUserEvent.java +++ b/src/org/mxchange/jusercore/events/user/delete/AdminDeletedUserEvent.java @@ -1,78 +1,78 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.delete; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has deleted a user account - *

- * @author Roland Häder - */ -public class AdminDeletedUserEvent implements ObservableAdminDeletedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Deleted user instance - */ - private final User deletedUser; - - /** - * Delete reason - */ - private final String userDeleteReason; - - /** - * Constructor with deleted user instance - *

- * @param deletedUser Deleted user instance - * @param userDeleteReason Delete reason - */ - public AdminDeletedUserEvent (final User deletedUser, final String userDeleteReason) { - // Is the user instance valid? - if (null == deletedUser) { - // Throw NPE - throw new NullPointerException("deletedUser is null"); //NOI18N - } else if (deletedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("deletedUser.userId is null"); //NOI18N - } else if (deletedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("deletedUser.userId={0} is invalid.", deletedUser.getUserId())); //NOI18N - } - - // Set it here - this.deletedUser = deletedUser; - this.userDeleteReason = userDeleteReason; - } - - @Override - public User getDeletedUser () { - return this.deletedUser; - } - - @Override - public String getUserDeleteReason () { - return this.userDeleteReason; - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.delete; + +import java.text.MessageFormat; +import org.mxchange.jusercore.model.user.User; + +/** + * An event being fired when the administrator has deleted a user account + *

+ * @author Roland Häder + */ +public class AdminDeletedUserEvent implements ObservableAdminDeletedUserEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_785_787_174_676_290L; + + /** + * Deleted user instance + */ + private final User deletedUser; + + /** + * Delete reason + */ + private final String userDeleteReason; + + /** + * Constructor with deleted user instance + *

+ * @param deletedUser Deleted user instance + * @param userDeleteReason Delete reason + */ + public AdminDeletedUserEvent (final User deletedUser, final String userDeleteReason) { + // Is the user instance valid? + if (null == deletedUser) { + // Throw NPE + throw new NullPointerException("deletedUser is null"); //NOI18N + } else if (deletedUser.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("deletedUser.userId is null"); //NOI18N + } else if (deletedUser.getUserId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("deletedUser.userId={0} is invalid.", deletedUser.getUserId())); //NOI18N + } + + // Set it here + this.deletedUser = deletedUser; + this.userDeleteReason = userDeleteReason; + } + + @Override + public User getDeletedUser () { + return this.deletedUser; + } + + @Override + public String getUserDeleteReason () { + return this.userDeleteReason; + } + +} diff --git a/src/org/mxchange/jusercore/events/user/delete/ObservableAdminDeletedUserEvent.java b/src/org/mxchange/jusercore/events/user/delete/ObservableAdminDeletedUserEvent.java index fe98f94..d4d9e89 100644 --- a/src/org/mxchange/jusercore/events/user/delete/ObservableAdminDeletedUserEvent.java +++ b/src/org/mxchange/jusercore/events/user/delete/ObservableAdminDeletedUserEvent.java @@ -1,44 +1,44 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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.delete; - -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 Häder - */ -public interface ObservableAdminDeletedUserEvent extends Serializable { - - /** - * Getter for deleted user instance - *

- * @return Deleted user instance - */ - User getDeletedUser (); - - /** - * Getter for user delete reason - *

- * @return User delete reason - */ - String getUserDeleteReason (); - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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.delete; + +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 Häder + */ +public interface ObservableAdminDeletedUserEvent extends Serializable { + + /** + * Getter for deleted user instance + *

+ * @return Deleted user instance + */ + User getDeletedUser (); + + /** + * Getter for user delete reason + *

+ * @return User delete reason + */ + String getUserDeleteReason (); + +} diff --git a/src/org/mxchange/jusercore/events/user/helper/created/HelperCreatedUserEvent.java b/src/org/mxchange/jusercore/events/user/helper/created/HelperCreatedUserEvent.java new file mode 100644 index 0000000..dfd037e --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/helper/created/HelperCreatedUserEvent.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2017 Roland Häder + * + * 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.helper.created; + +import org.mxchange.jusercore.model.user.User; + +/** + * An event being fired when a bean helper has successfully created a user + * instance. This may happen when a user profile was called. + *

+ * @author Roland Häder + */ +public class HelperCreatedUserEvent implements ObservableHelperCreatedUserEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 24_138_056_876_716_451L; + + /** + * User instance being created + */ + private final User createdUser; + + /** + * Constructor with user instance + *

+ * @param createdUser User instance being created by helper + */ + public HelperCreatedUserEvent (final User createdUser) { + // Set user instance + this.createdUser = createdUser; + } + + @Override + public User getCreatedUser () { + return this.createdUser; + } + +} diff --git a/src/org/mxchange/jusercore/events/user/helper/created/ObservableHelperCreatedUserEvent.java b/src/org/mxchange/jusercore/events/user/helper/created/ObservableHelperCreatedUserEvent.java new file mode 100644 index 0000000..a9990f8 --- /dev/null +++ b/src/org/mxchange/jusercore/events/user/helper/created/ObservableHelperCreatedUserEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 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.helper.created; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.User; + +/** + * An interface for observable events being fired when a user instance was + * successfully created in a bean helper. + *

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

+ * @return Created user instance + */ + User getCreatedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java b/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java index a60b0a6..93e2b9b 100644 --- a/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java +++ b/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java @@ -1,66 +1,66 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 Häder - */ -public class AdminUpdatedUserDataEvent implements ObservableAdminUpdatedUserDataEvent { - - /** - * 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 AdminUpdatedUserDataEvent (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; - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 Häder + */ +public class AdminUpdatedUserDataEvent implements ObservableAdminUpdatedUserDataEvent { + + /** + * 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 AdminUpdatedUserDataEvent (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; + } + +} diff --git a/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java b/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java index 3218e17..eb5c78d 100644 --- a/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java +++ b/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java @@ -1,36 +1,36 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 Häder - */ -public interface ObservableAdminUpdatedUserDataEvent extends Serializable { - - /** - * Getter for updated user instance - *

- * @return Added user instance - */ - User getUpdatedUser (); - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 Häder + */ +public interface ObservableAdminUpdatedUserDataEvent extends Serializable { + + /** + * Getter for updated user instance + *

+ * @return Added user instance + */ + User getUpdatedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java index a104611..1227e63 100644 --- a/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java +++ b/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java @@ -1,36 +1,36 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 a user updates personal data. - *

- * @author Roland Häder - */ -public interface ObservableUpdatedUserPersonalDataEvent extends Serializable { - - /** - * Getter for updated user instance - *

- * @return Added user instance - */ - User getUpdatedUser (); - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 a user updates personal data. + *

+ * @author Roland Häder + */ +public interface ObservableUpdatedUserPersonalDataEvent extends Serializable { + + /** + * Getter for updated user instance + *

+ * @return Updated user instance + */ + User getUpdatedUser (); + +} diff --git a/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java index 4c85964..7458fe2 100644 --- a/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java +++ b/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java @@ -1,66 +1,66 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * 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 user has updated personal data - *

- * @author Roland Häder - */ -public class UpdatedUserPersonalDataEvent implements ObservableUpdatedUserPersonalDataEvent { - - /** - * 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 UpdatedUserPersonalDataEvent (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; - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 user has updated personal data + *

+ * @author Roland Häder + */ +public class UpdatedUserPersonalDataEvent implements ObservableUpdatedUserPersonalDataEvent { + + /** + * 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 UpdatedUserPersonalDataEvent (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; + } + +} -- 2.39.5