@Override
	public int countByC_LtD_S(long CPDefinitionId, Date displayDate, int status) {
		FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S;

		Object[] finderArgs = new Object[] {
				CPDefinitionId, _getTime(displayDate), status
			};

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(4);

			query.append(_SQL_COUNT_CPINSTANCE_WHERE);

			query.append(_FINDER_COLUMN_C_LTD_S_CPDEFINITIONID_2);

			boolean bindDisplayDate = false;

			if (displayDate == null) {
				query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
			}
			else {
				bindDisplayDate = true;

				query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
			}

			query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(CPDefinitionId);

				if (bindDisplayDate) {
					qPos.add(new Timestamp(displayDate.getTime()));
				}

				qPos.add(status);

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
@ Override public int countByC_LtD_S ( long CPDefinitionId , Date displayDate , int status ) { FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S ; Object [ ] finderArgs = new Object [ ] { CPDefinitionId , _getTime ( displayDate ) , status } ; Long count = ( Long ) finderCache . getResult ( finderPath , finderArgs , this ) ; if ( count == null ) { StringBundler query = new StringBundler ( 4 ) ; query . append ( _SQL_COUNT_CPINSTANCE_WHERE ) ; query . append ( _FINDER_COLUMN_C_LTD_S_CPDEFINITIONID_2 ) ; boolean bindDisplayDate = false ; if ( displayDate == null ) { query . append ( _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1 ) ; } else { bindDisplayDate = true ; query . append ( _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2 ) ; } query . append ( _FINDER_COLUMN_C_LTD_S_STATUS_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( CPDefinitionId ) ; if ( bindDisplayDate ) { qPos . add ( new Timestamp ( displayDate . getTime ( ) ) ) ; } qPos . add ( status ) ; count = ( Long ) q . uniqueResult ( ) ; finderCache . putResult ( finderPath , finderArgs , count ) ; } catch ( Exception e ) { finderCache . removeResult ( finderPath , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return count . intValue ( ) ; }
Returns the number of cp instances where CPDefinitionId = &#63; and displayDate &lt; &#63; and status = &#63;.

@param CPDefinitionId the cp definition ID
@param displayDate the display date
@param status the status
@return the number of matching cp instances