use of org.olat.core.commons.services.notifications.PublisherData in project OpenOLAT by OpenOLAT.
the class InfoSubscriptionManagerImpl method subscribe.
@Override
public void subscribe(OLATResourceable resource, String resSubPath, String businessPath, Identity identity) {
PublisherData data = getInfoPublisherData(resource, businessPath);
SubscriptionContext context = getInfoSubscriptionContext(resource, resSubPath);
notificationsManager.subscribe(identity, context, data);
}
use of org.olat.core.commons.services.notifications.PublisherData in project OpenOLAT by OpenOLAT.
the class InfoSubscriptionManagerImpl method getInfoPublisherData.
@Override
public PublisherData getInfoPublisherData(OLATResourceable resource, String businessPath) {
String resId = resource.getResourceableId() == null ? "0" : resource.getResourceableId().toString();
PublisherData publisherData = new PublisherData(PUBLISHER_TYPE, resId, businessPath);
return publisherData;
}
use of org.olat.core.commons.services.notifications.PublisherData in project OpenOLAT by OpenOLAT.
the class NotificationsWebService method subscribe.
@PUT
@Path("subscribers")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response subscribe(PublisherVO publisherVO, @Context HttpServletRequest request) {
if (!isAdmin(request)) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
NotificationsManager notificationsMgr = NotificationsManager.getInstance();
BaseSecurity securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
SubscriptionContext subscriptionContext = new SubscriptionContext(publisherVO.getResName(), publisherVO.getResId(), publisherVO.getSubidentifier());
PublisherData publisherData = new PublisherData(publisherVO.getType(), publisherVO.getData(), publisherVO.getBusinessPath());
List<UserVO> userVoes = publisherVO.getUsers();
List<Long> identityKeys = new ArrayList<>();
for (UserVO userVo : userVoes) {
identityKeys.add(userVo.getKey());
}
List<Identity> identities = securityManager.loadIdentityByKeys(identityKeys);
notificationsMgr.subscribe(identities, subscriptionContext, publisherData);
return Response.ok().build();
}
use of org.olat.core.commons.services.notifications.PublisherData in project OpenOLAT by OpenOLAT.
the class MailManagerImpl method subscribe.
@Override
public void subscribe(Identity identity) {
PublisherData data = getPublisherData();
SubscriptionContext context = getSubscriptionContext();
if (context != null) {
notificationsManager.subscribe(identity, context, data);
}
}
use of org.olat.core.commons.services.notifications.PublisherData in project OpenOLAT by OpenOLAT.
the class MailManagerImpl method getPublisherData.
@Override
public PublisherData getPublisherData() {
String data = "";
String businessPath = "[Inbox:0]";
PublisherData publisherData = new PublisherData("Inbox", data, businessPath);
return publisherData;
}
Aggregations