Package org.dspace.eperson
Class SubscribeServiceImpl
- java.lang.Object
-
- org.dspace.eperson.SubscribeServiceImpl
-
- All Implemented Interfaces:
SubscribeService
public class SubscribeServiceImpl extends Object implements SubscribeService
Class defining methods for sending new item e-mail alerts to users- Version:
- $Revision$
- Author:
- Robert Tansley
-
-
Constructor Summary
Constructors Constructor Description SubscribeServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SubscriptionaddSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParam)Adds a parameter to a subscriptionLongcountAll(Context context)Counts all subscriptionsLongcountByEPersonAndDSO(Context context, EPerson ePerson, DSpaceObject dSpaceObject)Counts all subscriptions by ePerson and DSOLongcountSubscriptionsByEPerson(Context context, EPerson ePerson)Counts all subscriptions by ePersonvoiddeleteByDspaceObject(Context context, DSpaceObject dSpaceObject)Delete subscription by collection.voiddeleteByEPerson(Context context, EPerson ePerson)Delete subscription by eperson (subscriber).voiddeleteSubscription(Context context, Subscription subscription)Deletes a subscriptionList<Subscription>findAll(Context context, String resourceType, Integer limit, Integer offset)Subscribe an e-person to a collection.List<Subscription>findAllSubscriptionsBySubscriptionTypeAndFrequency(Context context, String subscriptionType, String frequencyValue)Finds all subscriptions by subscriptionType and frequencyList<Collection>findAvailableSubscriptions(Context context)Find out which collections the currently logged in e-person can subscribe toList<Collection>findAvailableSubscriptions(Context context, EPerson eperson)Find out which collections an e-person can subscribe toSubscriptionfindById(Context context, int id)Finds a subscription by idList<Subscription>findSubscriptionsByEPerson(Context context, EPerson eperson, Integer limit, Integer offset)Find out which collections an e-person is subscribed toList<Subscription>findSubscriptionsByEPersonAndDso(Context context, EPerson eperson, DSpaceObject dSpaceObject, Integer limit, Integer offset)Find out which collections an e-person is subscribed to and related with dsobooleanisSubscribed(Context context, EPerson eperson, DSpaceObject dSpaceObject)Is that e-person subscribed to that collection?SubscriptionremoveSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParam)Deletes a parameter from subscriptionSubscriptionsubscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject, List<SubscriptionParameter> subscriptionParameterList, String type)Subscribe an EPerson to a dSpaceObject (Collection or Community).voidunsubscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject)Unsubscribe an e-person to a collection.SubscriptionupdateSubscription(Context context, Integer id, String subscriptionType, List<SubscriptionParameter> subscriptionParameterList)Updates a subscription by id
-
-
-
Method Detail
-
findAll
public List<Subscription> findAll(Context context, String resourceType, Integer limit, Integer offset) throws Exception
Description copied from interface:SubscribeServiceSubscribe an e-person to a collection. An e-mail will be sent every day a new item appears in the collection.- Specified by:
findAllin interfaceSubscribeService- Parameters:
context- DSpace contextlimit- Number of subscriptions to returnoffset- Offset number- Returns:
- list of Subscription objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.Exception
-
subscribe
public Subscription subscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject, List<SubscriptionParameter> subscriptionParameterList, String type) throws SQLException, AuthorizeException
Description copied from interface:SubscribeServiceSubscribe an EPerson to a dSpaceObject (Collection or Community). An e-mail will be sent every day a new item appears in the Collection or Community.- Specified by:
subscribein interfaceSubscribeService- Parameters:
context- DSpace context objecteperson- EPerson to subscribedSpaceObject- DSpaceObject to subscribesubscriptionParameterList- list of @SubscriptionParametertype- Currently supported only "content"- Returns:
- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
unsubscribe
public void unsubscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject) throws SQLException, AuthorizeException
Description copied from interface:SubscribeServiceUnsubscribe an e-person to a collection. Passing innullfor the collection unsubscribes the e-person from all collections they are subscribed to.- Specified by:
unsubscribein interfaceSubscribeService- Parameters:
context- DSpace contexteperson- EPerson to unsubscribedSpaceObject- DSpaceObject to unsubscribe from- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
findSubscriptionsByEPerson
public List<Subscription> findSubscriptionsByEPerson(Context context, EPerson eperson, Integer limit, Integer offset) throws SQLException
Description copied from interface:SubscribeServiceFind out which collections an e-person is subscribed to- Specified by:
findSubscriptionsByEPersonin interfaceSubscribeService- Parameters:
context- DSpace contexteperson- EPersonlimit- Number of subscriptions to returnoffset- Offset number- Returns:
- array of collections e-person is subscribed to
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findSubscriptionsByEPersonAndDso
public List<Subscription> findSubscriptionsByEPersonAndDso(Context context, EPerson eperson, DSpaceObject dSpaceObject, Integer limit, Integer offset) throws SQLException
Description copied from interface:SubscribeServiceFind out which collections an e-person is subscribed to and related with dso- Specified by:
findSubscriptionsByEPersonAndDsoin interfaceSubscribeService- Parameters:
context- DSpace contexteperson- EPersondSpaceObject- DSpaceObjectlimit- Number of subscriptions to returnoffset- Offset number- Returns:
- array of collections e-person is subscribed to and related with dso
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAvailableSubscriptions
public List<Collection> findAvailableSubscriptions(Context context) throws SQLException
Description copied from interface:SubscribeServiceFind out which collections the currently logged in e-person can subscribe to- Specified by:
findAvailableSubscriptionsin interfaceSubscribeService- Parameters:
context- DSpace context- Returns:
- array of collections the currently logged in e-person can subscribe to
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAvailableSubscriptions
public List<Collection> findAvailableSubscriptions(Context context, EPerson eperson) throws SQLException
Description copied from interface:SubscribeServiceFind out which collections an e-person can subscribe to- Specified by:
findAvailableSubscriptionsin interfaceSubscribeService- Parameters:
context- DSpace contexteperson- EPerson- Returns:
- array of collections e-person can subscribe to
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
isSubscribed
public boolean isSubscribed(Context context, EPerson eperson, DSpaceObject dSpaceObject) throws SQLException
Description copied from interface:SubscribeServiceIs that e-person subscribed to that collection?- Specified by:
isSubscribedin interfaceSubscribeService- Parameters:
context- DSpace contexteperson- find out if this e-person is subscribeddSpaceObject- find out if subscribed to this dSpaceObject- Returns:
trueif they are subscribed- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
deleteByDspaceObject
public void deleteByDspaceObject(Context context, DSpaceObject dSpaceObject) throws SQLException
Description copied from interface:SubscribeServiceDelete subscription by collection.- Specified by:
deleteByDspaceObjectin interfaceSubscribeService- Parameters:
context- DSpace contextdSpaceObject- find out if subscribed to this dSpaceObject- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
deleteByEPerson
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException
Description copied from interface:SubscribeServiceDelete subscription by eperson (subscriber).- Specified by:
deleteByEPersonin interfaceSubscribeService- Parameters:
context- DSpace contextePerson- find out if this e-person is subscribed- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findById
public Subscription findById(Context context, int id) throws SQLException
Description copied from interface:SubscribeServiceFinds a subscription by id- Specified by:
findByIdin interfaceSubscribeService- Parameters:
context- DSpace contextid- the id of subscription to be searched- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
updateSubscription
public Subscription updateSubscription(Context context, Integer id, String subscriptionType, List<SubscriptionParameter> subscriptionParameterList) throws SQLException
Description copied from interface:SubscribeServiceUpdates a subscription by id- Specified by:
updateSubscriptionin interfaceSubscribeService- Parameters:
context- DSpace contextid- Integer idsubscriptionType- typesubscriptionParameterList- ListsubscriptionParameterList - Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
addSubscriptionParameter
public Subscription addSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParam) throws SQLException
Description copied from interface:SubscribeServiceAdds a parameter to a subscription- Specified by:
addSubscriptionParameterin interfaceSubscribeService- Parameters:
context- DSpace contextid- Integer idsubscriptionParam- SubscriptionParameter subscriptionParameter- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
removeSubscriptionParameter
public Subscription removeSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParam) throws SQLException
Description copied from interface:SubscribeServiceDeletes a parameter from subscription- Specified by:
removeSubscriptionParameterin interfaceSubscribeService- Parameters:
context- DSpace contextid- Integer idsubscriptionParam- SubscriptionParameter subscriptionParameter- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
deleteSubscription
public void deleteSubscription(Context context, Subscription subscription) throws SQLException
Description copied from interface:SubscribeServiceDeletes a subscription- Specified by:
deleteSubscriptionin interfaceSubscribeService- Parameters:
context- DSpace contextsubscription- The subscription to delete- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAllSubscriptionsBySubscriptionTypeAndFrequency
public List<Subscription> findAllSubscriptionsBySubscriptionTypeAndFrequency(Context context, String subscriptionType, String frequencyValue) throws SQLException
Description copied from interface:SubscribeServiceFinds all subscriptions by subscriptionType and frequency- Specified by:
findAllSubscriptionsBySubscriptionTypeAndFrequencyin interfaceSubscribeService- Parameters:
context- DSpace contextsubscriptionType- Could be "content" or "statistics". NOTE: in DSpace we have only "content"frequencyValue- Could be "D" stand for Day, "W" stand for Week, and "M" stand for Month- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
countAll
public Long countAll(Context context) throws SQLException
Description copied from interface:SubscribeServiceCounts all subscriptions- Specified by:
countAllin interfaceSubscribeService- Parameters:
context- DSpace context- Throws:
SQLException
-
countSubscriptionsByEPerson
public Long countSubscriptionsByEPerson(Context context, EPerson ePerson) throws SQLException
Description copied from interface:SubscribeServiceCounts all subscriptions by ePerson- Specified by:
countSubscriptionsByEPersonin interfaceSubscribeService- Parameters:
context- DSpace contextePerson- EPerson ePerson- Throws:
SQLException
-
countByEPersonAndDSO
public Long countByEPersonAndDSO(Context context, EPerson ePerson, DSpaceObject dSpaceObject) throws SQLException
Description copied from interface:SubscribeServiceCounts all subscriptions by ePerson and DSO- Specified by:
countByEPersonAndDSOin interfaceSubscribeService- Parameters:
context- DSpace contextePerson- EPerson ePersondSpaceObject- DSpaceObject dSpaceObject- Throws:
SQLException
-
-