Package com.sishuok.es.maintain.notification.entity

Examples of com.sishuok.es.maintain.notification.entity.NotificationData


        notificationApi.notify(user.getId(), templateName, context);

        Long actualCount = notificationDataService.count(searchable);
        Assert.assertEquals(expectedCount, actualCount);

        NotificationData lastNotification = notificationDataService.findAllWithSort(searchable).get(0);

        String expectedCotent = "hello " + user.getId() + ", say " + message;
        String actualContent = lastNotification.getContent();
        Assert.assertEquals(expectedCotent, actualContent);

        String expectedTitle = "hello " + user.getId();
        String actualTitle = lastNotification.getTitle();
        Assert.assertEquals(expectedTitle, actualTitle);

    }
View Full Code Here


        getNotificationDataRepository().markReadAll(userId);
    }


    public void markRead(final Long notificationId) {
        NotificationData data = findOne(notificationId);
        if(data == null || data.getRead().equals(Boolean.TRUE)) {
            return;
        }
        data.setRead(Boolean.TRUE);
        update(data);
    }
View Full Code Here

        if(template == null) {
            throw new TemplateNotFoundException(templateName);
        }

        NotificationData data = new NotificationData();

        data.setUserId(userId);
        data.setSystem(template.getSystem());
        data.setDate(new Date());

        String content = template.getTemplate();
        String title = template.getTitle();
        if(context != null) {
            for(String key : context.keySet()) {
                //TODO 如果量大可能有性能问题 需要调优
                title = title.replace("{" + key + "}", String.valueOf(context.get(key)));
                content = content.replace("{" + key + "}", String.valueOf(context.get(key)));
            }
        }

        data.setTitle(title);
        data.setContent(content);

        notificationDataService.save(data);


        pushApi.pushNewNotification(userId, topFiveNotification(userId));
View Full Code Here

TOP

Related Classes of com.sishuok.es.maintain.notification.entity.NotificationData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.