Search in sources :

Example 56 with PublisherData

use of org.olat.core.commons.services.notifications.PublisherData in project openolat by klemens.

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;
}
Also used : PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Example 57 with PublisherData

use of org.olat.core.commons.services.notifications.PublisherData in project openolat by klemens.

the class CertificatesManagerImpl method getPublisherData.

@Override
public PublisherData getPublisherData(ICourse course, String businessPath) {
    String data = String.valueOf(course.getCourseEnvironment().getCourseResourceableId());
    PublisherData pData = new PublisherData(ORES_CERTIFICATE, data, businessPath);
    return pData;
}
Also used : PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Example 58 with PublisherData

use of org.olat.core.commons.services.notifications.PublisherData in project openolat by klemens.

the class MailManagerImpl method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    VFSContainer root = mailModule.getRootForAttachments();
    attachmentStorage = new FileStorage(root);
    PublisherData pdata = getPublisherData();
    SubscriptionContext scontext = getSubscriptionContext();
    notificationsManager.getOrCreatePublisher(scontext, pdata);
    Properties p = null;
    try {
        velocityEngine = new VelocityEngine();
        p = new Properties();
        p.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
        p.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, "org.olat.core.gui.render.velocity.InfinispanResourceCache");
        p.setProperty("runtime.log.logsystem.log4j.category", "syslog");
        velocityEngine.init(p);
    } catch (Exception e) {
        throw new RuntimeException("config error " + p.toString());
    }
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) VFSContainer(org.olat.core.util.vfs.VFSContainer) FileStorage(org.olat.core.util.vfs.FileStorage) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) Properties(java.util.Properties) PublisherData(org.olat.core.commons.services.notifications.PublisherData) SendFailedException(javax.mail.SendFailedException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException) MessagingException(javax.mail.MessagingException) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) AddressException(javax.mail.internet.AddressException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 59 with PublisherData

use of org.olat.core.commons.services.notifications.PublisherData in project openolat by klemens.

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);
    }
}
Also used : SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Example 60 with PublisherData

use of org.olat.core.commons.services.notifications.PublisherData in project openolat by klemens.

the class WeeklyCalendarController method getContextualSubscriptionController.

private ContextualSubscriptionController getContextualSubscriptionController(UserRequest ureq, KalendarRenderWrapper kalendarRenderWrapper, SubscriptionContext context) {
    String businessPath = getWindowControl().getBusinessControl().getAsString();
    if ((caller.equals(CalendarController.CALLER_COURSE) || caller.equals(CalendarManager.TYPE_COURSE))) {
        Long courseId = kalendarRenderWrapper.getLinkProvider().getControler().getCourseId();
        PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(courseId), businessPath);
        return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
    }
    if ((caller.equals(CalendarController.CALLER_COLLAB) || caller.equals(CalendarManager.TYPE_GROUP))) {
        BusinessGroup businessGroup = calendarNotificationsManager.getBusinessGroup(kalendarRenderWrapper);
        if (businessGroup != null) {
            PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(CalendarManager.class), String.valueOf(businessGroup.getResourceableId()), businessPath);
            return new ContextualSubscriptionController(ureq, getWindowControl(), context, pdata);
        }
    }
    return null;
}
Also used : CalendarManager(org.olat.commons.calendar.CalendarManager) ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) BusinessGroup(org.olat.group.BusinessGroup) PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Aggregations

PublisherData (org.olat.core.commons.services.notifications.PublisherData)100 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)84 Test (org.junit.Test)64 Identity (org.olat.core.id.Identity)60 Publisher (org.olat.core.commons.services.notifications.Publisher)42 RepositoryEntry (org.olat.repository.RepositoryEntry)22 BusinessGroup (org.olat.group.BusinessGroup)20 HttpResponse (org.apache.http.HttpResponse)16 HttpGet (org.apache.http.client.methods.HttpGet)16 Subscriber (org.olat.core.commons.services.notifications.Subscriber)16 ArrayList (java.util.ArrayList)14 ContextualSubscriptionController (org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController)12 Forum (org.olat.modules.fo.Forum)12 UriBuilder (javax.ws.rs.core.UriBuilder)10 SubscriptionInfoVO (org.olat.core.commons.services.notifications.restapi.vo.SubscriptionInfoVO)8 SubscriptionListItemVO (org.olat.core.commons.services.notifications.restapi.vo.SubscriptionListItemVO)8 DBRuntimeException (org.olat.core.logging.DBRuntimeException)8 ICourse (org.olat.course.ICourse)8 File (java.io.File)6 URI (java.net.URI)6