code: @Override
  	public int filterCountByG_C(long groupId, String couponCode) {
  		if (!InlineSQLHelperUtil.isEnabled(groupId)) {
  			return countByG_C(groupId, couponCode);
  		}
  
  		StringBundler query = new StringBundler(3);
  
  		query.append(_FILTER_SQL_COUNT_COMMERCEDISCOUNT_WHERE);
  
  		query.append(_FINDER_COLUMN_G_C_GROUPID_2);
  
  		boolean bindCouponCode = false;
  
  		if (couponCode == null) {
  			query.append(_FINDER_COLUMN_G_C_COUPONCODE_1);
  		}
  		else if (couponCode.equals("")) {
  			query.append(_FINDER_COLUMN_G_C_COUPONCODE_3);
  		}
  		else {
  			bindCouponCode = true;
  
  			query.append(_FINDER_COLUMN_G_C_COUPONCODE_2);
  		}
  
  		String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
  				CommerceDiscount.class.getName(),
  				_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
  
  		Session session = null;
  
  		try {
  			session = openSession();
  
  			SQLQuery q = session.createSynchronizedSQLQuery(sql);
  
  			q.addScalar(COUNT_COLUMN_NAME,
  				com.liferay.portal.kernel.dao.orm.Type.LONG);
  
  			QueryPos qPos = QueryPos.getInstance(q);
  
  			qPos.add(groupId);
  
  			if (bindCouponCode) {
  				qPos.add(couponCode);
  			}
  
  			Long count = (Long)q.uniqueResult();
  
  			return count.intValue();
  		}
  		catch (Exception e) {
  			throw processException(e);
  		}
  		finally {
  			closeSession(session);
  		}
  	}
docs: Returns the number of commerce discounts that the user has permission to view where groupId = &#63; and couponCode = &#63;.
  
  @param groupId the group ID
  @param couponCode the coupon code
  @return the number of matching commerce discounts that the user has permission to view