Search in sources :

Example 6 with InfoMessageFrontendManager

use of org.olat.commons.info.InfoMessageFrontendManager in project openolat by klemens.

the class InfoCourseNode method cleanupOnDelete.

@Override
public /**
 * is called when deleting this node, clean up info-messages and subscriptions!
 */
void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    // delete infoMessages and subscriptions (OLAT-6171)
    String resSubpath = getIdent();
    InfoMessageFrontendManager infoService = CoreSpringFactory.getImpl(InfoMessageFrontendManager.class);
    List<InfoMessage> messages = infoService.loadInfoMessageByResource(course, resSubpath, null, null, null, 0, 0);
    for (InfoMessage im : messages) {
        infoService.deleteInfoMessage(im);
    }
    final SubscriptionContext subscriptionContext = CourseModule.createTechnicalSubscriptionContext(course.getCourseEnvironment(), this);
    NotificationsManager notifManagar = NotificationsManager.getInstance();
    notifManagar.delete(subscriptionContext);
    super.cleanupOnDelete(course);
}
Also used : InfoMessageFrontendManager(org.olat.commons.info.InfoMessageFrontendManager) InfoMessage(org.olat.commons.info.InfoMessage) NotificationsManager(org.olat.core.commons.services.notifications.NotificationsManager) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext)

Aggregations

InfoMessage (org.olat.commons.info.InfoMessage)6 InfoMessageFrontendManager (org.olat.commons.info.InfoMessageFrontendManager)6 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2 NotificationsManager (org.olat.core.commons.services.notifications.NotificationsManager)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 UserRequest (org.olat.core.gui.UserRequest)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 RestSecurityHelper.getUserRequest (org.olat.restapi.security.RestSecurityHelper.getUserRequest)2