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
public abstract class AbstractSubscriptionsDAO
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable
Abstract DAO for subscriptions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Context
the Avalon contextprotected CurrentUserProvider
The current user providerprotected AmetysObjectResolver
The ametys object resolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) editSubscription
(String subscriptionId, String frequency, List<String> broadcastChannels) Edit the current user subscription with the given ideditSubscription
(String subscriptionId, String frequency, SubscriptionType.FrequencyTiming forcedTiming, List<String> broadcastChannels, boolean checkCurrentUser) Edit the subscription with the given idgetSubscription
(String subscriptionId) Get the current user subscription from the given idgetSubscription
(String subscriptionId, boolean checkCurrentUser) Get the subscription from the given idvoid
service
(ServiceManager smanager) boolean
unsubscribe
(String subscriptionId) Remove the current user subscription with the given idboolean
unsubscribe
(String subscriptionId, boolean checkCurrentUser) Remove the subscription with the given idMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_resolver
The ametys object resolver -
_currentUserProvider
The current user provider -
_context
the Avalon context
-
-
Constructor Details
-
AbstractSubscriptionsDAO
public AbstractSubscriptionsDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getSubscription
Get the current user subscription from the given id- Parameters:
subscriptionId
- the subscription id- Returns:
- the subscription as JSON
-
getSubscription
Get the subscription from the given id- Parameters:
subscriptionId
- the subscription idcheckCurrentUser
-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 idfrequency
- the frequencybroadcastChannels
- 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 idfrequency
- the frequencyforcedTiming
- the force frequency timing. Can be null if not forcedbroadcastChannels
- the broadcast channelscheckCurrentUser
-true
to check if the subscription belong to the current user- Returns:
- a Map with success status and the subscription as JSON
-
unsubscribe
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
Remove the subscription with the given id- Parameters:
subscriptionId
- the subscription idcheckCurrentUser
-true
to check if the subscription belong to the current user- Returns:
- true if successfully subscribe, false otherwise
- Throws:
Exception
- if an error occurred
-