}
@Override
public CNSTopicAttributes getTopicAttributes(String topicArn) throws Exception {
CNSTopicAttributes topicAttributes = new CNSTopicAttributes();
topicAttributes.setTopicArn(topicArn);
CmbColumnSlice<String, String> slice = cassandraHandler.readColumnSlice(AbstractDurablePersistence.CNS_KEYSPACE, columnFamilyTopicAttributes, topicArn, null, null, 10, CMB_SERIALIZER.STRING_SERIALIZER, CMB_SERIALIZER.STRING_SERIALIZER, CMB_SERIALIZER.STRING_SERIALIZER);
if (slice != null) {
if (slice.getColumnByName("policy") != null) {
topicAttributes.setPolicy(slice.getColumnByName("policy").getValue());
}
CNSTopicDeliveryPolicy deliveryPolicy = null;
if (slice.getColumnByName("deliveryPolicy") != null) {
deliveryPolicy = new CNSTopicDeliveryPolicy(new JSONObject(slice.getColumnByName("deliveryPolicy").getValue()));
} else {
deliveryPolicy = new CNSTopicDeliveryPolicy();
}
topicAttributes.setEffectiveDeliveryPolicy(deliveryPolicy);
topicAttributes.setDeliveryPolicy(deliveryPolicy);
if (slice.getColumnByName("userId") != null) {
topicAttributes.setUserId(slice.getColumnByName("userId").getValue());
}
topicAttributes.setDisplayName(PersistenceFactory.getTopicPersistence().getTopic(topicArn).getDisplayName());
}
long subscriptionConfirmedCount = cassandraHandler.getCounter(AbstractDurablePersistence.CNS_KEYSPACE, columnFamilyTopicStats, topicArn, "subscriptionConfirmed", CMB_SERIALIZER.STRING_SERIALIZER, CMB_SERIALIZER.STRING_SERIALIZER);
topicAttributes.setSubscriptionsConfirmed(subscriptionConfirmedCount);
long subscriptionPendingCount = cassandraHandler.getCounter(AbstractDurablePersistence.CNS_KEYSPACE, columnFamilyTopicStats, topicArn, "subscriptionPending", CMB_SERIALIZER.STRING_SERIALIZER, CMB_SERIALIZER.STRING_SERIALIZER);
topicAttributes.setSubscriptionsPending(subscriptionPendingCount);
long subscriptionDeletedCount = cassandraHandler.getCounter(AbstractDurablePersistence.CNS_KEYSPACE, columnFamilyTopicStats, topicArn, "subscriptionDeleted", CMB_SERIALIZER.STRING_SERIALIZER, CMB_SERIALIZER.STRING_SERIALIZER);
topicAttributes.setSubscriptionsDeleted(subscriptionDeletedCount);
return topicAttributes;
}