|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.deepamehta.core.osgi.PluginActivator
org.deepamehta.plugins.subscriptions.SubscriptionsPlugin
public class SubscriptionsPlugin
A DeepaMehta 4 Plugin introducing notifications on subscribed topics based on dm4-websockets.
| Field Summary | |
|---|---|
private AccessControlService |
aclService
|
private static String |
DEEPAMEHTA_TAG_TYPE
|
private static String |
DEFAULT_ROLE_TYPE
|
private static Logger |
log
|
private static String |
NOTIFICATION_BODY_TYPE
|
private static String |
NOTIFICATION_INVOLVED_ITEM_ID_TYPE
|
private static String |
NOTIFICATION_RECIPIENT_EDGE_TYPE
|
private static String |
NOTIFICATION_SEEN_TYPE
|
private static String |
NOTIFICATION_SUB_ITEM_ID_TYPE
|
private static String |
NOTIFICATION_TITLE_TYPE
|
private static String |
NOTIFICATION_TYPE
|
private static String |
SUBSCRIPTION_EDGE_TYPE
|
private static String |
USER_ACCOUNT_TYPE
|
private de.deepamehta.plugins.websockets.service.WebSocketsService |
webSocketsService
|
| Fields inherited from class de.deepamehta.core.osgi.PluginActivator |
|---|
bundle, dms |
| Constructor Summary | |
|---|---|
SubscriptionsPlugin()
|
|
| Method Summary | |
|---|---|
private boolean |
associationExists(String edge_type,
long itemId,
long accountId)
|
void |
createNotifications(String title,
String message,
long actionAccountId,
DeepaMehtaObject item)
Creates new notifications for all users with a direct or indirect (tags) subscription to the given item. |
private void |
createNotificationTopics(String title,
String text,
long accountId,
DeepaMehtaObject involvedItem)
|
private void |
createNotificationTopics(String title,
String text,
long accountId,
DeepaMehtaObject involvedItem,
DeepaMehtaObject subscribedItem)
|
ResultList<RelatedTopic> |
getAllNotifications()
Gets all notifications for the logged-in user. |
ResultList<RelatedTopic> |
getAllNotificationsForUser()
|
ArrayList<RelatedTopic> |
getAllUnseenNotifications()
Gets all unread notifications for the logged-in user. |
ArrayList<RelatedTopic> |
getAllUnseenNotificationsForUser()
|
ResultList<RelatedTopic> |
getSubscriptions()
Gets all subscribed topics for the logged-in user. |
private Topic |
getUserAccountTopic(String username)
|
boolean |
setNotificationSeen(long newsId)
|
void |
subscribe(long accountId,
long itemId)
Create a subscription edge for useraccount to item. |
javax.ws.rs.core.Response |
subscribeUser(long itemId)
|
void |
unsubscribe(long accountId,
long itemId)
Remove subscription (edge) for given user account and item. |
javax.ws.rs.core.Response |
unsubscribeUser(long itemId)
|
void |
websocketTextMessage(String message)
|
| Methods inherited from class de.deepamehta.core.osgi.PluginActivator |
|---|
getBundleContext, getPluginName, getStaticResource, getUri, init, postInstall, publishDirectory, serviceArrived, serviceGone, setCoreService, shutdown, start, stop, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static Logger log
private static final String NOTIFICATION_TYPE
private static final String NOTIFICATION_TITLE_TYPE
private static final String NOTIFICATION_BODY_TYPE
private static final String NOTIFICATION_INVOLVED_ITEM_ID_TYPE
private static final String NOTIFICATION_SUB_ITEM_ID_TYPE
private static final String NOTIFICATION_RECIPIENT_EDGE_TYPE
private static final String SUBSCRIPTION_EDGE_TYPE
private static final String NOTIFICATION_SEEN_TYPE
private static final String USER_ACCOUNT_TYPE
private static final String DEEPAMEHTA_TAG_TYPE
private static final String DEFAULT_ROLE_TYPE
private AccessControlService aclService
private de.deepamehta.plugins.websockets.service.WebSocketsService webSocketsService
| Constructor Detail |
|---|
public SubscriptionsPlugin()
| Method Detail |
|---|
public javax.ws.rs.core.Response subscribeUser(long itemId)
public javax.ws.rs.core.Response unsubscribeUser(long itemId)
public ResultList<RelatedTopic> getSubscriptions()
SubscriptionService
getSubscriptions in interface SubscriptionServicepublic boolean setNotificationSeen(long newsId)
public ResultList<RelatedTopic> getAllNotificationsForUser()
public ArrayList<RelatedTopic> getAllUnseenNotificationsForUser()
public void subscribe(long accountId,
long itemId)
SubscriptionService
subscribe in interface SubscriptionServiceaccountId - topic-id of user accountitemId - topic-id of user account
public void unsubscribe(long accountId,
long itemId)
SubscriptionService
unsubscribe in interface SubscriptionServiceaccountId - topic-id of user accountitemId - topic-id of subscribed item
public void createNotifications(String title,
String message,
long actionAccountId,
DeepaMehtaObject item)
SubscriptionService
createNotifications in interface SubscriptionServicetitle - title of the notificationmessage - text part of the notificationactionAccountId - topic-id of user account performing the action which leads to the notification of all othersitem - item users can have subscribed (either "User Account" or any TopicType with "Tags" as child)public ResultList<RelatedTopic> getAllNotifications()
SubscriptionService
getAllNotifications in interface SubscriptionServicepublic ArrayList<RelatedTopic> getAllUnseenNotifications()
SubscriptionService
getAllUnseenNotifications in interface SubscriptionServicepublic void websocketTextMessage(String message)
websocketTextMessage in interface de.deepamehta.plugins.websockets.event.WebsocketTextMessageListener
private void createNotificationTopics(String title,
String text,
long accountId,
DeepaMehtaObject involvedItem)
private void createNotificationTopics(String title,
String text,
long accountId,
DeepaMehtaObject involvedItem,
DeepaMehtaObject subscribedItem)
private boolean associationExists(String edge_type,
long itemId,
long accountId)
private Topic getUserAccountTopic(String username)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||