Search in sources :

Example 21 with InfoMessage

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

the class InfoMessagesWebService method getInfoMessageWebservice.

@Path("{infoMessageKey}")
public InfoMessageWebService getInfoMessageWebservice(@PathParam("infoMessageKey") Long infoMessageKey) {
    InfoMessageFrontendManager messageManager = CoreSpringFactory.getImpl(InfoMessageFrontendManager.class);
    InfoMessage msg = messageManager.loadInfoMessage(infoMessageKey);
    return new InfoMessageWebService(msg);
}
Also used : InfoMessageFrontendManager(org.olat.commons.info.InfoMessageFrontendManager) InfoMessage(org.olat.commons.info.InfoMessage) Path(javax.ws.rs.Path)

Example 22 with InfoMessage

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

the class InfoMessageFrontendManagerImpl method updateInfoMessagesOfIdentity.

@Override
public void updateInfoMessagesOfIdentity(BusinessGroupRef businessGroup, IdentityRef identity) {
    List<InfoMessage> infoMessages = infoMessageManager.loadInfoMessagesOfIdentity(businessGroup, identity);
    for (InfoMessage infoMessage : infoMessages) {
        Identity author = infoMessage.getAuthor();
        if (author != null && author.getKey().equals(identity.getKey())) {
            ((InfoMessageImpl) infoMessage).setAuthor(null);
        }
        Identity modifier = infoMessage.getModifier();
        if (modifier != null && modifier.getKey().equals(identity.getKey())) {
            infoMessage.setModifier(null);
        }
        infoMessageManager.saveInfoMessage(infoMessage);
    }
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) InfoMessageImpl(org.olat.commons.info.model.InfoMessageImpl) Identity(org.olat.core.id.Identity)

Example 23 with InfoMessage

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

the class InfoMessageManagerImpl method loadInfoMessageByResource.

@Override
public List<InfoMessage> loadInfoMessageByResource(OLATResourceable ores, String subPath, String businessPath, Date after, Date before, int firstResult, int maxResults) {
    DBQuery query = queryInfoMessageByResource(ores, subPath, businessPath, after, before, false);
    if (firstResult >= 0) {
        query.setFirstResult(firstResult);
    }
    if (maxResults > 0) {
        query.setMaxResults(maxResults);
    }
    @SuppressWarnings("unchecked") List<InfoMessage> msgs = query.list();
    return msgs;
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) DBQuery(org.olat.core.commons.persistence.DBQuery)

Example 24 with InfoMessage

use of org.olat.commons.info.InfoMessage 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)24 OLATResourceable (org.olat.core.id.OLATResourceable)8 InfoMessageFrontendManager (org.olat.commons.info.InfoMessageFrontendManager)6 Identity (org.olat.core.id.Identity)6 ArrayList (java.util.ArrayList)4 Document (org.apache.lucene.document.Document)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)4 SearchResourceContext (org.olat.search.service.SearchResourceContext)4 InfoMessageDocument (org.olat.search.service.document.InfoMessageDocument)4 Date (java.util.Date)2 HashMap (java.util.HashMap)2 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2 InfoMessageImpl (org.olat.commons.info.model.InfoMessageImpl)2 DBQuery (org.olat.core.commons.persistence.DBQuery)2 NotificationsManager (org.olat.core.commons.services.notifications.NotificationsManager)2 Publisher (org.olat.core.commons.services.notifications.Publisher)2 SubscriptionInfo (org.olat.core.commons.services.notifications.SubscriptionInfo)2