You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2014/02/05 15:49:17 UTC

svn commit: r1564792 - in /openmeetings: branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java

Author: solomax
Date: Wed Feb  5 14:49:16 2014
New Revision: 1564792

URL: http://svn.apache.org/r1564792
Log:
[OPENMEETINGS-909] email notifications are sent to the owner

Modified:
    openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
    openmeetings/trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java

Modified: openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java?rev=1564792&r1=1564791&r2=1564792&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java (original)
+++ openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java Wed Feb  5 14:49:16 2014
@@ -153,18 +153,19 @@ public class AppointmentDao {
 		Set<Long> mmIds = a.getId() == null ? new HashSet<Long>()
 				: meetingMemberDao.getMeetingMemberIdsByAppointment(a.getId());
 		// update meeting members
+		//TODO update email need to be sent on meeting members list update
+		Appointment a0 = a.getId() == null ? null : get(a.getId());
+		boolean sendMail = a0 == null || !a0.getTitle().equals(a.getTitle()) ||
+				!(a0.getDescription() != null ? a0.getDescription().equals(a.getDescription()) : true) ||
+				!(a0.getLocation() != null ? a0.getLocation().equals(a.getLocation()) : true) ||
+				!a0.getStart().equals(a.getStart()) ||
+				!a0.getEnd().equals(a.getEnd());
 		List<MeetingMember> mmList = a.getMeetingMembers();
 		if (mmList != null){
-			Appointment a0 = a.getId() == null ? null : get(a.getId());
 			for (MeetingMember mm : mmList) {
 				if (mm.getId() == null || !mmIds.contains(mm.getId())) {
 					invitationManager.processInvitation(a, mm, MessageType.Create, baseUrl);
 				} else {
-					boolean sendMail = a0 == null || !a0.getTitle().equals(a.getTitle()) ||
-						!(a0.getDescription() != null ? a0.getDescription().equals(a.getDescription()) : true) ||
-						!(a0.getLocation() != null ? a0.getLocation().equals(a.getLocation()) : true) ||
-						!a0.getStart().equals(a.getStart()) ||
-						!a0.getEnd().equals(a.getEnd());
 					mmIds.remove(mm.getId());
 					invitationManager.processInvitation(a, mm, MessageType.Update, baseUrl, sendMail);
 				}
@@ -173,6 +174,16 @@ public class AppointmentDao {
 		for (long id : mmIds) {
 			invitationManager.processInvitation(a, meetingMemberDao.get(id), MessageType.Cancel, baseUrl);
 		}
+		//notify owner
+		MeetingMember owner = new MeetingMember();
+		owner.setUser(a.getOwner());
+		if (a.getId() == null) {
+			invitationManager.processInvitation(a, owner, MessageType.Create, baseUrl);
+		} else if (a.isDeleted()) {
+			invitationManager.processInvitation(a, owner, MessageType.Cancel, baseUrl);
+		} else if (sendMail) {
+			invitationManager.processInvitation(a, owner, MessageType.Update, baseUrl, sendMail);
+		}
 		if (a.getId() == null) {
 			a.setInserted(new Date());
 			em.persist(a);

Modified: openmeetings/trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java?rev=1564792&r1=1564791&r2=1564792&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java (original)
+++ openmeetings/trunk/singlewebapp/src/db/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java Wed Feb  5 14:49:16 2014
@@ -153,18 +153,19 @@ public class AppointmentDao {
 		Set<Long> mmIds = a.getId() == null ? new HashSet<Long>()
 				: meetingMemberDao.getMeetingMemberIdsByAppointment(a.getId());
 		// update meeting members
+		//TODO update email need to be sent on meeting members list update
+		Appointment a0 = a.getId() == null ? null : get(a.getId());
+		boolean sendMail = a0 == null || !a0.getTitle().equals(a.getTitle()) ||
+				!(a0.getDescription() != null ? a0.getDescription().equals(a.getDescription()) : true) ||
+				!(a0.getLocation() != null ? a0.getLocation().equals(a.getLocation()) : true) ||
+				!a0.getStart().equals(a.getStart()) ||
+				!a0.getEnd().equals(a.getEnd());
 		List<MeetingMember> mmList = a.getMeetingMembers();
 		if (mmList != null){
-			Appointment a0 = a.getId() == null ? null : get(a.getId());
 			for (MeetingMember mm : mmList) {
 				if (mm.getId() == null || !mmIds.contains(mm.getId())) {
 					invitationManager.processInvitation(a, mm, MessageType.Create, baseUrl);
 				} else {
-					boolean sendMail = a0 == null || !a0.getTitle().equals(a.getTitle()) ||
-						!(a0.getDescription() != null ? a0.getDescription().equals(a.getDescription()) : true) ||
-						!(a0.getLocation() != null ? a0.getLocation().equals(a.getLocation()) : true) ||
-						!a0.getStart().equals(a.getStart()) ||
-						!a0.getEnd().equals(a.getEnd());
 					mmIds.remove(mm.getId());
 					invitationManager.processInvitation(a, mm, MessageType.Update, baseUrl, sendMail);
 				}
@@ -173,6 +174,16 @@ public class AppointmentDao {
 		for (long id : mmIds) {
 			invitationManager.processInvitation(a, meetingMemberDao.get(id), MessageType.Cancel, baseUrl);
 		}
+		//notify owner
+		MeetingMember owner = new MeetingMember();
+		owner.setUser(a.getOwner());
+		if (a.getId() == null) {
+			invitationManager.processInvitation(a, owner, MessageType.Create, baseUrl);
+		} else if (a.isDeleted()) {
+			invitationManager.processInvitation(a, owner, MessageType.Cancel, baseUrl);
+		} else if (sendMail) {
+			invitationManager.processInvitation(a, owner, MessageType.Update, baseUrl, sendMail);
+		}
 		if (a.getId() == null) {
 			a.setInserted(new Date());
 			em.persist(a);