001    package org.deepamehta.plugins.subscriptions.service;
002    
003    import de.deepamehta.core.DeepaMehtaObject;
004    import de.deepamehta.core.RelatedTopic;
005    import de.deepamehta.core.service.PluginService;
006    import de.deepamehta.core.service.ResultList;
007    import java.util.ArrayList;
008    
009    public interface SubscriptionService extends PluginService {
010    
011        /**
012         * Create a subscription edge for useraccount to item.
013         *
014         * @param   accountId   topic-id of user account
015         * @param   itemId      topic-id of user account
016         */
017        public void subscribe(long accountId, long itemId);
018    
019        /**
020         * Remove subscription (edge) for given user account and item.
021         *
022         * @param  accountId        topic-id of user account
023         * @param  itemId           topic-id of subscribed item
024         */
025        public void unsubscribe(long accountId, long itemId);
026    
027        /**
028         * Creates new notifications for all users with a direct or indirect (tags) subscription to the given item.
029         * Notifications are created if the (given) item is either of TopicType "User Account" or of any other TopicType
030         * which has the TopicType=Tag as a child-type. In the latter case, all subscribers of the _Tag_ are notified.
031         *
032         * @param   title           title of the notification
033         * @param   message         text part of the notification
034         * @param   actionAccountId topic-id of user account performing the action which leads to the notification of all others
035         * @param   item            item users can have subscribed (either "User Account" or any TopicType with "Tags" as child)
036         */
037        public void createNotifications(String title, String message, long actionAccountId, DeepaMehtaObject item);
038    
039        /** Gets all subscribed topics for the logged-in user. */
040        public ResultList<RelatedTopic> getSubscriptions();
041    
042        /** Gets all notifications for the logged-in user. */
043        public ResultList<RelatedTopic> getAllNotifications();
044    
045        /** Gets all unread notifications for the logged-in user. */
046        public ArrayList<RelatedTopic> getAllUnseenNotifications();
047    
048    }