From 2a84e23b84926d175b113237ecb5abc94046231b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 15 Aug 2016 14:23:13 +0200 Subject: [PATCH] Please cherry-pick: - sorted members --- .../phone/JobsPhoneSessionBean.java | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java index ea86c99..9101821 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java @@ -49,45 +49,6 @@ public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneS public JobsPhoneSessionBean () { } - @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 NullPointerException("cellphoneId is null"); //NOI18N - } else if (cellphoneId < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("cellphoneId={0} is not valid.", cellphoneId)); //NOI18N - } - - // Now find it - Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", CellphoneNumber.class); //NOI18N - - // Set parameter - query.setParameter("cellphoneId", cellphoneId); //NOI18N - - // Init instance - DialableCellphoneNumber cellphone = null; - - // Try to get a result - try { - // Get a single result - cellphone = (DialableCellphoneNumber) query.getSingleResult(); - } catch (NoResultException ex) { - // The entry was not found, so throw it again - 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") @Override public List allCellphoneNumbers () { @@ -145,4 +106,43 @@ public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneS return list; } + @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 NullPointerException("cellphoneId is null"); //NOI18N + } else if (cellphoneId < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("cellphoneId={0} is not valid.", cellphoneId)); //NOI18N + } + + // Now find it + Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", CellphoneNumber.class); //NOI18N + + // Set parameter + query.setParameter("cellphoneId", cellphoneId); //NOI18N + + // Init instance + DialableCellphoneNumber cellphone = null; + + // Try to get a result + try { + // Get a single result + cellphone = (DialableCellphoneNumber) query.getSingleResult(); + } catch (NoResultException ex) { + // The entry was not found, so throw it again + 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; + } + } -- 2.39.5