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