/** * Retrieves {@link GiftCertificate} given the gift certificate code. If that gift certificate is * not within the given store, returns <code>null</code>. * * @param giftCertificateCode Gift Certificate Code to compare with * @param store the store to search * @return a {@link GiftCertificate} */ public GiftCertificate findByGiftCertificateCode( final String giftCertificateCode, final Store store) { if (giftCertificateCode == null) { throw new IllegalArgumentException( "Gift certificate code (" + giftCertificateCode + ") and store (" + store + ") can not be null"); } String code = giftCertificateCode.trim(); GiftCertificate giftCertificate = getSingleResultFromNamedQuery( "GIFT_CERTIFICATE_FIND_BY_CODE_AND_STORE", code, store.getUidPk()); return giftCertificate; }