/*
* Return a branding object for the given engineering product ID if one exists for
* the pool in question.
*/
private Branding getBranding(Pool pool, String productId) {
Branding resultBranding = null;
for (Branding b : pool.getBranding()) {
if (b.getProductId().equals(productId)) {
if (resultBranding == null) {
resultBranding = b;
}
else {
// Warn, but use the first brand name we encountered:
log.warn("Found multiple brand names: product={}, contract={}, " +
"owner={}", productId, pool.getContractNumber(),
pool.getOwner().getKey());
}
}
}
// If none exist, use null strings
return resultBranding != null ? resultBranding :
new Branding(productId, null, null);
}