@Override
public void resendConfirmationLink (final User user, final Locale locale, final String baseUrl) {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("resendConfirmationLink: user={0},locale={1},baseUrl={2} - CALLED!", user, locale, baseUrl)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.resendConfirmationLink: user={1},locale={2},baseUrl={3} - CALLED!", this.getClass().getSimpleName(), user, locale, baseUrl)); //NOI18N
// The user instance should be valid
if (null == user) {
this.sendEmail("Resend confirmation link", "resend_confirmation_link", emailAddress, user, baseUrl); //NOI18N
// Log trace message
- this.getLoggerBeanLocal().logTrace("resendConfirmationLink: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.resendConfirmationLink: EXIT!", this.getClass().getSimpleName())); //NOI18N
}
}
@PostConstruct
public void init () {
// Trace message
- this.getLoggerBeanLocal().logTrace("init: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: CALLED!", this.getClass().getSimpleName())); //NOI18N
// Try to load bundle
ResourceBundle bundle = ResourceBundle.getBundle(this.configFile);
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("init: bundle={0}", bundle)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: bundle={1}", this.getClass().getSimpleName(), bundle)); //NOI18N
// The bunble should be valid
if (null == bundle) {
// Loop through all
for (final String key : bundle.keySet()) {
// Log debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("init: key={0}", key)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: key={1}", this.getClass().getSimpleName(), key)); //NOI18N
// Get string from bundle and set it in properties
properties.put(key, bundle.getString(key));
this.mailer.init(properties);
// Trace message
- this.getLoggerBeanLocal().logTrace("init: EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: EXIT!", this.getClass().getSimpleName())); //NOI18N
}
@Override
public void onMessage (final Message message) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("onMessage: message={0} - CALLED!", message)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: message={1} - CALLED!", this.getClass().getSimpleName(), message)); //NOI18N
// The parameter should be valid
if (null == message) {
}
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("onMessage: serializable={0}", serializable)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.onMessage: serializable={1}", this.getClass().getSimpleName(), serializable)); //NOI18N
// Okay, is it the right interface?
if (null == serializable) {
}
// Trace message
- this.getLoggerBeanLocal().logTrace("onMessage - EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage - EXIT!", this.getClass().getSimpleName())); //NOI18N
}
}
package org.mxchange.jcontacts.contact;
import java.text.MessageFormat;
+import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
@Override
public Contact addContact (final Contact contact) throws ContactAlreadyAddedException {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
+
+ // Is the instance set?
+ if (null == contact) {
+ // Throw NPE
+ throw new NullPointerException("contact is null"); //NOI18N
+ } else if (contact.getContactId() != null) {
+ // Should be null
+ throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} - is not null", contact.getContactId())); //NOI18N
+ }
+
+ // Set created timestamp
+ contact.setContactCreated(new GregorianCalendar());
+
+ // Set all created timestamps, if instance is there
+ this.setAllContactPhoneEntriesCreated(contact);
+
+ // Persist it
+ this.getEntityManager().persist(contact);
+
+ // Flush it to get contactId set
+ this.getEntityManager().flush();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact.contactId={1} after persisting - EXIT!", this.getClass().getSimpleName(), contact.getContactId())); //NOI18N
+
+ // Return it
+ return contact;
}
@Override
public Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactByEmailAddress: emailAddress={0} - CALLED!", emailAddress)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
// The parameter must be valid
if (null == emailAddress) {
contact = (Contact) query.getSingleResult();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactByEmailAddress: Found contact={0}", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: Found contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
} catch (final NoResultException ex) {
// No result found
throw new ContactNotFoundException(emailAddress, ex);
}
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactByEmailAddress: contact={0} - EXIT!", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: contact={1} - EXIT!", this.getClass().getSimpleName(), contact)); //NOI18N
// Return found instance
return contact;
@Override
public Contact findContactById (final Long contactId) throws ContactNotFoundException {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: contactId={0} - CALLED!", contactId)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: contactId={1} - CALLED!", this.getClass().getSimpleName(), contactId)); //NOI18N
// The parameter must be valid
if (null == contactId) {
contact = (Contact) query.getSingleResult();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: Found contact={0}", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: Found contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
} catch (final NoResultException ex) {
// No result found
throw new ContactNotFoundException(contactId, ex);
}
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: contact={0} - EXIT!", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: contact={1} - EXIT!", this.getClass().getSimpleName(), contact)); //NOI18N
// Return found instance
return contact;
@SuppressWarnings ("unchecked")
public List<Contact> getAllContacts () {
// Log trace message
- this.getLoggerBeanLocal().logTrace("getAllContacts - CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getAllContacts - CALLED!", this.getClass().getSimpleName())); //NOI18N
// Create query instance
Query query = this.getEntityManager().createNamedQuery("AllContacts", UserContact.class); //NOI18N
List<Contact> contacts = query.getResultList();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("getAllContacts: contacts.size()={0} - EXIT!", contacts.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getAllContacts: contacts.size()={1} - EXIT!", this.getClass().getSimpleName(), contacts.size())); //NOI18N
// Return it
return contacts;
@SuppressWarnings ("unchecked")
public List<String> getEmailAddressList () {
// Log trace message
- this.getLoggerBeanLocal().logTrace("getEmailAddressList - CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList - CALLED!", this.getClass().getSimpleName())); //NOI18N
// Create query instance
Query query = this.getEntityManager().createNamedQuery("AllContactEmailAddresses", String.class); //NOI18N
List<String> emailAddresses = query.getResultList();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("getEmailAddressList: emailAddresses.size()={0} - EXIT!", emailAddresses.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: emailAddresses.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddresses.size())); //NOI18N
// Return it
return emailAddresses;
@Override
public boolean isEmailAddressRegistered (final String emailAddress) {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: emailAddress={0} - CALLED!", emailAddress)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
// The email address should be valid
if (null == emailAddress) {
// Is null
- throw new NullPointerException("emailAddress is null");
+ throw new NullPointerException("emailAddress is null"); //NOI18N
} else if (emailAddress.isEmpty()) {
// Is empty
- throw new IllegalArgumentException("emailAddress is empty");
+ throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
}
// Default is not found
Contact contact = this.findContactByEmailAddress(emailAddress);
// Log debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressRegistered: Found contact={0} for emailAddress={1}", contact, emailAddress));
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: Found contact={1} for emailAddress={2}", this.getClass().getSimpleName(), contact, emailAddress)); //NOI18N
// It is found ...
isFound = true;
}
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: isFound={0} - EXIT!", isFound));
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: isFound={1} - EXIT!", this.getClass().getSimpleName(), isFound)); //NOI18N
// Return status
return isFound;
@Override
public Contact lookupContact (final Contact contact) {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isContactFound: contact={0} - CALLED!", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
// Parameter should be valid
if (null == contact) {
// Is the list empty?
if (contacts.isEmpty()) {
// Then abort here
- this.getLoggerBeanLocal().logTrace("isContactFound: No contacts registered, returning 'false' ..."); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: No contacts registered, returning NULL ...", this.getClass().getSimpleName())); //NOI18N
return null;
}
// Is same contact?
if ((Objects.equals(contact, next)) || (ContactUtils.isSameContact(contact, next))) {
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isContactFound: Found same contact, id={0}", next.getContactId())); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isContactFound: Found same contact: contactId={1}", this.getClass().getSimpleName(), next.getContactId())); //NOI18N
// Found it
foundContact = next;
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isContactFound: foundContact={0} - EXIT!", foundContact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: foundContact={1} - EXIT!", this.getClass().getSimpleName(), foundContact)); //NOI18N
// Return found contact
return foundContact;
@Override
public Contact updateContactData (final Contact contact, final boolean isCellphoneUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateContactData: contact={0},isCellphoneUnlinked={1},isLandlineUnlinked={2},isFaxUnlinked={3} - CALLED!", contact, isCellphoneUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: contact={1},isCellphoneUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED!", this.getClass().getSimpleName(), contact, isCellphoneUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
// The contact instance must be valid
if (null == contact) {
Contact detachedContact = this.mergeContactData(contact);
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateContactData: detachedContact={0} - EXIT!", detachedContact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: detachedContact={1} - EXIT!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
// Return it
return detachedContact;
@Override
public Contact updateContactData (final Contact contact) {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateContactData: contact={0} - CALLED!", contact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
// The contact instance must be valid
if (null == contact) {
Contact detachedContact = this.updateContactData(contact, isCellphoneUnlinked, isLandLineUnlinked, isFaxUnlinked);
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateContactData: detachedContact={0} - EXIT!", detachedContact)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: detachedContact={1} - EXIT!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
// Return it
return detachedContact;
@Override
public Country addCountry (final Country country) throws CountryAlreadyAddedException {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addCountry: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N
+
// Is it already there?
if (null == country) {
// Throw NPE
// Flush it to get id number back, maybe it is directly needed?
this.getEntityManager().flush();
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addCountry: country={1} - EXIT!", this.getClass().getSimpleName(), country)); //NOI18N
+
// Return updated instance
return country;
}
@Override
@SuppressWarnings ("unchecked")
public List<Country> allCountries () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCountries: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
// Init query
Query query = this.getEntityManager().createNamedQuery("AllCountries", CountryData.class); //NOI18N
+ // Get list
+ List<Country> countries = query.getResultList();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCountries: countries.size()={1} - EXIT!", this.getClass().getSimpleName(), countries.size())); //NOI18N
+
// Return it
- return query.getResultList();
+ return countries;
}
/**
@Override
public MobileProvider addMobileProvider (final MobileProvider mobileProvider) throws MobileProviderAlreadyAddedException {
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("addMobileProvider: mobileProvider={0} - CALLED!", mobileProvider)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addMobileProvider: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
// Is the instance valid?
if (null == mobileProvider) {
this.getEntityManager().flush();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("addMobileProvider: mobileProvider.providerId={0} - EXIT!", mobileProvider.getProviderId())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addMobileProvider: mobileProvider.providerId={1} - EXIT!", this.getClass().getSimpleName(), mobileProvider.getProviderId())); //NOI18N
// Return updated
return mobileProvider;
*/
package org.mxchange.jphone.phonenumbers.mobileprovider;
+import java.text.MessageFormat;
import java.util.List;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Override
@SuppressWarnings ("unchecked")
public List<MobileProvider> allMobileProvider () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileProvider: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
// Init query
Query query = this.getEntityManager().createNamedQuery("AllMobileProvider", CellphoneProvider.class); //NOI18N
+ // Get list from it
+ List<MobileProvider> mobileProviders = query.getResultList();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileProvider: mobileProviders.size()={1} - EXIT!", this.getClass().getSimpleName(), mobileProviders.size())); //NOI18N
+
// Return it
- return query.getResultList();
+ return mobileProviders;
}
}
package org.mxchange.jphone.phonenumbers.phone;
import java.text.MessageFormat;
+import java.util.LinkedList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.NoResultException;
@Override
@SuppressWarnings ("unchecked")
public List<Contact> allContacts (final DialableCellphoneNumber cellPhone) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allContacts: cellPhone={1} - CALLED!", this.getClass().getSimpleName(), cellPhone)); //NOI18N
+
// The parameter should be valid
if (null == cellPhone) {
// Throw NPE
}
// Init list instance
- List<Contact> contacts = null;
+ List<Contact> contacts = new LinkedList<>();
// Get query object from all found contact-cellphone links
Query query = this.getEntityManager().createNamedQuery("AllContactsByCellphone", UserContact.class); //NOI18N
// No results found
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allContacts: contacts.size()={1} - EXIT!", this.getClass().getSimpleName(), contacts.size())); //NOI18N
+
// Return list
return contacts;
}
@Override
public DialableCellphoneNumber findCellphoneById (final Long cellphoneId) throws PhoneEntityNotFoundException {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCellphoneById: cellphoneId={1} - CALLED!", this.getClass().getSimpleName(), cellphoneId)); //NOI18N
+
// The id number should be valid
if (null == cellphoneId) {
// Throw NPE
throw new PhoneEntityNotFoundException(cellphoneId, ex);
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCellphoneById: cellphone={1} - EXIT!", this.getClass().getSimpleName(), cellphone)); //NOI18N
+
// Return found instance
return cellphone;
}
@SuppressWarnings ("unchecked")
public List<String> allQueuedAddresses () {
// Trace message
- this.getLoggerBeanLocal().logTrace("allQueuedAddressesAsList: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allQueuedAddresses: CALLED!", this.getClass().getSimpleName())); //NOI18N
// Get named query
Query query = this.getEntityManager().createNamedQuery("AllEmailAddressChanges", String.class); //NOI18N
List<String> emailAddresses = query.getResultList();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("allQueuedAddressesAsList: emailAddresses.size()={0} - EXIT!", emailAddresses.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allQueuedAddresses: emailAddresses.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddresses.size())); //NOI18N
// Return it
return emailAddresses;
@Override
public void enqueueEmailAddressForChange (final ChangeableEmailAddress emailChange, final String baseUrl) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("enqueueEmailAddressForChange: emailChange={0},baseUrl={1} - CALLED!", emailChange, baseUrl)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.enqueueEmailAddressForChange: emailChange={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), emailChange, baseUrl)); //NOI18N
// Email address change should be valid
if (null == emailChange) {
this.generateSecureHash(emailChange);
// Persist it
- //this.getEntityManager().persist(emailChange);
-
+ //@TODO Fix email delivery then allow this: this.getEntityManager().persist(emailChange);
// Init variable
Address emailAddress;
this.sendEmail("Email change", "email_change", emailAddress, emailChange.getEmailChangeUser(), baseUrl); //NOI18N
// Trace message
- this.getLoggerBeanLocal().logTrace("enqueueEmailAddressForChange - EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.enqueueEmailAddressForChange - EXIT!", this.getClass().getSimpleName())); //NOI18N
}
@Override
public boolean isEmailAddressEnqueued (final String emailAddress) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressEnqueued: emailAddress={0} - CALLED!", emailAddress)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressEnqueued: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
// Create query instance
Query query = this.getEntityManager().createNamedQuery("SearchEmailChangeByEmail"); //NOI18N
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressEnqueued: isFound={0} - EXIT!", isFound)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressEnqueued: isFound={1} - EXIT!", this.getClass().getSimpleName(), isFound)); //NOI18N
// Return it
return isFound;
@Override
public void updateEmailAddress (final ChangeableEmailAddress emailAddress) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateEmailAddress: emailAddress={0} - CALLED!", emailAddress)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateEmailAddress: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
// Email address change should be valid
if (null == emailAddress) {
@Override
public User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("loginUser: container={0} - CALLED!", container)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.loginUser: container={1} - CALLED!", this.getClass().getSimpleName(), container)); //NOI18N
// Check some beans
assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("loginUser: updatedUser={0} - EXIT!", updatedUser)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.loginUser: updatedUser={1} - EXIT!", this.getClass().getSimpleName(), updatedUser)); //NOI18N
// Return it
return updatedUser;
* not match, the first one is the one from the calling bean/controller, the
* second is the from database.
* <p>
- * @param container Container instance holding the user instance and
- * unencrypted password
- * @param updatedUser User instance found for given user name
+ * @param container Container instance holding the user instance and
+ * unencrypted password
+ * @param updatedUser Updated user instance found for given user name
* <p>
* @return Whether the password matches
*/
// Is it the same same password?
return UserUtils.ifPasswordMatches(container, updatedUser);
}
+
}
@Override
public String generateConfirmationKey (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("generateConfirmationKey: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateConfirmationKey: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
Contact contact = (Contact) query.getSingleResult();
// Warning message
- this.getLoggerBeanLocal().logWarning(MessageFormat.format("generateConfirmationKey: key {0} already found: contact.contactId={1}", key, contact.getContactId())); //NOI18N
+ this.getLoggerBeanLocal().logWarning(MessageFormat.format("{0}.generateConfirmationKey: key {1} already found: contact.contactId={2}", this.getClass().getSimpleName(), key, contact.getContactId())); //NOI18N
} catch (final NoResultException ex) {
// Not found, normal case
confirmationKey = key;
}
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("generateConfirmationKey: confirmationKey={0} - EXIT!", confirmationKey)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateConfirmationKey: confirmationKey={1} - EXIT!", this.getClass().getSimpleName(), confirmationKey)); //NOI18N
// Return it
return confirmationKey;
@Override
public boolean isEmailAddressRegistered (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// Check bean
assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
@Override
public boolean isUserNameRegistered (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserNameRegistered: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// Check bean
assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
@Override
public User registerUser (final User user, final String baseUrl) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("registerUser: user={0},baseUrl={1} - CALLED!", user, baseUrl)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.registerUser: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
// user should not be null
if (null == user) {
this.sendEmail("Registration", "registration", emailAddress, addedUser, baseUrl); //NOI18N
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("registerUser: addedUser={0},addedUser.userId={1} - EXIT!", addedUser, addedUser.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.registerUser: addedUser={1},addedUser.userId={2} - EXIT!", this.getClass().getSimpleName(), addedUser, addedUser.getUserId())); //NOI18N
// Return it
return addedUser;
@Override
public User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("addUser: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addUser: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
this.getEntityManager().flush();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("addUser: user={0},user.id={1} - EXIT!", user, user.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addUser: user={1},user.userId={2} - EXIT!", this.getClass().getSimpleName(), user, user.getUserId())); //NOI18N
// Return it
return user;
@SuppressWarnings ("unchecked")
public List<User> allMemberPublicVisibleUsers () {
// Trace message
- this.getLoggerBeanLocal().logTrace("allMemberPublicVisibleUsers: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
// Get named query
Query query = this.getEntityManager().createNamedQuery("AllMemberPublicUsers", LoginUser.class); //NOI18N
List<User> users = query.getResultList();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("allMemberPublicVisibleUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
// Return full list
return users;
@SuppressWarnings ("unchecked")
public List<User> allPublicUsers () {
// Trace message
- this.getLoggerBeanLocal().logTrace("allPublicUsers: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
// Get named query
Query query = this.getEntityManager().createNamedQuery("AllPublicUsers", LoginUser.class); //NOI18N
List<User> users = query.getResultList();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("allPublicUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
// Return full list
return users;
@SuppressWarnings ("unchecked")
public List<User> allUsers () {
// Trace message
- this.getLoggerBeanLocal().logTrace("allUsers: CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
// Get named query
Query query = this.getEntityManager().createNamedQuery("AllUsers", LoginUser.class); //NOI18N
List<User> users = query.getResultList();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("allUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
// Return full list
return users;
@Override
public User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("confirmAccount: user={0},baseUrl={1} - CALLED!", user, baseUrl)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
// Parameter must be valid
if (null == user) {
this.sendEmail("Account confirmed", "account_confirmed", emailAddress, updatedUser, baseUrl); //NOI18N
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("confirmAccount: updatedUser={0} - EXIT!", updatedUser)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: updatedUser={1} - EXIT!", this.getClass().getSimpleName(), updatedUser)); //NOI18N
// Return updated instance
return updatedUser;
@Override
public User fillUserData (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: foundUser={0} - EXIT!", foundUser)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: foundUser={1} - EXIT!", this.getClass().getSimpleName(), foundUser)); //NOI18N
// Return prepared instance
return foundUser;
@Override
public User findUserById (final Long userId) throws UserNotFoundException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findUserById: userId={0} - CALLED!", userId)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: userId={1} - CALLED!", this.getClass().getSimpleName(), userId)); //NOI18N
// Is the parameter valid?
if (null == userId) {
User user = (User) query.getSingleResult();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("findUserById: user={0} - EXIT!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
// Return found user
return user;
@Override
public String generateRandomUserName () {
// Trace message
- this.getLoggerBeanLocal().logTrace("generateRandomUserName - CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName - CALLED!", this.getClass().getSimpleName())); //NOI18N
// Get full list
List<String> userList = this.getUserNameList();
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("generateRandomUserName: userName={0} - EXIT!", userName)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName: userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
// Found one, so return it
return userName;
@Override
@SuppressWarnings ("unchecked")
public List<String> getEmailAddressList () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
// Get query
Query query = this.getEntityManager().createNamedQuery("AllEmailAddresses", String.class); //NOI18N
// Get result list
List<String> emailAddressList = query.getResultList();
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: emailAddressList.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddressList.size())); //NOI18N
+
// Return it
return emailAddressList;
}
@Override
@SuppressWarnings ("unchecked")
public List<String> getUserNameList () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
// Get query
Query query = this.getEntityManager().createNamedQuery("AllUserNames", String.class); //NOI18N
// Get result list
List<String> userNameList = query.getResultList();
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: userNameList.size()={1} - EXIT!", this.getClass().getSimpleName(), userNameList.size())); //NOI18N
+
// Return it
return userNameList;
}
@Override
public boolean ifUserExists (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserExists: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// userId should not be null
if (null == user) {
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: Found user {0} - EXIT!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserExists: Found user {1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
// Found it
return true;
@Override
public boolean ifUserIdExists (final Long userId) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: userId={0} - CALLED!", userId)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserIdExists: userId={1} - CALLED!", this.getClass().getSimpleName(), userId)); //NOI18N
// userId should not be null
if (null == userId) {
User dummy = (User) query.getSingleResult();
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserIdExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
} catch (final NoResultException ex) {
// Log it
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: getSingleResult() returned no result: {0}", ex)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserIdExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
// User name does not exist
return false;
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: Found user id {0} - EXIT!", userId)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserIdExists: Found userId={1} - EXIT!", this.getClass().getSimpleName(), userId)); //NOI18N
// Found it
return true;
@Override
public boolean ifUserNameExists (final String userName) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserNameExists: userName={0} - CALLED!", userName)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: userName={1} - CALLED!", this.getClass().getSimpleName(), userName)); //NOI18N
// userId should not be null
if (null == userName) {
User dummy = (User) query.getSingleResult();
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserNameExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
} catch (final NoResultException ex) {
// Log it
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserNameExists: getSingleResult() returned no result: {0}", ex)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
// User name does not exist
return false;
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserNameExists: Found user name {0} - EXIT!", userName)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: Found userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
// Found it
return true;
@Override
public boolean isEmailAddressRegistered (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
User dummy = (User) query.getSingleResult();
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressRegistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
} catch (final NoResultException ex) {
// Log it
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressRegistered: getSingleResult() returned no result: {0}", ex)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
// Email address does not exist
return false;
throw ex;
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
// Found it
return true;
}
@Override
public boolean isUserNameRegistered (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserNameRegistered: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
User dummy = (User) query.getSingleResult();
// Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameRegistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
} catch (final NoResultException ex) {
// Log it
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameRegistered: getSingleResult() returned no result: {0}", ex)); //NOI18N
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
// User name does not exist
return false;
throw ex;
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
// Found it
return true;
}
@Override
public User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkUser: user={0} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
this.getEntityManager().flush();
// Log trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user={0} - EXIT!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkUser: user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
// Return updated instanc
return user;
@Override
public User updateUserData (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserData: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
// Set as updated
detachedUser.setUserUpdated(new GregorianCalendar());
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: detachedUser={1} - CALLED!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+
// Return updated instance
return detachedUser;
}
@Override
public PasswordHistory updateUserPassword (final User user) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPassword: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
this.getEntityManager().flush();
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPassword: entry.userPasswordHistoryId={0} - EXIT!", entry.getUserPasswordHistoryId())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: entry.userPasswordHistoryId={1} - EXIT!", this.getClass().getSimpleName(), entry.getUserPasswordHistoryId())); //NOI18N
// Return it
return entry;
@Override
public User updateUserPersonalData (final User user) {
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPersonalData: user={0} - CALLED!", user)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
// user should not be null
if (null == user) {
detachedContact.setContactLandLineNumber(detachedLandLine);
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: entry.detachedUser={1} - EXIT!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+
// Return updated user instance
return detachedUser;
}
--- /dev/null
+/*
+ * Copyright (C) 2016 Cho-Time GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jusercore.model.user.password_history;
+
+import de.chotime.landingpage.database.BaseLandingDatabaseBean;
+import java.text.MessageFormat;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.Query;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A user password history EJB
+ * <p>
+ * @author Roland Haeder<rhaeder@cho-time.de>
+ */
+@Stateless (name = "userPasswordHistory", description = "A stateless EJB for user's password history. This bean does return the full user's password history and not limited. The application then needs to limit it to it's purpose.")
+public class AddressbookUserPasswordHistorySessionBean extends BaseLandingDatabaseBean implements UserPasswordHistorySessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 395_767_546_195_014L;
+
+ /**
+ * Default constructor
+ */
+ public AddressbookUserPasswordHistorySessionBean () {
+ }
+
+ @Override
+ @SuppressWarnings ("unchecked")
+ public List<PasswordHistory> getUserPasswordHistory (final User user) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
+
+ // user should not be null
+ if (null == user) {
+ // Abort here
+ throw new NullPointerException("user is null"); //NOI18N
+ } else if (user.getUserId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("user.userId is null"); //NOI18N
+ } else if (user.getUserId() < 1) {
+ // Illegal id number
+ throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not allowed.", user.getUserId())); //NOI18N
+ }
+
+ // Get named query
+ Query query = this.getEntityManager().createNamedQuery("AllUsersHistoryEntries", UserPasswordHistory.class); //NOI18N
+
+ // Set parameter
+ query.setParameter("user", user); //NOI18N
+
+ // Get full history
+ List<PasswordHistory> history = query.getResultList();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): history.size()={1} - EXIT !", this.getClass().getSimpleName(), history.size())); //NOI18N
+
+ // Return it
+ return history;
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016 Cho-Time GmbH
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.password_history;
-
-import de.chotime.landingpage.database.BaseLandingDatabaseBean;
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.Query;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A user password history EJB
- * <p>
- * @author Roland Haeder<rhaeder@cho-time.de>
- */
-@Stateless (name = "userPasswordHistory", description = "A stateless EJB for user's password history. This bean does return the full user's password history and not limited. The application then needs to limit it to it's purpose.")
-public class LandingUserPasswordHistorySessionBean extends BaseLandingDatabaseBean implements UserPasswordHistorySessionBeanRemote {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 395_767_546_195_014L;
-
- /**
- * Default constructor
- */
- public LandingUserPasswordHistorySessionBean () {
- }
-
- @Override
- @SuppressWarnings ("unchecked")
- public List<PasswordHistory> getUserPasswordHistory (final User user) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserId() == null) {
- // Throw NPE again
- throw new NullPointerException("user.userId is null"); //NOI18N
- } else if (user.getUserId() < 1) {
- // Illegal id number
- throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not allowed.", user.getUserId())); //NOI18N
- }
-
- // Get named query
- Query query = this.getEntityManager().createNamedQuery("AllUsersHistoryEntries", UserPasswordHistory.class); //NOI18N
-
- // Set parameter
- query.setParameter("user", user); //NOI18N
-
- // Get full history
- List<PasswordHistory> history = query.getResultList();
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): history.size()={1} - EXIT !", this.getClass().getSimpleName(), history.size())); //NOI18N
-
- // Return it
- return history;
- }
-
-}