You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/06/05 17:11:46 UTC

[11/21] syncope git commit: [SYNCOPE-674] During tasks creation, the notification manager now returns a list of notification task

[SYNCOPE-674] During tasks creation, the notification manager now returns a list of notification task


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/63095476
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/63095476
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/63095476

Branch: refs/heads/SYNCOPE-666
Commit: 63095476598571425fdf8aa941aaa04ab7ed45a4
Parents: 8106e24
Author: giacomolm <gi...@hotmail.it>
Authored: Fri Jun 5 09:30:16 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Jun 5 11:50:35 2015 +0200

----------------------------------------------------------------------
 .../syncope/core/notification/NotificationManager.java   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/63095476/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java b/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
index 341a0bd..48caa54 100644
--- a/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
+++ b/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
@@ -262,7 +262,7 @@ public class NotificationManager {
     /**
      * Create notification tasks for each notification matching the given user id and (some of) tasks performed.
      */
-    public void createTasks(
+    public List<NotificationTask> createTasks(
             final AuditElements.EventCategoryType type,
             final String category,
             final String subcategory,
@@ -274,6 +274,7 @@ public class NotificationManager {
 
         SubjectType subjectType = null;
         AbstractSubject subject = null;
+        List<NotificationTask> notificationList = new ArrayList<NotificationTask>();
 
         if (before instanceof UserTO) {
             subjectType = SubjectType.USER;
@@ -327,15 +328,17 @@ public class NotificationManager {
                     } else if (subject instanceof SyncopeRole) {
                         model.put("role", roleDataBinder.getRoleTO((SyncopeRole) subject));
                     }
-
-                    taskDAO.save(getNotificationTask(notification, subject, model));
+                    NotificationTask notificationTask = getNotificationTask(notification, subject, model);
+                    notificationTask = taskDAO.save(notificationTask);
+                    notificationList.add(notificationTask);                    
                 }
             } else {
                 LOG.debug("Notification {}, userAbout {}, roleAbout {} is deactivated, "
                         + "notification task will not be created", notification.getId(),
                         notification.getUserAbout(), notification.getRoleAbout());
             }
-        }
+        }        
+        return notificationList;
     }
 
     private String getRecipientEmail(