@Override public void removeSubscription(SubscriptionContext context) { Mutator<Object> mutator = getObjectMutator(); mutator.addDeletion(context.getId(), SUBSCRIPTION_COLUMN_FAMILY_NAME); mutator.execute(); removeResourceSubRelation(context); }
private void insertSubscription(SubscriptionContext context) { Mutator<Object> mutator = getObjectMutator(); mutator.addInsertion( context.getId(), SUBSCRIPTION_COLUMN_FAMILY_NAME, HFactory.createColumn("value", context, STRING_SERIALIZER, OBJECT_SERIALIZER)); mutator.execute(); }
private void removeResourceSubRelation(SubscriptionContext context) { String notifyBodyType = ((SIPSubscriptionContext) context).getNotifyBodyType(); HColumn<String, Object> resourceSubs = queryResourceSubs(context.getSubscribee(), notifyBodyType); List<SubscriptionID> idList = null; if (resourceSubs != null) { idList = (List<SubscriptionID>) resourceSubs.getValue(); idList.remove((SubscriptionID) context.getId()); } else { return; } Mutator<String> mutator = getStringMutator(); mutator.addInsertion( context.getSubscribee(), RESOURCE_SUB_COLUMN_FAMILY_NAME, HFactory.createColumn(notifyBodyType, idList, STRING_SERIALIZER, OBJECT_SERIALIZER)); mutator.execute(); }
@Override public boolean isSubscriptionExist(SubscriptionContext context) { return querySubscription(context.getId()) != null; }