Пример #1
0
 @Override
 public void removeSubscription(SubscriptionContext context) {
   Mutator<Object> mutator = getObjectMutator();
   mutator.addDeletion(context.getId(), SUBSCRIPTION_COLUMN_FAMILY_NAME);
   mutator.execute();
   removeResourceSubRelation(context);
 }
Пример #2
0
 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();
 }
Пример #3
0
 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();
 }
Пример #4
0
 @Override
 public boolean isSubscriptionExist(SubscriptionContext context) {
   return querySubscription(context.getId()) != null;
 }