From: Roland Häder Date: Thu, 19 May 2016 15:53:09 +0000 (+0200) Subject: added event for confirmed user accounts X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=034d967492d67d18ad9d51256a5285bee8e2e5a4;p=juser-activity-core.git added event for confirmed user accounts --- diff --git a/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java b/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java new file mode 100644 index 0000000..0481159 --- /dev/null +++ b/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java @@ -0,0 +1,71 @@ +/* + * 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.confirmation; + +import java.text.MessageFormat; +import org.mxchange.jusercore.model.user.User; + +/** + * An event, fireed if a new confirmedUser has confirmed + *

+ * @author Roland Haeder + */ +public class ConfirmedUserAccountEvent implements UserConfirmedAccountEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 575_412_375_267_190L; + + /** + * Newly confirmed user + */ + private final User confirmedUser; + + /** + * Constructor with newly confirmed confirmedUser + *

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

+ * @return User instance + */ + @Override + public User getConfirmedUser () { + return this.confirmedUser; + } + +} diff --git a/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java b/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java new file mode 100644 index 0000000..1bbea50 --- /dev/null +++ b/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.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.confirmation; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.User; + +/** + * An event interface, fireed if a new user has registered + *

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

+ * @return User instance + */ + User getConfirmedUser (); + +}