* @param mergedPool
* @return
*/
private EntitlementCertificate generateEntitlementCertificate(
Pool pool, Entitlement e, boolean generateUeberCert) {
Subscription sub = null;
if (pool.getSubscriptionId() != null) {
sub = subAdapter.getSubscription(pool.getSubscriptionId());
}
Product product = null;
/*
* If we have a subscription for this pool, the products we need are already
* loaded as this saves us some product adapter lookups.
*
* If not we'll have to look them up based on the pool's data.
*/
if (sub != null) {
// Need to make sure that we check for a defined sub product
// if it is a derived pool.
boolean derived = pool.getType() != PoolType.NORMAL;
product = derived && sub.getDerivedProduct() != null ? sub.getDerivedProduct() :
sub.getProduct();
}
else {
// Some pools may not have a subscription, i.e. derived from stack pools.
product = productCache.getProductById(e.getProductId());
}