Package org.encuestame.persistence.domain.notifications

Examples of org.encuestame.persistence.domain.notifications.Notification


    @RequestMapping(value = "/api/notifications/readed.json", method = RequestMethod.GET)
    public @ResponseBody ModelMap changeStatus(
            @RequestParam(value = "id", required = true) Long id,
            HttpServletRequest request,
            HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
            final Notification notification = getNotificationDao().retrieveNotificationById(id);
            if (notification == null) {
                setError("nothing to do", response);
            } else {
                notification.setReaded(notification.getReaded() == null ? true : !notification.getReaded());
                getNotificationDao().saveOrUpdate(notification);
                setSuccesResponse();
            }
        return returnData();
    }
View Full Code Here


    @RequestMapping(value = "/api/notification/remove.json", method = RequestMethod.DELETE)
    public @ResponseBody ModelMap removeNotification(
            @RequestParam(value = "id") Long notificationId,
            HttpServletRequest request,
            HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
            final Notification notification = getNotificationDao().retrieveNotificationById(notificationId);
            final Map<String, Object> responseJson = new HashMap<String, Object>();
            if (notification == null){
                setError("notification not found", response);
            } else {
                getNotificationDao().delete(notification);
View Full Code Here

     * test loadNotificationByUserAndLimit.
     */
    @Test
    public void testloadNotification(){
        final List<Notification> list = getNotification().loadNotificationByUserAndLimit(this.account, 5, 0, true);
        final Notification not1 = list.get(0);
        assertEquals("Should be equals", 5, list.size());
        final List<Notification> list2 = getNotification().loadNotificationByUserAndLimit(this.account, 20, 0, true);
        assertEquals("Should be equals", 10, list2.size());
        final Long list3 = getNotification().retrieveTotalNotificationStatus(this.account);
        assertEquals("Should be equals", 20L, list3.longValue());
        final Long list4 = getNotification().retrieveTotalNotReadedNotificationStatus(this.account);
        assertEquals("Should be equals", 10L, list4.longValue());
        final Notification expected = getNotification().retrieveNotificationById(not1.getNotificationId());
        Assert.assertNotNull(expected);
    }
View Full Code Here

     * @param description
     * @param secUser
     * @return
     */
    public Notification createNotification(final NotificationEnum description, final String additional,  final Account account) {
        final Notification notification = new Notification();
        notification.setDescription(description);
        notification.setAccount(account);
        notification.setAdditionalDescription(additional);
        getNotificationDao().saveOrUpdate(notification);
        return notification;
    }
View Full Code Here

            final NotificationEnum description,
            final String additional,
            final String urlReference,
            final Boolean group,
            final UserAccount account) throws EnMeNoResultsFoundException{
        final Notification notification = new Notification();
        notification.setDescription(description);
        notification.setAccount(account.getAccount());
        notification.setAdditionalDescription(additional);
        notification.setUrlReference(urlReference);
        notification.setCreated(Calendar.getInstance().getTime());
        notification.setGroup(group);
        getNotificationDao().saveOrUpdate(notification);
        return notification;
    }
View Full Code Here

            final String message,
            final Account secUser,
            final NotificationEnum description,
            final Boolean readed,
            final Date createdAt){
         final Notification notification = new Notification();
         notification.setAdditionalDescription(message);
         notification.setCreated(createdAt);
         notification.setDescription(description);
         notification.setReaded(readed);
         notification.setAccount(secUser);
         notification.setUrlReference("http://google.es");
         notification.setGroup(true);
         getNotification().saveOrUpdate(notification);
         return notification;
    }
View Full Code Here

            final String message,
            final Account secUser,
            final NotificationEnum description,
            final Boolean readed,
            final Date createdAt){
         final Notification notification = new Notification();
         notification.setAdditionalDescription(message);
         notification.setCreated(createdAt);
         notification.setDescription(description);
         notification.setReaded(readed);
         notification.setAccount(secUser);
         notification.setUrlReference("http://google.es");
         notification.setGroup(true);
         getNotification().saveOrUpdate(notification);
         return notification;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.notifications.Notification

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.