Returns the number of cp instances where CPDefinitionId = &#63; and sku = &#63;.

@param CPDefinitionId the cp definition ID
@param sku the sku
@return the number of matching cp instances
436400
@Override
	public int countByC_S(long CPDefinitionId, String sku) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S;

		Object[] finderArgs = new Object[] { CPDefinitionId, sku };

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

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

			query.append(_SQL_COUNT_CPINSTANCE_WHERE);

			query.append(_FINDER_COLUMN_C_S_CPDEFINITIONID_2);

			boolean bindSku = false;

			if (sku == null) {
				query.append(_FINDER_COLUMN_C_S_SKU_1);
			}
			else if (sku.equals("")) {
				query.append(_FINDER_COLUMN_C_S_SKU_3);
			}
			else {
				bindSku = true;

				query.append(_FINDER_COLUMN_C_S_SKU_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 (bindSku) {
					qPos.add(sku);
				}

				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();
	}
370356
public static List<CPDefinitionInventory> findByUuid_C(String uuid,
		long companyId) {
		return getPersistence().findByUuid_C(uuid, companyId);
	}
928339
@Override
	public List<CommerceDiscountRel> findByCN_CPK(long classNameId, long classPK) {
		return findByCN_CPK(classNameId, classPK, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
494217
@Override
	public CPDefinition create(long CPDefinitionId) {
		CPDefinition cpDefinition = new CPDefinitionImpl();

		cpDefinition.setNew(true);
		cpDefinition.setPrimaryKey(CPDefinitionId);

		String uuid = PortalUUIDUtil.generate();

		cpDefinition.setUuid(uuid);

		cpDefinition.setCompanyId(companyProvider.getCompanyId());

		return cpDefinition;
	}
1069390
@Override
	public com.liferay.commerce.product.model.CPDefinitionLink addCPDefinitionLink(
		com.liferay.commerce.product.model.CPDefinitionLink cpDefinitionLink) {
		return _cpDefinitionLinkLocalService.addCPDefinitionLink(cpDefinitionLink);
	}
748497
JcrPropertyDefinition getPropertyDefinition( PropertyDefinitionId definitionId ) {
        if (definitionId == null) return null;
        return nodeTypes().getPropertyDefinition(definitionId);
    }
1351012
@Override
	public int countByCN_CPK(long classNameId, long classPK) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_CN_CPK;

		Object[] finderArgs = new Object[] { classNameId, classPK };

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

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

			query.append(_SQL_COUNT_COMMERCEDISCOUNTREL_WHERE);

			query.append(_FINDER_COLUMN_CN_CPK_CLASSNAMEID_2);

			query.append(_FINDER_COLUMN_CN_CPK_CLASSPK_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(classNameId);

				qPos.add(classPK);

				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();
	}
501864
@Override
	public void removeByCPDefinitionId(long CPDefinitionId) {
		for (CPDefinitionOptionRel cpDefinitionOptionRel : findByCPDefinitionId(
				CPDefinitionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(cpDefinitionOptionRel);
		}
	}
1314684
@Override
	public List<CPDefinitionLink> findAll() {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
1254150
public void setCPDefinitionLinkService(
		com.liferay.commerce.product.service.CPDefinitionLinkService cpDefinitionLinkService) {
		this.cpDefinitionLinkService = cpDefinitionLinkService;
	}
876517
@Override
	public void removeByC_SC(long CPDefinitionId, boolean skuContributor) {
		for (CPDefinitionOptionRel cpDefinitionOptionRel : findByC_SC(
				CPDefinitionId, skuContributor, QueryUtil.ALL_POS,
				QueryUtil.ALL_POS, null)) {
			remove(cpDefinitionOptionRel);
		}
	}
621044
@Override
	public int countByC_C(long CPDefinitionId, String CPInstanceUuid) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C;

		Object[] finderArgs = new Object[] { CPDefinitionId, CPInstanceUuid };

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

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

			query.append(_SQL_COUNT_CPINSTANCE_WHERE);

			query.append(_FINDER_COLUMN_C_C_CPDEFINITIONID_2);

			boolean bindCPInstanceUuid = false;

			if (CPInstanceUuid == null) {
				query.append(_FINDER_COLUMN_C_C_CPINSTANCEUUID_1);
			}
			else if (CPInstanceUuid.equals("")) {
				query.append(_FINDER_COLUMN_C_C_CPINSTANCEUUID_3);
			}
			else {
				bindCPInstanceUuid = true;

				query.append(_FINDER_COLUMN_C_C_CPINSTANCEUUID_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 (bindCPInstanceUuid) {
					qPos.add(CPInstanceUuid);
				}

				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();
	}
89550
public static com.liferay.commerce.product.model.CPDefinition createCPDefinition(
		long CPDefinitionId) {
		return getService().createCPDefinition(CPDefinitionId);
	}
846754
public static com.liferay.commerce.model.CPDefinitionInventory addCPDefinitionInventory(
		com.liferay.commerce.model.CPDefinitionInventory cpDefinitionInventory) {
		return getService().addCPDefinitionInventory(cpDefinitionInventory);
	}
133882
@Override
	public List<CPDefinitionLocalization> findByCPDefinitionId(
		long CPDefinitionId) {
		return findByCPDefinitionId(CPDefinitionId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
472680
@Override
	public List<CPDefinition> getCPDefinitionsByUuidAndCompanyId(String uuid,
		long companyId) {
		return cpDefinitionPersistence.findByUuid_C(uuid, companyId);
	}
779119
@Override
	public CPDefinitionInventory create(long CPDefinitionInventoryId) {
		CPDefinitionInventory cpDefinitionInventory = new CPDefinitionInventoryImpl();

		cpDefinitionInventory.setNew(true);
		cpDefinitionInventory.setPrimaryKey(CPDefinitionInventoryId);

		String uuid = PortalUUIDUtil.generate();

		cpDefinitionInventory.setUuid(uuid);

		cpDefinitionInventory.setCompanyId(companyProvider.getCompanyId());

		return cpDefinitionInventory;
	}