return toReturn;
}
public Set<X509ExtensionWrapper> subscriptionExtensions(Entitlement ent) {
Pool pool = ent.getPool();
SimpleDateFormat iso8601DateFormat = Util.getUTCDateFormat();
Set<X509ExtensionWrapper> toReturn = new LinkedHashSet<X509ExtensionWrapper>();
// Subscription/order info
// need the sub product name, not id here
// NOTE: order ~= subscription
// entitlement == entitlement
String subscriptionOid = OIDUtil.REDHAT_OID + "." +
OIDUtil.TOPLEVEL_NAMESPACES.get(OIDUtil.ORDER_NAMESPACE_KEY);
if (pool.getProductId() != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_NAME_KEY), false, ent
.getPool().getProductName()));
}
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_NUMBER_KEY), false, pool
.getOrderNumber()));
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_SKU_KEY), false,
pool.getProductId().toString()));
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_QUANTITY_KEY), false, pool
.getQuantity().toString()));
String socketLimit = pool.getProductAttributeValue("sockets");
if (socketLimit != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_SOCKETLIMIT_KEY), false,
socketLimit));
}
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_STARTDATE_KEY), false,
iso8601DateFormat.format(pool.getStartDate())));
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_ENDDATE_KEY), false,
iso8601DateFormat.format(pool.getEndDate())));
// TODO : use keys
String warningPeriod = pool.getProductAttributeValue(
"warning_period");
if (warningPeriod == null) {
warningPeriod = "0";
}
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_WARNING_PERIOD), false,
warningPeriod));
if (pool.getContractNumber() != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_CONTRACT_NUMBER_KEY),
false, pool.getContractNumber()));
}
// Add the account number
if (pool.getAccountNumber() != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_ACCOUNT_NUMBER_KEY),
false, pool.getAccountNumber()));
}
// Add Smart Management, default to "not managed"
String mgmt = pool.getProductAttributeValue("management_enabled");
mgmt = (mgmt == null) ? "0" : mgmt;
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_PROVIDES_MANAGEMENT_KEY),
false, mgmt));
String supportLevel = pool.getProductAttributeValue(
"support_level");
String supportType = pool.getProductAttributeValue("support_type");
if (supportLevel != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_SUPPORT_LEVEL), false,
supportLevel));
}
if (supportType != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_SUPPORT_TYPE), false,
supportType));
}
String stackingId = pool.getProductAttributeValue("stacking_id");
if (stackingId != null) {
toReturn.add(new X509ExtensionWrapper(subscriptionOid + "." +
OIDUtil.ORDER_OIDS.get(OIDUtil.ORDER_STACKING_ID), false,
stackingId));
}