[SYNCOPE-667] 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/18394d3c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/18394d3c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/18394d3c

Branch: refs/heads/1_2_X
Commit: 18394d3c5027ae9e4442414a7f886e422904d77f
Parents: 8106e24
Author: giacomolm <[email protected]>
Authored: Fri Jun 5 09:30:16 2015 +0200
Committer: giacomolm <[email protected]>
Committed: Fri Jun 5 09:30:16 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/18394d3c/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(

Reply via email to