Class AbstractSubscriptionsDAO

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.pagesubscription.dao.AbstractSubscriptionsDAO
All Implemented Interfaces:
LogEnabled, Component, Contextualizable, Serviceable
Direct Known Subclasses:
ForceTagSubscriptionsDAO, PageSubscriptionsDAO, TagSubscriptionsDAO

Abstract DAO for subscriptions
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • getSubscription

      public Map<String,Object> getSubscription(String subscriptionId)
      Get the current user subscription from the given id
      Parameters:
      subscriptionId - the subscription id
      Returns:
      the subscription as JSON
    • getSubscription

      public Map<String,Object> getSubscription(String subscriptionId, boolean checkCurrentUser)
      Get the subscription from the given id
      Parameters:
      subscriptionId - the subscription id
      checkCurrentUser - true to check if the subscription belong to the current user
      Returns:
      the subscription as JSON
    • editSubscription

      public Map<String,Object> editSubscription(String subscriptionId, String frequency, List<String> broadcastChannels)
      Edit the current user subscription with the given id
      Parameters:
      subscriptionId - the subscription id
      frequency - the frequency
      broadcastChannels - the broadcast channels
      Returns:
      the subscription as JSON
    • editSubscription

      public Map<String,Object> editSubscription(String subscriptionId, String frequency, SubscriptionType.FrequencyTiming forcedTiming, List<String> broadcastChannels, boolean checkCurrentUser)
      Edit the subscription with the given id
      Parameters:
      subscriptionId - the subscription id
      frequency - the frequency
      forcedTiming - the force frequency timing. Can be null if not forced
      broadcastChannels - the broadcast channels
      checkCurrentUser - true to check if the subscription belong to the current user
      Returns:
      a Map with success status and the subscription as JSON
    • unsubscribe

      public boolean unsubscribe(String subscriptionId) throws Exception
      Remove the current user subscription with the given id
      Parameters:
      subscriptionId - the subscription id
      Returns:
      true if successfully subscribe, false otherwise
      Throws:
      Exception - if an error occurred
    • unsubscribe

      public boolean unsubscribe(String subscriptionId, boolean checkCurrentUser) throws Exception
      Remove the subscription with the given id
      Parameters:
      subscriptionId - the subscription id
      checkCurrentUser - true to check if the subscription belong to the current user
      Returns:
      true if successfully subscribe, false otherwise
      Throws:
      Exception - if an error occurred