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 2013/09/05 20:49:59 UTC

svn commit: r1520382 [1/2] - in /openmeetings/trunk/singlewebapp: WebContent/src/modules/conference/conference/ WebContent/src/modules/conference/flexibleConferenceRoom/ src/main/java/org/apache/openmeetings/axis/services/ src/main/java/org/apache/open...

Author: solomax
Date: Thu Sep  5 18:49:58 2013
New Revision: 1520382

URL: http://svn.apache.org/r1520382
Log:
[OPENMEETINGS-777] basic refactoring

Modified:
    openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/conference/roomListDetails.lzx
    openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/flexibleConferenceRoom/appointmentNotificationPopUp.lzx
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/CalendarWebService.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/RoomWebService.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/AppointmentDTO.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/MeetingMemberDTO.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/AppointmentDao.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/MeetingMemberDao.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/AppointmentLogic.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/MeetingMemberLogic.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/Appointment.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/MeetingMember.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/remote/ConferenceService.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/utils/BackupExport.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/utils/BackupImport.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.html
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentModel.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/user/calendar/CalendarPanel.java
    openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/web/user/calendar/MeetingMemberDialog.java
    openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/AbstractOpenmeetingsSpringTest.java
    openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/calendar/TestDatabaseStructureAppointment.java

Modified: openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/conference/roomListDetails.lzx
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/conference/roomListDetails.lzx?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/conference/roomListDetails.lzx (original)
+++ openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/conference/roomListDetails.lzx Thu Sep  5 18:49:58 2013
@@ -99,9 +99,9 @@
 		    	
 		    	if(value!=null){
 		    		
-		    		if ($debug) Debug.write("Appointment Name : " + value.appointmentName);
-		    		parent.bdatum.setAttribute('text',""+value.appointmentStarttime);
-		    		parent.edatum.setAttribute('text',""+value.appointmentEndtime);
+		    		if ($debug) Debug.write("Appointment Name : " + value.title);
+		    		parent.bdatum.setAttribute('text',""+value.start);
+		    		parent.edatum.setAttribute('text',""+value.end);
 		    		
 		    		
 		    		parent.bdatum.setAttribute("visibility","visible");
@@ -109,8 +109,8 @@
 		    		parent.l_bdatum.setAttribute("visibility","visible");
 		    		parent.l_edatum.setAttribute("visibility","visible");
 		    		
-		    		if ($debug) Debug.write("Appointment Start : " + value.appointmentStarttime);
-		    		if ($debug) Debug.write("Appointment End : " + value.appointmentEndtime);
+		    		if ($debug) Debug.write("Appointment Start : " + value.start);
+		    		if ($debug) Debug.write("Appointment End : " + value.end);
 		    		
 		    	} else{
 		    		

Modified: openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/flexibleConferenceRoom/appointmentNotificationPopUp.lzx
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/flexibleConferenceRoom/appointmentNotificationPopUp.lzx?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/flexibleConferenceRoom/appointmentNotificationPopUp.lzx (original)
+++ openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/flexibleConferenceRoom/appointmentNotificationPopUp.lzx Thu Sep  5 18:49:58 2013
@@ -45,13 +45,11 @@
 		    		parent._append.setAttribute('text',value.end);
 		    		parent._timeZone.setAttribute('text',value.timeZone);
 		    		
-		    		parent._appName.setAttribute('text',value.appointment.appointmentName);
-		    		parent._appDescr._appDescr.setAttribute('text',value.appointment.appointmentDescription);
+		    		parent._appName.setAttribute('text',value.appointment.title);
+		    		parent._appDescr._appDescr.setAttribute('text',value.appointment.description);
 		    	
-		    		parent._createdby.setAttribute('text',value.appointment.userId.firstname + ' ' + value.appointment.userId.lastname );
-		    		
+		    		parent._createdby.setAttribute('text',value.appointment.owner.firstname + ' ' + value.appointment.owner.lastname );
 		    	}
-		    	
 		    ]]>	        	          				
 		</handler>	
 	</netRemoteCallHib> 

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/CalendarWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/CalendarWebService.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/CalendarWebService.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/CalendarWebService.java Thu Sep  5 18:49:58 2013
@@ -443,7 +443,7 @@ public class CalendarWebService {
 				// check if the appointment belongs to the current user
 				Appointment appointment = appointmentLogic
 						.getAppointMentById(appointmentId);
-				if (!appointment.getUserId().getUser_id().equals(users_id)) {
+				if (!appointment.getOwner().getUser_id().equals(users_id)) {
 					throw new AxisFault(
 							"The Appointment cannot be updated by the given user");
 				}
@@ -534,7 +534,7 @@ public class CalendarWebService {
 				Appointment appointment = appointmentLogic
 						.getAppointMentById(appointmentId);
 
-				if (!appointment.getUserId().getUser_id().equals(users_id)) {
+				if (!appointment.getOwner().getUser_id().equals(users_id)) {
 					throw new AxisFault(
 							"The Appointment cannot be deleted by the given user");
 				}
@@ -571,10 +571,10 @@ public class CalendarWebService {
 				Appointment appStored = appointmentDao.getAppointmentByRoomId(
 						users_id, room_id);
 
-				appointment.setAppointmentStarttime(appStored
-						.getAppointmentStarttime());
-				appointment.setAppointmentEndtime(appStored
-						.getAppointmentEndtime());
+				appointment.setStart(appStored
+						.getStart());
+				appointment.setEnd(appStored
+						.end());
 
 				return appointment;
 			}
@@ -795,10 +795,10 @@ public class CalendarWebService {
 						
 						for (Appointment appointment : appointments) {
 							if (appointment
-									.appointmentStartAsCalendar(timezone).get(
+									.startCalendar(timezone).get(
 											Calendar.MONTH) == tCal
 									.get(Calendar.MONTH)
-									&& appointment.appointmentStartAsCalendar(
+									&& appointment.startCalendar(
 											timezone).get(Calendar.DATE) == tCal
 											.get(Calendar.DATE)) {
 								day.getAppointments().add(

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/RoomWebService.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/RoomWebService.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/RoomWebService.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/axis/services/RoomWebService.java Thu Sep  5 18:49:58 2013
@@ -2355,7 +2355,7 @@ public class RoomWebService {
 				}
 				// Not In Remote List available - extern user
 				Long memberId = meetingMemberLogic.addMeetingMember(firstname,
-						lastname, "0", "0", appointment.getAppointmentId(),
+						lastname, "0", "0", appointment.getId(),
 						null, email, null, baseUrl, null, new Boolean(false),
 						language_id, false, "", null, "");
 
@@ -2419,7 +2419,7 @@ public class RoomWebService {
 
 				// Not In Remote List available - extern user
 				Long memberId = meetingMemberLogic.addMeetingMember(firstname,
-						lastname, "0", "0", appointment.getAppointmentId(),
+						lastname, "0", "0", appointment.getId(),
 						null, email, "", baseUrl, null, new Boolean(false),
 						language_id, false, "", null, invitorName);
 
@@ -2496,7 +2496,7 @@ public class RoomWebService {
 	 * @return 1 in case of success, -2 if permissions are insufficient
 	 * @throws AxisFault if any error occurred
 	 */
-	public int modifyRoomParameter(String SID, Long room_id, String paramName, String paramValue)
+	public int modifyRoomParameter(String SID, Long room_id, String paramName, Object paramValue)
 			throws AxisFault {
 		try {
 			Long users_id = sessiondataDao.checkSession(SID);

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java Thu Sep  5 18:49:58 2013
@@ -48,6 +48,6 @@ public class AppointmentConverter extend
 
 	public void write(OutputNode node, Appointment value) throws Exception {
 		node.setData(true);
-		node.setValue(value == null ? "0" : "" + value.getAppointmentId());
+		node.setValue(value == null ? "0" : "" + value.getId());
 	}
 }
\ No newline at end of file

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/AppointmentDTO.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/AppointmentDTO.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/AppointmentDTO.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/AppointmentDTO.java Thu Sep  5 18:49:58 2013
@@ -43,9 +43,9 @@ public class AppointmentDTO {
 	private Long organizerId;
 
 	public AppointmentDTO(Appointment appointment, TimeZone timezone) {
-		appointmentId = appointment.getAppointmentId();
-		categoryId = (appointment.getAppointmentCategory() != null) ? appointment
-				.getAppointmentCategory().getCategoryId() : null;
+		appointmentId = appointment.getId();
+		categoryId = (appointment.getCategory() != null) ? appointment
+				.getCategory().getCategoryId() : null;
 		reminderId = (appointment.getRemind() != null) ? appointment
 				.getRemind().getTypId() : null;
 		roomId = (appointment.getRoom() != null) ? appointment.getRoom()
@@ -53,14 +53,14 @@ public class AppointmentDTO {
 		roomTypeId = (roomId != null && appointment.getRoom().getRoomtype() != null) ? appointment
 				.getRoom().getRoomtype().getRoomtypes_id()
 				: null;
-		title = appointment.getAppointmentName();
-		location = appointment.getAppointmentLocation();
-		comment = appointment.getAppointmentDescription();
-		start = appointment.appointmentStartAsCalendar(timezone);
-		end = appointment.appointmentEndAsCalendar(timezone);
-		isPasswordProtected = appointment.getIsPasswordProtected();
-		organizerId = appointment.getUserId().getUser_id();
-		for (MeetingMember meetingMemberItem : appointment.getMeetingMember()) {
+		title = appointment.getTitle();
+		location = appointment.getLocation();
+		comment = appointment.getDescription();
+		start = appointment.startCalendar(timezone);
+		end = appointment.endCalendar(timezone);
+		isPasswordProtected = appointment.isPasswordProtected();
+		organizerId = appointment.getOwner().getUser_id();
+		for (MeetingMember meetingMemberItem : appointment.getMeetingMembers()) {
 			meetingMember.add(new MeetingMemberDTO(meetingMemberItem));
 		}
 	}

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/MeetingMemberDTO.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/MeetingMemberDTO.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/MeetingMemberDTO.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/beans/MeetingMemberDTO.java Thu Sep  5 18:49:58 2013
@@ -27,9 +27,9 @@ public class MeetingMemberDTO {
 	private String jNameTimeZone;
 
 	public MeetingMemberDTO(MeetingMember meetingMemberItem) {
-		meetingMemberId = meetingMemberItem.getMeetingMemberId();
-		userid = (meetingMemberItem.getUserid() != null) ? meetingMemberItem
-				.getUserid().getUser_id() : 0;
+		meetingMemberId = meetingMemberItem.getId();
+		userid = (meetingMemberItem.getUser() != null) ? meetingMemberItem
+				.getUser().getUser_id() : 0;
 		jNameTimeZone = meetingMemberItem.getTimeZoneId();
 	}
 

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/AppointmentDao.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/AppointmentDao.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/AppointmentDao.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/AppointmentDao.java Thu Sep  5 18:49:58 2013
@@ -32,10 +32,6 @@ import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
 import javax.persistence.PersistenceContext;
 import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
 
 import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
 import org.apache.openmeetings.data.calendar.management.MeetingMemberLogic;
@@ -117,64 +113,37 @@ public class AppointmentDao {
 
 	// -----------------------------------------------------------------------------------------------
 
-	public Appointment getAppointmentById(Long appointmentId) {
-		try {
-
-			String hql = "select a from Appointment a "
-					+ "WHERE a.deleted <> :deleted "
-					+ "AND a.appointmentId = :appointmentId ";
-
-			TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
-			query.setParameter("deleted", true);
-			query.setParameter("appointmentId", appointmentId);
+	public Appointment get(Long id) {
+		TypedQuery<Appointment> query = em.createNamedQuery("getAppointmentById", Appointment.class);
+		query.setParameter("id", id);
 
-			Appointment appoint = null;
-			try {
-				appoint = query.getSingleResult();
-			} catch (NoResultException ex) {
-			}
-			appoint.setMeetingMember(meetingMemberDao.getMeetingMemberByAppointmentId(appointmentId));
-			return appoint;
-		} catch (Exception ex2) {
-			log.error("[getAppointmentById]: ", ex2);
+		Appointment appoint = null;
+		try {
+			appoint = query.getSingleResult();
+		} catch (NoResultException ex) {
 		}
-		return null;
+		return appoint;
 	}
 
 	public Appointment getAppointmentByIdBackup(Long appointmentId) {
-		try {
-
-			String hql = "select a from Appointment a "
-					+ "WHERE a.appointmentId = :appointmentId ";
+		String hql = "select a from Appointment a WHERE a.id = :id ";
 
-			TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
-			query.setParameter("appointmentId", appointmentId);
-
-			Appointment appoint = null;
-			try {
-				appoint = query.getSingleResult();
-			} catch (NoResultException ex) {
-			}
+		TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
+		query.setParameter("appointmentId", appointmentId);
 
-			return appoint;
-		} catch (Exception ex2) {
-			log.error("[getAppointmentById]: ", ex2);
+		Appointment appoint = null;
+		try {
+			appoint = query.getSingleResult();
+		} catch (NoResultException ex) {
 		}
-		return null;
+
+		return appoint;
 	}
 
 	public List<Appointment> getAppointments() {
-		try {
-			TypedQuery<Appointment> query = em.createQuery(
-				"SELECT a FROM Appointment a LEFT JOIN FETCH a.meetingMember WHERE a.deleted <> :deleted "
-				, Appointment.class);
-			query.setParameter("deleted", true);
-
-			return query.getResultList();
-		} catch (Exception ex2) {
-			log.error("[getAppointmentById]: ", ex2);
-		}
-		return null;
+		return em.createQuery(
+				"SELECT a FROM Appointment a LEFT JOIN FETCH a.meetingMembers WHERE a.deleted = false "
+				, Appointment.class).getResultList();
 	}
 
 	/**
@@ -206,8 +175,8 @@ public class AppointmentDao {
 
 			Appointment ap = new Appointment();
 
-			ap.setAppointmentName(appointmentName);
-			ap.setAppointmentLocation(appointmentLocation);
+			ap.setTitle(appointmentName);
+			ap.setLocation(appointmentLocation);
 
 			log.debug("addAppointment appointmentstart :1: "
 					+ CalendarPatterns
@@ -216,30 +185,30 @@ public class AppointmentDao {
 					+ CalendarPatterns
 							.getDateWithTimeByMiliSecondsWithZone(appointmentend));
 
-			ap.setAppointmentStarttime(appointmentstart);
-			ap.setAppointmentEndtime(appointmentend);
-			ap.setAppointmentDescription(appointmentDescription);
+			ap.setStart(appointmentstart);
+			ap.setEnd(appointmentend);
+			ap.setDescription(appointmentDescription);
 			ap.setRemind(appointmentReminderTypDao
 					.getAppointmentReminderTypById(remind));
-			ap.setStarttime(new Date());
-			ap.setIsReminderEmailSend(false);
+			ap.setInserted(new Date());
+			ap.setReminderEmailSend(false);
 			ap.setDeleted(false);
 			ap.setIsDaily(isDaily);
 			ap.setIsWeekly(isWeekly);
 			ap.setIsMonthly(isMonthly);
 			ap.setIsYearly(isYearly);
 			ap.setLanguage_id(language_id);
-			ap.setIsPasswordProtected(isPasswordProtected);
+			ap.setPasswordProtected(isPasswordProtected);
 			ap.setPassword(password);
-			ap.setUserId(usersDao.get(userId));
-			ap.setAppointmentCategory(appointmentCategoryDaoImpl
+			ap.setOwner(usersDao.get(userId));
+			ap.setCategory(appointmentCategoryDaoImpl
 					.getAppointmentCategoryById(categoryId));
 			ap.setRoom(room);
-			ap.setIsConnectedEvent(isConnectedEvent);
+			ap.setConnectedEvent(isConnectedEvent);
 
 			ap = em.merge(ap);
 
-			return ap.getAppointmentId();
+			return ap.getId();
 		} catch (Exception ex2) {
 			log.error("[addAppointment]: ", ex2);
 		}
@@ -249,11 +218,11 @@ public class AppointmentDao {
 	public Long addAppointmentObj(Appointment ap) {
 		try {
 
-			ap.setStarttime(new Date());
+			ap.setInserted(new Date());
 
 			ap = em.merge(ap);
 
-			return ap.getAppointmentId();
+			return ap.getId();
 		} catch (Exception ex2) {
 			log.error("[addAppointmentObj]: ", ex2);
 		}
@@ -262,28 +231,25 @@ public class AppointmentDao {
 
 	public Appointment update(Appointment a, Long userId) {
 		User u = usersDao.get(userId);
-		a.setUserId(u);
+		a.setOwner(u);
 		Room r = a.getRoom();
 		if (r.getRooms_id() == null) {
-			r.setName(a.getAppointmentName());
+			r.setName(a.getTitle());
 			r.setNumberOfPartizipants(cfgDao.getConfValue("calendar.conference.rooms.default.size", Long.class, "50"));
 		}
 		roomDao.update(r, userId);
-		if (a.getAppointmentId() == null) {
-			a.setStarttime(new Date());
+		if (a.getId() == null) {
+			a.setInserted(new Date());
 			em.persist(a);
 		} else {
-			a.setUpdatetime(new Date());
+			a.setUpdated(new Date());
 			a =	em.merge(a);
 		}
 		// update meeting members
-		List<MeetingMember> mmList = a.getMeetingMember();
+		List<MeetingMember> mmList = a.getMeetingMembers();
 		if (mmList != null){
-			
-			
-			
 			for (MeetingMember mm : mmList){
-				String urlPostfix = (mm.getUserid().getType() == Type.contact) ? "" : "#room/" + r.getRooms_id();
+				String urlPostfix = (mm.getUser().getType() == Type.contact) ? "" : "#room/" + r.getRooms_id();
 					
 				meetingMemberLogic.addMeetingMemberInvitation(mm, a,
 						WebSession.get().getBaseUrl() + urlPostfix, u);
@@ -295,16 +261,16 @@ public class AppointmentDao {
 	// ----------------------------------------------------------------------------------------------------------------------------
 
 	public Long updateAppointment(Appointment appointment) {
-		if (appointment.getAppointmentId() > 0) {
+		if (appointment.getId() > 0) {
 			try {
-				if (appointment.getAppointmentId() == null) {
+				if (appointment.getId() == null) {
 					em.persist(appointment);
 				} else {
 					if (!em.contains(appointment)) {
 						em.merge(appointment);
 					}
 				}
-				return appointment.getAppointmentId();
+				return appointment.getId();
 			} catch (Exception ex2) {
 				log.error("[updateAppointment] ", ex2);
 			}
@@ -345,13 +311,13 @@ public class AppointmentDao {
 
 			for (Appointment appointment : appointments) {
 
-				if (!ap.getAppointmentId().equals(
-						appointment.getAppointmentId())) {
+				if (!ap.getId().equals(
+						appointment.getId())) {
 
-					ap.setAppointmentStarttime(appointmentstart);
-					ap.setAppointmentEndtime(appointmentend);
-					ap.setUpdatetime(new Date());
-					if (ap.getAppointmentId() == null) {
+					ap.setStart(appointmentstart);
+					ap.setEnd(appointmentend);
+					ap.setUpdated(new Date());
+					if (ap.getId() == null) {
 						em.persist(ap);
 					} else {
 						if (!em.contains(ap)) {
@@ -387,27 +353,27 @@ public class AppointmentDao {
 
 			for (Appointment appointment : appointments) {
 
-				if (!ap.getAppointmentId().equals(
-						appointment.getAppointmentId())) {
+				if (!ap.getId().equals(
+						appointment.getId())) {
 
-					appointment.setAppointmentName(appointmentName);
-					appointment.setAppointmentStarttime(appointmentstart);
-					appointment.setAppointmentEndtime(appointmentend);
+					appointment.setTitle(appointmentName);
+					appointment.setStart(appointmentstart);
+					appointment.setEnd(appointmentend);
 					appointment
-							.setAppointmentDescription(appointmentDescription);
-					appointment.setUpdatetime(new Date());
+							.setDescription(appointmentDescription);
+					appointment.setUpdated(new Date());
 					appointment.setRemind(appointmentReminderTyps);
 					appointment.setIsDaily(isDaily);
 					appointment.setIsWeekly(isWeekly);
 					appointment.setIsMonthly(isMonthly);
 					appointment.setIsYearly(isYearly);
 					appointment.setLanguage_id(language_id);
-					appointment.setIsPasswordProtected(isPasswordProtected);
+					appointment.setPasswordProtected(isPasswordProtected);
 					appointment.setPassword(password);
 					// ap.setUserId(usersDao.getUser(userId));
-					appointment.setAppointmentCategory(appointmentCategory);
+					appointment.setCategory(appointmentCategory);
 
-					if (appointment.getAppointmentId() == null) {
+					if (appointment.getId() == null) {
 						em.persist(appointment);
 					} else {
 						if (!em.contains(appointment)) {
@@ -452,21 +418,21 @@ public class AppointmentDao {
 		log.debug("AppointmentDAOImpl.updateAppointment");
 		try {
 
-			Appointment ap = this.getAppointmentById(appointmentId);
+			Appointment ap = this.get(appointmentId);
 
 			AppointmentReminderTyps appointmentReminderTyps = appointmentReminderTypDao
 					.getAppointmentReminderTypById(remind);
 			AppointmentCategory appointmentCategory = appointmentCategoryDaoImpl
 					.getAppointmentCategoryById(categoryId);
 
-			boolean sendMail = !ap.getAppointmentName().equals(appointmentName) ||
-					!ap.getAppointmentDescription().equals(appointmentDescription) ||
-					!ap.getAppointmentLocation().equals(appointmentLocation) ||
-					!ap.getAppointmentStarttime().equals(appointmentstart) ||
-					!ap.getAppointmentEndtime().equals(appointmentend);
+			boolean sendMail = !ap.getTitle().equals(appointmentName) ||
+					!ap.getDescription().equals(appointmentDescription) ||
+					!ap.getLocation().equals(appointmentLocation) ||
+					!ap.getStart().equals(appointmentstart) ||
+					!ap.end().equals(appointmentend);
 			
 			// change connected events of other participants
-			if (ap.getIsConnectedEvent()) {
+			if (ap.isConnectedEvent()) {
 				this.updateConnectedEvents(ap, appointmentName,
 						appointmentDescription, appointmentstart,
 						appointmentend, isDaily, isWeekly, isMonthly, isYearly,
@@ -479,24 +445,24 @@ public class AppointmentDao {
 			invitationDao.updateInvitationByAppointment(appointmentId,
 					appointmentstart, appointmentend);
 
-			ap.setAppointmentName(appointmentName);
-			ap.setAppointmentLocation(appointmentLocation);
-			ap.setAppointmentStarttime(appointmentstart);
-			ap.setAppointmentEndtime(appointmentend);
-			ap.setAppointmentDescription(appointmentDescription);
-			ap.setUpdatetime(new Date());
+			ap.setTitle(appointmentName);
+			ap.setLocation(appointmentLocation);
+			ap.setStart(appointmentstart);
+			ap.setEnd(appointmentend);
+			ap.setDescription(appointmentDescription);
+			ap.setUpdated(new Date());
 			ap.setRemind(appointmentReminderTyps);
 			ap.setIsDaily(isDaily);
 			ap.setIsWeekly(isWeekly);
 			ap.setIsMonthly(isMonthly);
 			ap.setIsYearly(isYearly);
 			ap.setLanguage_id(language_id);
-			ap.setIsPasswordProtected(isPasswordProtected);
+			ap.setPasswordProtected(isPasswordProtected);
 			ap.setPassword(password);
 			// ap.setUserId(usersDao.getUser(userId));
-			ap.setAppointmentCategory(appointmentCategory);
+			ap.setCategory(appointmentCategory);
 
-			if (ap.getAppointmentId() == null) {
+			if (ap.getId() == null) {
 				em.persist(ap);
 			} else {
 				if (!em.contains(ap)) {
@@ -511,7 +477,7 @@ public class AppointmentDao {
 					+ " [" + user.getAdresses().getEmail() + "]";
 
 			List<MeetingMember> meetingsRemoteMembers = meetingMemberDao
-					.getMeetingMemberByAppointmentId(ap.getAppointmentId());
+					.getMeetingMemberByAppointmentId(ap.getId());
 
 			// to remove
 			for (MeetingMember memberRemote : meetingsRemoteMembers) {
@@ -528,9 +494,9 @@ public class AppointmentDao {
 										clientMemeber.get("meetingMemberId")
 												.toString()).longValue();
 						
-						log.debug("DELETE newly CHECK meetingMemberId: {} VS {} -- ", meetingMemberId, memberRemote.getMeetingMemberId());
+						log.debug("DELETE newly CHECK meetingMemberId: {} VS {} -- ", meetingMemberId, memberRemote.getId());
 
-						if (memberRemote.getMeetingMemberId().equals(
+						if (memberRemote.getId().equals(
 								meetingMemberId)) {
 							log.debug("AppointMentDAOImpl.updateAppointment  - member "
 									+ meetingMemberId + " is to be removed!");
@@ -544,11 +510,11 @@ public class AppointmentDao {
 
 				if (!found) {
 					
-					log.debug("DELETE getMeetingMemberId: {} -- ", memberRemote.getMeetingMemberId());
+					log.debug("DELETE getMeetingMemberId: {} -- ", memberRemote.getId());
 
 					// Not in List in client delete it
 					meetingMemberLogic.deleteMeetingMember(
-							memberRemote.getMeetingMemberId(), users_id,
+							memberRemote.getId(), users_id,
 							language_id);
 					// meetingMemberDao.deleteMeetingMember(memberRemote.getMeetingMemberId());
 				} else {
@@ -574,7 +540,7 @@ public class AppointmentDao {
 					boolean found = false;
 
 					for (MeetingMember memberRemote : meetingsRemoteMembers) {
-						if (memberRemote.getMeetingMemberId().equals(
+						if (memberRemote.getId().equals(
 								meetingMemberId)) {
 							found = true;
 						}
@@ -665,13 +631,13 @@ public class AppointmentDao {
 		log.debug("AppointmentDAOImpl.updateAppointment");
 		try {
 
-			Appointment ap = this.getAppointmentById(appointmentId);
+			Appointment ap = get(appointmentId);
 
-			if (!ap.getStarttime().equals(appointmentstart) ||
-					!ap.getAppointmentEndtime().equals(appointmentend)) {
+			if (!ap.getInserted().equals(appointmentstart) ||
+					!ap.end().equals(appointmentend)) {
 
 			// change connected events of other participants
-			if (ap.getIsConnectedEvent()) {
+			if (ap.isConnectedEvent()) {
 				this.updateConnectedEventsTimeOnly(ap, appointmentstart,
 						appointmentend);
 			}
@@ -680,18 +646,18 @@ public class AppointmentDao {
 			invitationDao.updateInvitationByAppointment(appointmentId,
 					appointmentstart, appointmentend);
 
-			ap.setAppointmentStarttime(appointmentstart);
-			ap.setAppointmentEndtime(appointmentend);
-			ap.setUpdatetime(new Date());
+			ap.setStart(appointmentstart);
+			ap.setEnd(appointmentend);
+			ap.setUpdated(new Date());
 
-			if (ap.getAppointmentId() == null) {
+			if (ap.getId() == null) {
 				em.persist(ap);
 				} else if (!em.contains(ap)) {
 					em.merge(ap);
 				}
 
 			List<MeetingMember> meetingsRemoteMembers = meetingMemberDao
-					.getMeetingMemberByAppointmentId(ap.getAppointmentId());
+					.getMeetingMemberByAppointmentId(ap.getId());
 
 			// Adding Invitor Name
 			User user = userManager.getUserById(users_id);
@@ -721,11 +687,11 @@ public class AppointmentDao {
 		log.debug("deleteAppointMent");
 		try {
 
-			Appointment app = this.getAppointmentById(appointmentId);
-			app.setUpdatetime(new Date());
+			Appointment app = get(appointmentId);
+			app.setUpdated(new Date());
 			app.setDeleted(true);
 
-			if (app.getAppointmentId() == null) {
+			if (app.getId() == null) {
 				em.persist(app);
 			} else {
 				if (!em.contains(app)) {
@@ -740,60 +706,44 @@ public class AppointmentDao {
 	}
 
 	public List<Appointment> getAppointmentsByRange(Long userId, Date start, Date end) {
-		try {
-			Calendar calstart = Calendar.getInstance();
-			calstart.setTime(start);
-			calstart.set(Calendar.HOUR, 0);
-
-			Calendar calend = Calendar.getInstance();
-			calend.setTime(end);
-			calend.set(Calendar.HOUR, 23);
-			calend.set(Calendar.MINUTE, 59);
-			
-			log.debug("Start " + calstart.getTime() + " End " + calend.getTime());
-
-			TypedQuery<Appointment> query = em.createNamedQuery("appointmentsInRange", Appointment.class);
-			query.setParameter("deleted", true);
-			query.setParameter("starttime", calstart.getTime());
-			query.setParameter("endtime", calend.getTime());
-			query.setParameter("userId", userId);
-			
-			List<Appointment> listAppoints = new ArrayList<Appointment>(query.getResultList()); 
-			TypedQuery<Appointment> q1 = em.createNamedQuery("joinedAppointmentsInRange", Appointment.class);
-			q1.setParameter("starttime", calstart.getTime());
-			q1.setParameter("endtime", calend.getTime());
-			q1.setParameter("userId", userId);
-			for (Appointment a : q1.getResultList()) {
-				a.setIsConnectedEvent(true); //TODO need to be reviewed
-				listAppoints.add(a);
-			}
-			
-			for (Appointment appointment : listAppoints) {
-				log.debug("" + appointment);
-
-				appointment.setMeetingMember(meetingMemberDao
-						.getMeetingMemberByAppointmentId(appointment
-								.getAppointmentId()));
-
-			}
-
-			return listAppoints;
-		} catch (Exception ex2) {
-			log.error("[getAppointmentsByRange]: ", ex2);
+		Calendar calstart = Calendar.getInstance();
+		calstart.setTime(start);
+		calstart.set(Calendar.HOUR, 0);
+
+		Calendar calend = Calendar.getInstance();
+		calend.setTime(end);
+		calend.set(Calendar.HOUR, 23);
+		calend.set(Calendar.MINUTE, 59);
+		
+		log.debug("Start " + calstart.getTime() + " End " + calend.getTime());
+
+		TypedQuery<Appointment> query = em.createNamedQuery("appointmentsInRange", Appointment.class);
+		query.setParameter("starttime", calstart.getTime());
+		query.setParameter("endtime", calend.getTime());
+		query.setParameter("userId", userId);
+		
+		List<Appointment> listAppoints = new ArrayList<Appointment>(query.getResultList()); 
+		TypedQuery<Appointment> q1 = em.createNamedQuery("joinedAppointmentsInRange", Appointment.class);
+		q1.setParameter("starttime", calstart.getTime());
+		q1.setParameter("endtime", calend.getTime());
+		q1.setParameter("userId", userId);
+		for (Appointment a : q1.getResultList()) {
+			a.setConnectedEvent(true); //TODO need to be reviewed
+			listAppoints.add(a);
 		}
-		return null;
+
+		return listAppoints;
 	}
 
 	public List<Appointment> getAppointmentsByCat(Long categoryId) {
 		try {
 
 			String hql = "select a from Appointments a "
-					+ "WHERE a.deleted <> :deleted "
+					+ "WHERE a.deleted false "
 					+ "AND a.appointmentCategory.categoryId = :categoryId";
 
 			TypedQuery<Appointment> query = em.createQuery(hql,
 					Appointment.class);
-			query.setParameter("deleted", true);
 			query.setParameter("categoryId", categoryId);
 
 			List<Appointment> listAppoints = query.getResultList();
@@ -804,35 +754,15 @@ public class AppointmentDao {
 		return null;
 	}
 
-	public List<Appointment> getAppointmentsByCritAndCat(Long cat_id) {
-		try {
-
-			CriteriaBuilder cb = em.getCriteriaBuilder();
-			CriteriaQuery<Appointment> cq = cb.createQuery(Appointment.class);
-			Root<Appointment> c = cq.from(Appointment.class);
-			Predicate condition = cb.equal(c.get("deleted"), false);
-			Predicate subCondition = cb.equal(c.get("categoryId"), cat_id);
-			cq.where(condition, subCondition);
-			TypedQuery<Appointment> q = em.createQuery(cq);
-			List<Appointment> listAppoints = q.getResultList();
-
-			return listAppoints;
-		} catch (Exception ex2) {
-			log.error("[getAppointements]: ", ex2);
-		}
-		return null;
-	}
-
 	// next appointment to select date
 	public Appointment getNextAppointment(Date appointmentStarttime) {
 		try {
 
 			String hql = "select a from Appointment a "
-					+ "WHERE a.deleted <> :deleted "
-					+ "AND a.appointmentStarttime > :appointmentStarttime ";
+					+ "WHERE a.deleted false "
+					+ "AND a.start > :appointmentStarttime ";
 
 			TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
-			query.setParameter("deleted", true);
 			query.setParameter("appointmentStarttime", appointmentStarttime);
 
 			Appointment appoint = null;
@@ -852,12 +782,11 @@ public class AppointmentDao {
 		try {
 
 			String hql = "select a from Appointment a "
-					+ "WHERE a.deleted <> :deleted "
-					+ "AND a.appointmentName LIKE :appointmentName";
+					+ "WHERE a.deleted false "
+					+ "AND a.title LIKE :appointmentName";
 
 			TypedQuery<Appointment> query = em.createQuery(hql,
 					Appointment.class);
-			query.setParameter("deleted", true);
 			query.setParameter("appointmentName", name);
 
 			List<Appointment> listAppoints = query.getResultList();
@@ -920,10 +849,10 @@ public class AppointmentDao {
 					+ "JOIN mm.appointment as app "
 					+ "WHERE mm.deleted <> :mm_deleted "
 					+ "AND app.deleted <> :app_deleted "
-					+ "AND app.appointmentStarttime between :starttime AND :endtime ";
+					+ "AND app.start between :starttime AND :endtime ";
 
 			if (isReminderEmailSend != null) {
-				hql += "AND ( app.isReminderEmailSend IS NULL OR app.isReminderEmailSend = :isReminderEmailSend ) ";
+				hql += "AND (app.reminderEmailSend = :isReminderEmailSend) ";
 			}
 
 			Calendar startCal = Calendar.getInstance();
@@ -968,7 +897,7 @@ public class AppointmentDao {
 
 			String hql = "select a from Appointment a "
 					+ "WHERE a.deleted <> :deleted "
-					+ "AND a.userId.user_id = :user_id "
+					+ "AND a.owner.user_id = :user_id "
 					+ "AND a.room.rooms_id = :rooms_id ";
 
 			TypedQuery<Appointment> query = em.createQuery(hql,

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/MeetingMemberDao.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/MeetingMemberDao.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/MeetingMemberDao.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/daos/MeetingMemberDao.java Thu Sep  5 18:49:58 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.openmeetings.data.calendar.daos;
 
+import static org.apache.openmeetings.OpenmeetingsVariables.webAppRootKey;
+
 import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
@@ -27,7 +29,6 @@ import javax.persistence.NoResultExcepti
 import javax.persistence.PersistenceContext;
 import javax.persistence.TypedQuery;
 
-import org.apache.openmeetings.OpenmeetingsVariables;
 import org.apache.openmeetings.data.user.dao.UserDao;
 import org.apache.openmeetings.persistence.beans.calendar.MeetingMember;
 import org.red5.logging.Red5LoggerFactory;
@@ -37,9 +38,7 @@ import org.springframework.transaction.a
 
 @Transactional
 public class MeetingMemberDao {
-
-	private static final Logger log = Red5LoggerFactory.getLogger(
-			MeetingMemberDao.class, OpenmeetingsVariables.webAppRootKey);
+	private static final Logger log = Red5LoggerFactory.getLogger(MeetingMemberDao.class, webAppRootKey);
 	@PersistenceContext
 	private EntityManager em;
 	@Autowired
@@ -47,44 +46,20 @@ public class MeetingMemberDao {
 	@Autowired
 	private UserDao usersDao;
 
-	public MeetingMember getMeetingMemberById(Long meetingMemberId) {
+	public MeetingMember get(Long meetingMemberId) {
+		MeetingMember meetingMember = null;
 		try {
-			log.debug("getMeetingMemberById: " + meetingMemberId);
-
-			String hql = "select app from MeetingMember app "
-					+ "WHERE app.deleted <> :deleted "
-					+ "AND app.meetingMemberId = :meetingMemberId";
-
-			TypedQuery<MeetingMember> query = em.createQuery(hql, MeetingMember.class);
-			query.setParameter("deleted", true);
-			query.setParameter("meetingMemberId", meetingMemberId);
-
-			MeetingMember meetingMember = null;
-			try {
-				meetingMember = query.getSingleResult();
-			} catch (NoResultException ex) {
-			}
-
-			return meetingMember;
-		} catch (Exception ex2) {
-			log.error("[getMeetingMemberById]: ", ex2);
+			meetingMember = em.createQuery("SELECT app FROM MeetingMember app "
+					+ "WHERE app.deleted = false AND app.id = :id", MeetingMember.class)
+					.setParameter("id", meetingMemberId).getSingleResult();
+		} catch (NoResultException ex) {
 		}
-		return null;
+
+		return meetingMember;
 	}
 
 	public List<MeetingMember> getMeetingMembers() {
-		try {
-			String hql = "select app from MeetingMember app";
-			
-			TypedQuery<MeetingMember> query = em.createQuery(hql, MeetingMember.class);
-
-			List<MeetingMember> meetingMembers = query.getResultList();
-
-			return meetingMembers;
-		} catch (Exception ex2) {
-			log.error("[getMeetingMembers]: ", ex2);
-		}
-		return null;
+		return em.createQuery("select app from MeetingMember app", MeetingMember.class).getResultList();
 	}
 
 	public List<MeetingMember> getMeetingMemberByAppointmentId(
@@ -93,12 +68,11 @@ public class MeetingMemberDao {
 			log.debug("getMeetingMemberByAppointmentId: " + appointmentId);
 
 			String hql = "select app from MeetingMember app "
-					+ "WHERE app.deleted <> :deleted "
-					+ "AND app.appointment.appointmentId = :appointmentId";
+					+ "WHERE app.deleted = false "
+					+ "AND app.appointment.id = :id";
 
 			TypedQuery<MeetingMember> query = em.createQuery(hql, MeetingMember.class);
-			query.setParameter("deleted", true);
-			query.setParameter("appointmentId", appointmentId);
+			query.setParameter("id", appointmentId);
 
 			List<MeetingMember> listmeetingMember = query.getResultList();
 
@@ -113,25 +87,15 @@ public class MeetingMemberDao {
 	 * Updating MeetingMember
 	 */
 	// -------------------------------------------------------------------------------
-	public MeetingMember updateMeetingMember(MeetingMember meetingMember) {
-		log.debug("");
-		if (meetingMember.getMeetingMemberId() > 0) {
-			try {
-				if (meetingMember.getMeetingMemberId() == null) {
-					em.persist(meetingMember);
-				} else {
-					if (!em.contains(meetingMember)) {
-						meetingMember = em.merge(meetingMember);
-					}
-				}
-				return meetingMember;
-			} catch (Exception ex2) {
-				log.error("[updateMeetingMember] ", ex2);
-			}
+	public MeetingMember update(MeetingMember meetingMember) {
+		if (meetingMember.getId() == null) {
+			em.persist(meetingMember);
 		} else {
-			log.error("[updateUser] " + "Error: No MeetingMemberId given");
+			if (!em.contains(meetingMember)) {
+				meetingMember = em.merge(meetingMember);
+			}
 		}
-		return null;
+		return meetingMember;
 	}
 
 	// -------------------------------------------------------------------------------
@@ -140,26 +104,26 @@ public class MeetingMemberDao {
 			Long appointmentId, Long userid) {
 		try {
 
-			MeetingMember gm = this.getMeetingMemberById(meetingMemberId);
+			MeetingMember gm = this.get(meetingMemberId);
 			/*
 			 * if (gm == null) { log.debug("ALERT Object with ID: "+
 			 * MeetingMemberId +" does not exist yet"); return null; }
 			 */
 
 			gm.setAppointmentStatus(appointmentStatus);
-			gm.setAppointment(appointmentDao.getAppointmentById(appointmentId));
+			gm.setAppointment(appointmentDao.get(appointmentId));
 			gm.setDeleted(false);
-			gm.setUpdatetime(new Date());
-			gm.setUserid(usersDao.get(userid));
+			gm.setUpdated(new Date());
+			gm.setUser(usersDao.get(userid));
 
-			if (gm.getMeetingMemberId() == null) {
+			if (gm.getId() == null) {
 				em.persist(gm);
 			} else {
 				if (!em.contains(gm)) {
 					gm = em.merge(gm);
 				}
 			}
-			meetingMemberId = gm.getMeetingMemberId();
+			meetingMemberId = gm.getId();
 			return meetingMemberId;
 		} catch (Exception ex2) {
 			log.error("[updateMeetingMember]: ", ex2);
@@ -174,29 +138,17 @@ public class MeetingMemberDao {
 			MeetingMember gm = new MeetingMember();
 
 			gm.setAppointmentStatus(appointmentStatus);
-			gm.setAppointment(appointmentDao.getAppointmentById(appointmentId));
-			gm.setUserid(userid == null ? null : usersDao.get(userid));
+			gm.setAppointment(appointmentDao.get(appointmentId));
+			gm.setUser(userid == null ? null : usersDao.get(userid));
 
-			gm.setStarttime(new Date());
+			gm.setInserted(new Date());
 			gm.setDeleted(false);
-			gm.setIsConnectedEvent(isConnectedEvent);
+			gm.setConnectedEvent(isConnectedEvent);
 			
 			gm.setTimeZoneId(timeZone.getID());
 
 			gm = em.merge(gm);
-			Long group_member_id = gm.getMeetingMemberId();
-
-			return group_member_id;
-		} catch (Exception ex2) {
-			log.error("[addMeetingMember]: ", ex2);
-		}
-		return null;
-	}
-
-	public Long addMeetingMemberByObject(MeetingMember gm) {
-		try {
-			gm = em.merge(gm);
-			Long group_member_id = gm.getMeetingMemberId();
+			Long group_member_id = gm.getId();
 
 			return group_member_id;
 		} catch (Exception ex2) {
@@ -211,7 +163,7 @@ public class MeetingMemberDao {
 
 		try {
 
-			MeetingMember gm = this.getMeetingMemberById(meetingMemberId);
+			MeetingMember gm = this.get(meetingMemberId);
 
 			log.debug("ac: " + gm);
 
@@ -220,10 +172,10 @@ public class MeetingMemberDao {
 						+ meetingMemberId);
 				return null;
 			}
-			gm.setUpdatetime(new Date());
+			gm.setUpdated(new Date());
 			gm.setDeleted(true);
 
-			if (gm.getMeetingMemberId() == null) {
+			if (gm.getId() == null) {
 				em.persist(gm);
 			} else {
 				if (!em.contains(gm)) {

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/AppointmentLogic.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/AppointmentLogic.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/AppointmentLogic.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/AppointmentLogic.java Thu Sep  5 18:49:58 2013
@@ -321,12 +321,12 @@ public class AppointmentLogic {
 				return null;
 			}
 
-			if (point.getIsConnectedEvent()) {
+			if (point.isConnectedEvent()) {
 				List<Appointment> appointments = appointmentDao.getAppointmentsByRoomId(point.getRoom().getRooms_id());
 
 				for (Appointment appointment : appointments) {
-					if (!appointment.getAppointmentId().equals(appointmentId)) {
-						appointmentDao.deleteAppointement(appointment.getAppointmentId());
+					if (!appointment.getId().equals(appointmentId)) {
+						appointmentDao.deleteAppointement(appointment.getId());
 					}
 				}
 			}
@@ -337,13 +337,13 @@ public class AppointmentLogic {
 			List<MeetingMember> members = meetingMemberDao.getMeetingMemberByAppointmentId(appointmentId);
 
 			if (members == null) {
-				log.debug("Appointment " + point.getAppointmentName() + " has no meeting members");
+				log.debug("Appointment " + point.getTitle() + " has no meeting members");
 			}
 
 			if (members != null) {
 				for (int i = 0; i < members.size(); i++) {
-					log.debug("deleting member " + members.get(i).getUserid().getAdresses().getEmail());
-					meetingMemberLogic.deleteMeetingMember(members.get(i).getMeetingMemberId(), users_id, language_id);
+					log.debug("deleting member " + members.get(i).getUser().getAdresses().getEmail());
+					meetingMemberLogic.deleteMeetingMember(members.get(i).getId(), users_id, language_id);
 				}
 			}
 
@@ -372,7 +372,7 @@ public class AppointmentLogic {
 	public Appointment getAppointMentById(Long appointment) {
 		log.debug("getAppointMentById");
 
-		return appointmentDao.getAppointmentById(appointment);
+		return appointmentDao.get(appointment);
 	}
 
 	// ----------------------------------------------------------------------------------------------
@@ -422,8 +422,7 @@ public class AppointmentLogic {
 
 			// Prevent email from being send twice, even if the cycle takes
 			// very long to send each
-			if (ment.getIsReminderEmailSend() != null
-					&& ment.getIsReminderEmailSend()) {
+			if (ment.isReminderEmailSend()) {
 				continue;
 			}
 
@@ -433,12 +432,10 @@ public class AppointmentLogic {
 					|| ment.getRemind().getTypId() == 3) {
 
 				// Update Appointment to not send invitation twice
-				ment.setIsReminderEmailSend(true);
+				ment.setReminderEmailSend(true);
 				appointmentDao.updateAppointment(ment);
 
-				List<MeetingMember> members = meetingMemberDao
-						.getMeetingMemberByAppointmentId(ment
-								.getAppointmentId());
+				List<MeetingMember> members = meetingMemberDao.getMeetingMemberByAppointmentId(ment.getId());
 
 				if (members == null) {
 					log.debug("doScheduledMeetingReminder : no members in meeting!");
@@ -449,14 +446,14 @@ public class AppointmentLogic {
 				for (MeetingMember mm : members) {
 
 					log.debug("doScheduledMeetingReminder : Member "
-							+ mm.getUserid().getAdresses().getEmail());
+							+ mm.getUser().getAdresses().getEmail());
 
 					Invitations inv = mm.getInvitation();
 
 					if (inv == null) {
 						log.error("Error retrieving Invitation for member "
-								+ mm.getUserid().getAdresses().getEmail() + " in Appointment "
-								+ ment.getAppointmentName());
+								+ mm.getUser().getAdresses().getEmail() + " in Appointment "
+								+ ment.getTitle());
 						continue;
 					}
 
@@ -476,10 +473,10 @@ public class AppointmentLogic {
 							language_id, labelid1153, labelid1154, tZone);
 
 					invitationManager.sendInvitationReminderLink(language_id, message,
-							inv.getBaseUrl(), mm.getUserid().getAdresses().getEmail(), subject,
+							inv.getBaseUrl(), mm.getUser().getAdresses().getEmail(), subject,
 							inv.getHash());
 
-					invitationManager.sendInvitationReminderSMS(mm.getUserid().getAdresses().getPhone(), smsSubject, language_id);
+					invitationManager.sendInvitationReminderSMS(mm.getUser().getAdresses().getPhone(), smsSubject, language_id);
 					inv.setUpdatetime(new Date());
 					invitationDao.updateInvitation(inv);
 				}
@@ -491,15 +488,15 @@ public class AppointmentLogic {
 			Appointment ment, TimeZone timezone) {
 
 		String message = labelid1158 + " "
-				+ ment.getAppointmentName();
+				+ ment.getTitle();
 
 		message += ' ' + CalendarPatterns
 				.getDateWithTimeByMiliSecondsAndTimeZone(
-						ment.getAppointmentStarttime(), timezone);
+						ment.getStart(), timezone);
 
 		message += " - "
 				+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-						ment.getAppointmentEndtime(), timezone);
+						ment.end(), timezone);
 
 		return message;
 
@@ -508,7 +505,7 @@ public class AppointmentLogic {
 	private String generateSMSSubject(String labelid1158, Appointment ment) {
 		String subj = configurationDao.getConfValue("sms.subject", String.class, null);
 		return subj == null || subj.length() == 0 ? 
-				labelid1158 + " " + ment.getAppointmentName() : subj;
+				labelid1158 + " " + ment.getTitle() : subj;
 	}
 	
 	/**
@@ -529,14 +526,14 @@ public class AppointmentLogic {
 			TimeZone timezone) {
 
 		String message = labelid1158 + " "
-				+ ment.getAppointmentName();
+				+ ment.getTitle();
 
-		if (ment.getAppointmentDescription().length() != 0) {
+		if (ment.getDescription().length() != 0) {
 
 			Fieldlanguagesvalues labelid1152 = fieldManager
 					.getFieldByIdAndLanguage(new Long(1152), language_id);
 			message += labelid1152.getValue()
-					+ ment.getAppointmentDescription();
+					+ ment.getDescription();
 
 		}
 
@@ -544,12 +541,12 @@ public class AppointmentLogic {
 				+ labelid1153.getValue()
 				+ ' '
 				+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-						ment.getAppointmentStarttime(), timezone) + "<br/>";
+						ment.getStart(), timezone) + "<br/>";
 
 		message += labelid1154.getValue()
 				+ ' '
 				+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-						ment.getAppointmentEndtime(), timezone) + "<br/>";
+						ment.end(), timezone) + "<br/>";
 
 		return message;
 	}

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/MeetingMemberLogic.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/MeetingMemberLogic.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/MeetingMemberLogic.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/calendar/management/MeetingMemberLogic.java Thu Sep  5 18:49:58 2013
@@ -97,7 +97,7 @@ public class MeetingMemberLogic {
 					.getAppointMentById(appointmentId);
 
 			MeetingMember member = getMemberById(memberId);
-			boolean isInvitor = member.getUserid().getUser_id() == point.getUserId().getUser_id();
+			boolean isInvitor = member.getUser().getUser_id() == point.getOwner().getUser_id();
 
 			Long invitationId = null;
 
@@ -132,15 +132,15 @@ public class MeetingMemberLogic {
 								isPasswordProtected, // passwordprotected
 								password, // invitationpass
 								2, // valid type
-								point.getAppointmentStarttime(), // valid from
-								point.getAppointmentEndtime(), // valid to
+								point.getStart(), // valid from
+								point.end(), // valid to
 								meeting_organizer, // created by
 								baseUrl,
 								language_id,
 								true, // really send mail sendMail
-								point.getAppointmentStarttime(),
-								point.getAppointmentEndtime(),
-								point.getAppointmentId(),
+								point.getStart(),
+								point.end(),
+								point.getId(),
 								invitorName,
 								timezone
 								);
@@ -165,12 +165,12 @@ public class MeetingMemberLogic {
 								isPasswordProtected, // passwordprotected
 								password, // invitationpass
 								2, // valid
-								point.getAppointmentStarttime(), // valid from
-								point.getAppointmentEndtime(), // valid to
+								point.getStart(), // valid from
+								point.end(), // valid to
 								meeting_organizer, // created by
-								point.getAppointmentId(), isInvitor,
+								point.getId(), isInvitor,
 								language_id, timezone,
-								point.getAppointmentId(),
+								point.getId(),
 								invitorName);
 
 			}
@@ -221,10 +221,10 @@ public class MeetingMemberLogic {
 			log.debug(":::: addMeetingMemberInvitation ..... "
 					+ appointment.getRemind().getTypId());
 
-			String subject = formatSubject(member.getUserid().getLanguage_id(), appointment, timezoneUtil.getTimezoneByUser(organizer));
+			String subject = formatSubject(member.getUser().getLanguage_id(), appointment, timezoneUtil.getTimezoneByUser(organizer));
 
 			String invitorName = organizer.getFirstname() + " " + organizer.getLastname();
-			String message = formatMessage(member.getUserid().getLanguage_id(), appointment, timezoneUtil.getTimezoneByUser(organizer),
+			String message = formatMessage(member.getUser().getLanguage_id(), appointment, timezoneUtil.getTimezoneByUser(organizer),
 					invitorName);
 
 			// appointment.getRemind().getTypId() == 1 will not receive emails
@@ -288,15 +288,15 @@ public class MeetingMemberLogic {
 			TimeZone timezone) {
 		try {
 			String message = fieldManager.getString(1151L, language_id) + " "
-					+ point.getAppointmentName();
+					+ point.getTitle();
 
 			message += " "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							point.getAppointmentStarttime(), timezone);
+							point.getStart(), timezone);
 
 			message += " - "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							point.getAppointmentEndtime(), timezone);
+							point.end(), timezone);
 
 			return message;
 		} catch (Exception err) {
@@ -310,25 +310,25 @@ public class MeetingMemberLogic {
 			TimeZone timezone, String invitorName) {
 		try {
 			String message = fieldManager.getString(1151L, language_id) + " "
-					+ point.getAppointmentName();
+					+ point.getTitle();
 
-			if (point.getAppointmentDescription() != null && 
-					point.getAppointmentDescription().length() != 0) {
+			if (point.getDescription() != null && 
+					point.getDescription().length() != 0) {
 				message += fieldManager.getString(1152L, language_id)
-						+ point.getAppointmentDescription();
+						+ point.getDescription();
 			}
 
 			message += "<br/>"
 					+ fieldManager.getString(1153L, language_id)
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							point.getAppointmentStarttime(), timezone)
+							point.getStart(), timezone)
 					+ "<br/>";
 
 			message += fieldManager.getString(1154L, language_id)
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							point.getAppointmentEndtime(), timezone) + "<br/>";
+							point.end(), timezone) + "<br/>";
 
 			message += fieldManager.getString(1156L, language_id) + invitorName + "<br/>";
 
@@ -353,7 +353,7 @@ public class MeetingMemberLogic {
 		log.debug("MeetingMemberLogic.updateMeetingMember");
 
 		MeetingMember member = meetingMemberDao
-				.getMeetingMemberById(meetingMemberId);
+				.get(meetingMemberId);
 
 		if (member == null) {
 			log.error("Couldnt retrieve Member for ID " + meetingMemberId);
@@ -380,8 +380,8 @@ public class MeetingMemberLogic {
 	public Long updateMeetingMember(MeetingMember member) {
 		log.debug("updateMeetingMember");
 
-		return meetingMemberDao.updateMeetingMember(member)
-				.getMeetingMemberId();
+		return meetingMemberDao.update(member)
+				.getId();
 	}
 
 	// --------------------------------------------------------------------------------------------
@@ -394,7 +394,7 @@ public class MeetingMemberLogic {
 	public MeetingMember getMemberById(Long memberId) {
 		log.debug("getMemberById");
 
-		return meetingMemberDao.getMeetingMemberById(memberId);
+		return meetingMemberDao.get(memberId);
 	}
 
 	// --------------------------------------------------------------------------------------------
@@ -413,7 +413,7 @@ public class MeetingMemberLogic {
 		try {
 
 			MeetingMember member = meetingMemberDao
-					.getMeetingMemberById(meetingMemberId);
+					.get(meetingMemberId);
 
 			if (member == null) {
 				log.error("could not find meeting member!");
@@ -422,7 +422,7 @@ public class MeetingMemberLogic {
 
 			Appointment point = member.getAppointment();
 			point = appointmentLogic.getAppointMentById(point
-					.getAppointmentId());
+					.getId());
 
 			if (point == null) {
 				log.error("could not retrieve appointment!");

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java Thu Sep  5 18:49:58 2013
@@ -221,8 +221,8 @@ public class InvitationManager {
 			User createdBy) {
 		try {
 			Invitations invitation = new Invitations();
-			invitation.setIsPasswordProtected(appointment.getIsPasswordProtected());
-			if (appointment.getIsPasswordProtected()) {
+			invitation.setIsPasswordProtected(appointment.isPasswordProtected());
+			if (appointment.isPasswordProtected()) {
 				invitation.setInvitationpass(manageCryptStyle
 						.getInstanceOfCrypt().createPassPhrase(
 								appointment.getPassword()));
@@ -243,11 +243,11 @@ public class InvitationManager {
 				invitation.setIsValidByTime(true);
 				invitation.setCanBeUsedOnlyOneTime(false);
 
-				Date gmtTimeStartShifted = new Date(appointment.getAppointmentStarttime().getTime()
+				Date gmtTimeStartShifted = new Date(appointment.getStart().getTime()
 						- (5 * 60 * 1000));
 
 				invitation.setValidFrom(gmtTimeStartShifted);
-				invitation.setValidTo(appointment.getAppointmentEndtime());
+				invitation.setValidTo(appointment.end());
 
 			} else {
 				// one-time
@@ -262,13 +262,13 @@ public class InvitationManager {
 			invitation.setHash(MD5.do_checksum(hashRaw));
 
 			invitation.setInvitedBy(createdBy);
-			String userName = meetingMember.getUserid().getFirstname() + " " + meetingMember.getUserid().getLastname();
+			String userName = meetingMember.getUser().getFirstname() + " " + meetingMember.getUser().getLastname();
 			invitation.setInvitedname(userName);
-			invitation.setInvitedEMail(meetingMember.getUserid().getAdresses().getEmail());
+			invitation.setInvitedEMail(meetingMember.getUser().getAdresses().getEmail());
 			invitation.setRoom(appointment.getRoom());
 			invitation.setConferencedomain(conferencedomain);
 			invitation.setStarttime(new Date());
-			invitation.setAppointmentId(appointment.getAppointmentId());
+			invitation.setAppointmentId(appointment.getId());
 
 			invitation = invitationDao.updateInvitation(invitation);
 			long invitationId = invitation.getInvitations_id();
@@ -316,12 +316,12 @@ public class InvitationManager {
 		}
 
 		if (appointment.getRemind() == null) {
-			log.error("Appointment " + appointment.getAppointmentName()
+			log.error("Appointment " + appointment.getTitle()
 					+ " has no ReminderType!");
 			return;
 		}
 
-		User us = member.getUserid();
+		User us = member.getUser();
 		TimeZone timezone = null;
 		// external users have no user object stored so we will need to get the
 		// timezone from the stored string
@@ -341,20 +341,20 @@ public class InvitationManager {
 			log.debug("no remindertype defined -> no cancel of invitation");
 		} else if (appointment.getRemind().getTypId() == 2) {
 			log.debug("ReminderType simple mail -> sending simple mail...");
-			sendInvitationCancelMail(member.getUserid().getAdresses().getEmail(),
+			sendInvitationCancelMail(member.getUser().getAdresses().getEmail(),
 					member.getAppointment(), user.getAdresses().getEmail(),
 					subject, message);
 		} else if (appointment.getRemind().getTypId() == 3) {
 			try {
-				sendInvitationIcalCancelMail(member.getUserid().getAdresses().getEmail(),
-						member.getUserid().getFirstname() + " " + member.getUserid().getLastname(),
-						appointment, canceling_user_id, (appointment.getUserId().getUser_id() == member.getUserid().getUser_id()),
-						appointment.getAppointmentStarttime(),
-						appointment.getAppointmentEndtime(), timezone, subject,
+				sendInvitationIcalCancelMail(member.getUser().getAdresses().getEmail(),
+						member.getUser().getFirstname() + " " + member.getUser().getLastname(),
+						appointment, canceling_user_id, (appointment.getOwner().getUser_id() == member.getUser().getUser_id()),
+						appointment.getStart(),
+						appointment.end(), timezone, subject,
 						message);
 			} catch (Exception e) {
 				log.error("Error sending IcalCancelMail for User "
-						+ member.getUserid().getAdresses().getEmail() + " : " + e.getMessage());
+						+ member.getUser().getAdresses().getEmail() + " : " + e.getMessage());
 			}
 		}
 
@@ -373,14 +373,14 @@ public class InvitationManager {
 			Appointment appointment, User user, TimeZone timezone) {
 		try {
 			String message = fieldManager.getString(1157L, language_id)
-					+ appointment.getAppointmentName();
+					+ appointment.getTitle();
 
 			message += " "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentStarttime(), timezone)
+							appointment.getStart(), timezone)
 					+ " - "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentEndtime(), timezone);
+							appointment.end(), timezone);
 
 			return message;
 		} catch (Exception err) {
@@ -393,15 +393,15 @@ public class InvitationManager {
 			Appointment appointment, User user, TimeZone timezone) {
 		try {
 			String message = fieldManager.getString(1157L, language_id)
-					+ appointment.getAppointmentName();
+					+ appointment.getTitle();
 
-			if (appointment.getAppointmentDescription() != null &&
-					appointment.getAppointmentDescription().length() != 0) {
+			if (appointment.getDescription() != null &&
+					appointment.getDescription().length() != 0) {
 
 				Fieldlanguagesvalues labelid1152 = fieldManager
 						.getFieldByIdAndLanguage(new Long(1152), language_id);
 				message += labelid1152.getValue()
-						+ appointment.getAppointmentDescription();
+						+ appointment.getDescription();
 
 			}
 
@@ -414,13 +414,13 @@ public class InvitationManager {
 					+ labelid1153.getValue()
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentStarttime(), timezone)
+							appointment.getStart(), timezone)
 					+ "<br/>";
 
 			message += labelid1154.getValue()
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentEndtime(), timezone)
+							appointment.end(), timezone)
 					+ "<br/>";
 
 			String invitorName = user.getFirstname() + " " + user.getLastname()
@@ -457,14 +457,14 @@ public class InvitationManager {
 		}
 
 		if (appointment.getRemind() == null) {
-			log.error("Appointment " + appointment.getAppointmentName()
+			log.error("Appointment " + appointment.getTitle()
 					+ " has no ReminderType!");
 			return;
 		}
 
 		log.debug("Remindertype : " + appointment.getRemind().getTypId());
 
-		User us = member.getUserid();
+		User us = member.getUser();
 		TimeZone timezone = null;
 		// external users have no user object stored so we will need to get the
 		// timezone from the stored string
@@ -485,19 +485,19 @@ public class InvitationManager {
 		// nothing
 		if (sendMail) {
 		if (appointment.getRemind().getTypId() == 2) {
-			sendInvitationUpdateMail(member.getUserid().getAdresses().getEmail(), appointment, user
+			sendInvitationUpdateMail(member.getUser().getAdresses().getEmail(), appointment, user
 					.getAdresses().getEmail(), subject, message);
 		} else if (appointment.getRemind().getTypId() == 3) {
 			try {
-				sendInvitationIcalUpdateMail(member.getUserid().getAdresses().getEmail(),
-						member.getUserid().getFirstname() + " " + member.getUserid().getLastname(),
-						appointment, canceling_user_id, (appointment.getUserId().getUser_id() == member.getUserid().getUser_id()),
-						language_id, appointment.getAppointmentStarttime(),
-						appointment.getAppointmentEndtime(), timezone, subject,
+				sendInvitationIcalUpdateMail(member.getUser().getAdresses().getEmail(),
+						member.getUser().getFirstname() + " " + member.getUser().getLastname(),
+						appointment, canceling_user_id, (appointment.getOwner().getUser_id() == member.getUser().getUser_id()),
+						language_id, appointment.getStart(),
+						appointment.end(), timezone, subject,
 						message);
 			} catch (Exception e) {
 				log.error("Error sending IcalUpdateMail for User "
-						+ member.getUserid().getAdresses().getEmail() + " : " + e.getMessage());
+						+ member.getUser().getAdresses().getEmail() + " : " + e.getMessage());
 			}
 		}
 		}
@@ -509,23 +509,23 @@ public class InvitationManager {
 		try {
 
 			String message = fieldManager.getString(1155L, language_id) + " "
-					+ appointment.getAppointmentName();
+					+ appointment.getTitle();
 
-			if (appointment.getAppointmentDescription().length() != 0) {
+			if (appointment.getDescription().length() != 0) {
 
 				Fieldlanguagesvalues labelid1152 = fieldManager
 						.getFieldByIdAndLanguage(new Long(1152), language_id);
 				message += labelid1152.getValue()
-						+ appointment.getAppointmentDescription();
+						+ appointment.getDescription();
 
 			}
 
 			message += " "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentStarttime(), timezone)
+							appointment.getStart(), timezone)
 					+ " - "
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentEndtime(), timezone);
+							appointment.end(), timezone);
 
 			return message;
 
@@ -541,14 +541,14 @@ public class InvitationManager {
 		try {
 
 			String message = fieldManager.getString(1155L, language_id) + " "
-					+ appointment.getAppointmentName();
+					+ appointment.getTitle();
 
-			if (appointment.getAppointmentDescription().length() != 0) {
+			if (appointment.getDescription().length() != 0) {
 
 				Fieldlanguagesvalues labelid1152 = fieldManager
 						.getFieldByIdAndLanguage(new Long(1152), language_id);
 				message += labelid1152.getValue()
-						+ appointment.getAppointmentDescription();
+						+ appointment.getDescription();
 
 			}
 
@@ -561,13 +561,13 @@ public class InvitationManager {
 					+ labelid1153.getValue()
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentStarttime(), timezone)
+							appointment.getStart(), timezone)
 					+ "<br/>";
 
 			message += labelid1154.getValue()
 					+ ' '
 					+ CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(
-							appointment.getAppointmentEndtime(), timezone)
+							appointment.end(), timezone)
 					+ "<br/>";
 
 			Fieldlanguagesvalues labelid1156 = fieldManager
@@ -699,14 +699,14 @@ public class InvitationManager {
 
 		try {
 			Invitations invitation = new Invitations();
-			invitation.setIsPasswordProtected(appointment.getIsPasswordProtected());
-			if (appointment.getIsPasswordProtected()) {
+			invitation.setIsPasswordProtected(appointment.isPasswordProtected());
+			if (appointment.isPasswordProtected()) {
 				invitation.setInvitationpass(manageCryptStyle
 						.getInstanceOfCrypt().createPassPhrase(
 								appointment.getPassword()));
 			}
 
-			String username = meetingMember.getUserid().getFirstname() + " " + meetingMember.getUserid().getLastname();
+			String username = meetingMember.getUser().getFirstname() + " " + meetingMember.getUser().getLastname();
 			invitation.setInvitationWasUsed(false);
 
 			// valid period of Invitation
@@ -718,8 +718,8 @@ public class InvitationManager {
 				// period
 				invitation.setIsValidByTime(true);
 				invitation.setCanBeUsedOnlyOneTime(false);
-				invitation.setValidFrom(appointment.getAppointmentStarttime());
-				invitation.setValidTo(appointment.getAppointmentEndtime());
+				invitation.setValidFrom(appointment.getStart());
+				invitation.setValidTo(appointment.end());
 			} else {
 				// one-time
 				invitation.setIsValidByTime(false);
@@ -729,7 +729,7 @@ public class InvitationManager {
 
 			invitation.setDeleted(false);
 
-			if (meetingMember.getUserid().getType() == Type.contact) {
+			if (meetingMember.getUser().getType() == Type.contact) {
 				String hashRaw = "InvitationHash"
 						+ (System.currentTimeMillis());
 				log.debug("addInvitationIcalLink : rawHash = " + hashRaw);
@@ -741,21 +741,21 @@ public class InvitationManager {
 			invitation.setInvitedBy(createdBy);
 			invitation.setBaseUrl(baseurl);
 			invitation.setInvitedname(username);
-			invitation.setInvitedEMail(meetingMember.getUserid().getAdresses().getEmail());
+			invitation.setInvitedEMail(meetingMember.getUser().getAdresses().getEmail());
 			invitation.setRoom(appointment.getRoom());
 			invitation.setConferencedomain(conferencedomain);
 			invitation.setStarttime(new Date());
-			invitation.setAppointmentId(appointment.getAppointmentId());
+			invitation.setAppointmentId(appointment.getId());
 
 			invitation = invitationDao.updateInvitation(invitation);
 			long invitationId = invitation.getInvitations_id();
 
 			if (invitationId > 0) {
 				this.sendInvitionIcalLink(username, message, baseurl,
-						meetingMember.getUserid().getAdresses().getEmail(), subject, invitation.getHash(),
-						appointment.getAppointmentId(), createdBy, (appointment.getUserId().getUser_id() == meetingMember.getUserid().getUser_id())
-						, meetingMember.getUserid().getLanguage_id(),
-						appointment.getAppointmentStarttime(), appointment.getAppointmentEndtime(),
+						meetingMember.getUser().getAdresses().getEmail(), subject, invitation.getHash(),
+						appointment.getId(), createdBy, (appointment.getOwner().getUser_id() == meetingMember.getUser().getUser_id())
+						, meetingMember.getUser().getLanguage_id(),
+						appointment.getStart(), appointment.end(),
 						timezoneUtil.getTimezoneByUser(createdBy), createdBy.getFirstname() + " " + createdBy.getLastname());
 				return invitationId;
 			}
@@ -827,7 +827,7 @@ public class InvitationManager {
 		try {
 
 			String invitation_link = baseurl;
-			if (meetingMember.getUserid().getType() == Type.contact) {
+			if (meetingMember.getUser().getType() == Type.contact) {
 				invitation_link += "?invitationHash="
 					+ invitationsHash;
 
@@ -838,7 +838,7 @@ public class InvitationManager {
 
 			String template = InvitationTemplate.getEmail(invitor.getFirstname() + " " + invitor.getLastname(), message, invitation_link);
 
-			mailHandler.send(meetingMember.getUserid().getAdresses().getEmail(), invitor.getAdresses().getEmail(), subject, template);
+			mailHandler.send(meetingMember.getUser().getAdresses().getEmail(), invitor.getAdresses().getEmail(), subject, template);
 			return "success";
 		} catch (Exception err) {
 			log.error("sendInvitationLink", err);
@@ -969,7 +969,7 @@ public class InvitationManager {
 		IcalHandler handler = new IcalHandler(IcalHandler.ICAL_METHOD_CANCEL);
 
 		// refresh appointment
-		point = appointmentLogic.getAppointMentById(point.getAppointmentId());
+		point = appointmentLogic.getAppointMentById(point.getId());
 
 		// Transforming Meeting Members
 
@@ -983,7 +983,7 @@ public class InvitationManager {
 				.getAdresses().getEmail(), user.getLogin(), invitor);
 
 		handler.addNewMeeting(startdate, enddate, 
-				point.getAppointmentName(), atts,
+				point.getTitle(), atts,
 				subject, organizer, point.getIcalId(), timezone);
 
 		log.debug(handler.getICalDataAsString());
@@ -1015,7 +1015,7 @@ public class InvitationManager {
 		IcalHandler handler = new IcalHandler(IcalHandler.ICAL_METHOD_REQUEST);
 
 		// refresh appointment
-		point = appointmentLogic.getAppointMentById(point.getAppointmentId());
+		point = appointmentLogic.getAppointMentById(point.getId());
 
 		// Transforming Meeting Members
 
@@ -1028,7 +1028,7 @@ public class InvitationManager {
 		HashMap<String, String> organizer = handler.getAttendeeData(user
 				.getAdresses().getEmail(), user.getLogin(), invitor);
 
-		handler.addNewMeeting(starttime, endtime, point.getAppointmentName(), atts,
+		handler.addNewMeeting(starttime, endtime, point.getTitle(), atts,
 				subject, organizer, point.getIcalId(), timeZone);
 
 		log.debug(handler.getICalDataAsString());
@@ -1099,7 +1099,7 @@ public class InvitationManager {
 
 			// Create ICal Message
 			String meetingId = handler.addNewMeeting(starttime, endtime,
-					point.getAppointmentName(), atts, invitation_link,
+					point.getTitle(), atts, invitation_link,
 					organizerAttendee, point.getIcalId(), timezone);
 
 			// Writing back meetingUid

Modified: openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/Appointment.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/Appointment.java?rev=1520382&r1=1520381&r2=1520382&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/Appointment.java (original)
+++ openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/persistence/beans/calendar/Appointment.java Thu Sep  5 18:49:58 2013
@@ -48,45 +48,47 @@ import org.simpleframework.xml.Root;
 @Entity
 @Table(name = "appointments")
 @NamedQueries({
-    @NamedQuery(name="appointmentsInRange",
-        	query="SELECT a FROM Appointment a "
-    			+ "WHERE a.deleted <> :deleted "
+    @NamedQuery(name="getAppointmentById", query="SELECT a FROM Appointment a LEFT JOIN FETCH a.meetingMembers"
+    		+ " WHERE a.deleted = false AND a.id = :id")
+    , @NamedQuery(name="appointmentsInRange",
+        	query="SELECT a FROM Appointment a LEFT JOIN FETCH a.meetingMembers "
+    			+ "WHERE a.deleted = false "
     			+ "	AND ( "
-    			+ "		(a.appointmentStarttime BETWEEN :starttime AND :endtime) "
-    			+ "		OR (a.appointmentEndtime BETWEEN :starttime AND :endtime) "
-    			+ "		OR (a.appointmentStarttime < :starttime AND a.appointmentEndtime > :endtime) "
+    			+ "		(a.start BETWEEN :starttime AND :endtime) "
+    			+ "		OR (a.end BETWEEN :starttime AND :endtime) "
+    			+ "		OR (a.start < :starttime AND a.end > :endtime) "
     			+ "	)"
-    			+ "	AND a.userId.user_id = :userId"
+    			+ "	AND a.owner.user_id = :userId"
     	)
     , @NamedQuery(name="joinedAppointmentsInRange",
-    	query="SELECT a FROM MeetingMember mm, IN(mm.appointment) a "
-			+ "WHERE mm.deleted <> true AND mm.userid.user_id <> a.userId.user_id AND mm.userid.user_id = :userId "
-			+ "	AND a.appointmentId NOT IN (SELECT a.appointmentId FROM Appointment a WHERE a.userId.user_id = :userId)"
-			+ "	AND mm.isConnectedEvent <> true " //TODO review: isConnectedEvent is set for the MeetingMember if event is created from "Private Messages", it is weird
-			+ "	AND ( "
-			+ "		(a.appointmentStarttime BETWEEN :starttime AND :endtime) "
-			+ "		OR (a.appointmentEndtime BETWEEN :starttime AND :endtime) "
-			+ "		OR (a.appointmentStarttime < :starttime AND a.appointmentEndtime > :endtime) "
-			+ "	)"
-	)
+	query="SELECT a FROM MeetingMember mm INNER JOIN mm.appointment a LEFT JOIN FETCH a.meetingMembers "
+		+ "WHERE mm.deleted = false AND mm.user.user_id <> a.owner.user_id AND mm.user.user_id = :userId "
+		+ "	AND a.id NOT IN (SELECT a.id FROM Appointment a WHERE a.owner.user_id = :userId)"
+		+ "	AND mm.connectedEvent = false " //TODO review: isConnectedEvent is set for the MeetingMember if event is created from "Private Messages", it is weird
+		+ "	AND ( "
+		+ "		(a.start BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.end BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.start < :starttime AND a.end > :endtime) "
+		+ "	)"
+)
 	//TODO this query returns duplicates if the user books an appointment with
 	//his own user as second meeting-member, swagner 19.02.2012
     , @NamedQuery(name="appointmentsInRangeByUser",
 	query="SELECT a FROM MeetingMember mm, IN(mm.appointment) a "
-		+ "WHERE mm.deleted <> true AND mm.userid.user_id <> a.userId.user_id AND mm.userid.user_id = :userId "
+		+ "WHERE mm.deleted = false AND mm.user.user_id <> a.owner.user_id AND mm.user.user_id = :userId "
 		+ "	AND ( "
-		+ "		(a.appointmentStarttime BETWEEN :starttime AND :endtime) "
-		+ "		OR (a.appointmentEndtime BETWEEN :starttime AND :endtime) "
-		+ "		OR (a.appointmentStarttime < :starttime AND a.appointmentEndtime > :endtime) "
+		+ "		(a.start BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.end BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.start < :starttime AND a.end > :endtime) "
 		+ "	)"
     )
     , @NamedQuery(name="appointedRoomsInRangeByUser",
 	query="SELECT a.room FROM MeetingMember mm, IN(mm.appointment) a "
-		+ "WHERE mm.deleted <> true AND mm.userid.user_id <> a.userId.user_id AND mm.userid.user_id = :userId "
+		+ "WHERE mm.deleted <> true AND mm.user.user_id <> a.owner.user_id AND mm.user.user_id = :userId "
 		+ "	AND ( "
-		+ "		(a.appointmentStarttime BETWEEN :starttime AND :endtime) "
-		+ "		OR (a.appointmentEndtime BETWEEN :starttime AND :endtime) "
-		+ "		OR (a.appointmentStarttime < :starttime AND a.appointmentEndtime > :endtime) "
+		+ "		(a.start BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.end BETWEEN :starttime AND :endtime) "
+		+ "		OR (a.start < :starttime AND a.end > :endtime) "
 		+ "	)"
     )
 })
@@ -97,47 +99,48 @@ public class Appointment implements Seri
 	@GeneratedValue(strategy = GenerationType.IDENTITY)
 	@Column(name = "id")
 	@Element(data=true)
-	private Long appointmentId;
+	private Long id;
 	
 	@Column(name = "appointmentname")
 	@Element(data=true, required=false)
-	private String appointmentName;
+	private String title;
 	
 	@Column(name = "location")
 	@Element(data=true, required=false)
-	private String appointmentLocation;
+	private String location;
 	
 	@Column(name = "appointment_starttime")
 	@Element(data=true)
-	private Date appointmentStarttime;
+	private Date start;
 	
 	@Column(name = "appointment_endtime")
 	@Element(data=true)
-	private Date appointmentEndtime;
+	private Date end;
 	
 	@Lob 
 	@Column(name = "description", length=2048)
 	@Element(data=true, required=false)
-	private String appointmentDescription;
+	private String description;
 	
 	@ManyToOne(fetch = FetchType.EAGER)
 	@JoinColumn(name = "category_id", nullable = true)
 	@ForeignKey(enabled = true)
 	@Element(name="categoryId", data=true, required=false)
-	private AppointmentCategory appointmentCategory;
+	private AppointmentCategory category;
 	
 	@ManyToOne(fetch = FetchType.EAGER)
 	@JoinColumn(name = "user_id", nullable = true)
 	@ForeignKey(enabled = true)
 	@Element(name="users_id", data=true, required=false)
-	private User userId;
+	private User owner;
 
-	// FIXME need to be renamed => inserted
 	@Column(name = "starttime")
-	private Date starttime;
+	@Element(name="inserted", data=true, required=false)
+	private Date inserted;
 	
 	@Column(name = "updatetime")
-	private Date updatetime;
+	@Element(name="updated", data=true, required=false)
+	private Date updated;
 	
 	@Column(name = "deleted")
 	@Element(data=true)
@@ -177,7 +180,7 @@ public class Appointment implements Seri
 
 	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
 	@JoinColumn(name = "appointment_id")
-	private List<MeetingMember> meetingMember;
+	private List<MeetingMember> meetingMembers;
 	
 	@Column(name = "language_id")
 	@Element(data=true, required=false)
@@ -185,92 +188,92 @@ public class Appointment implements Seri
 	
 	@Column(name = "is_password_protected")
 	@Element(data=true, required=false)
-	private Boolean isPasswordProtected;
+	private boolean passwordProtected;
 	
 	@Column(name = "password")
 	@Element(data=true, required=false)
 	private String password;
 
 	@Column(name = "is_connected_event")
-	private boolean isConnectedEvent;
+	private boolean connectedEvent;
 
 	@Column(name = "is_reminder_email_send")
-	private Boolean isReminderEmailSend = false; //default to false
+	private boolean reminderEmailSend;
 
-	public Long getAppointmentId() {
-		return appointmentId;
+	public Long getId() {
+		return id;
 	}
 
-	public void setAppointmentId(Long appointmentId) {
-		this.appointmentId = appointmentId;
+	public void setId(Long id) {
+		this.id = id;
 	}
 
-	public User getUserId() {
-		return userId;
+	public User getOwner() {
+		return owner;
 	}
 
-	public void setUserId(User userId) {
-		this.userId = userId;
+	public void setOwner(User owner) {
+		this.owner = owner;
 	}
 
-	public String getAppointmentName() {
-		return appointmentName;
+	public String getTitle() {
+		return title;
 	}
 
-	public void setAppointmentName(String appointmentName) {
-		this.appointmentName = appointmentName;
+	public void setTitle(String title) {
+		this.title = title;
 	}
 
-	public String getAppointmentLocation() {
-		return appointmentLocation;
+	public String getLocation() {
+		return location;
 	}
 
-	public void setAppointmentLocation(String appointmentLocation) {
-		this.appointmentLocation = appointmentLocation;
+	public void setLocation(String location) {
+		this.location = location;
 	}
 
-	public Date getAppointmentStarttime() {
-		return appointmentStarttime;
+	public Date getStart() {
+		return start;
 	}
 
-	public Calendar appointmentStartAsCalendar(TimeZone timeZone) {
+	public Calendar startCalendar(TimeZone timeZone) {
 		Calendar cal = Calendar.getInstance(timeZone);
-		cal.setTime(appointmentStarttime);
+		cal.setTime(start);
 		return cal;
 	}
 
-	public void setAppointmentStarttime(Date appointmentStarttime) {
-		this.appointmentStarttime = appointmentStarttime;
+	public void setStart(Date start) {
+		this.start = start;
 	}
 
-	public Date getAppointmentEndtime() {
-		return appointmentEndtime;
+	public Date end() {
+		return end;
 	}
 
-	public Calendar appointmentEndAsCalendar(TimeZone timeZone) {
+	public Calendar endCalendar(TimeZone timeZone) {
 		Calendar cal = Calendar.getInstance(timeZone);
-		cal.setTime(appointmentEndtime);
+		cal.setTime(end);
 		return cal;
 	}
 
-	public void setAppointmentEndtime(Date appointmentEndtime) {
-		this.appointmentEndtime = appointmentEndtime;
+	public void setEnd(Date end) {
+		this.end = end;
 	}
 
-	public String getAppointmentDescription() {
-		return appointmentDescription;
+	public String getDescription() {
+		return description;
 	}
 
-	public void setAppointmentDescription(String appointmentDescription) {
-		this.appointmentDescription = appointmentDescription;
+	public void setDescription(String description) {
+		this.description = description;
 	}
 
-	public AppointmentCategory getAppointmentCategory() {
-		return appointmentCategory;
+	public AppointmentCategory getCategory() {
+		return category;
 	}
 
-	public void setAppointmentCategory(AppointmentCategory appointmentCategory) {
-		this.appointmentCategory = appointmentCategory;
+	public void setCategory(AppointmentCategory category) {
+		this.category = category;
 	}
 
 	public AppointmentReminderTyps getRemind() {
@@ -281,23 +284,23 @@ public class Appointment implements Seri
 		this.remind = remind;
 	}
 
-	public Date getStarttime() {
-		return starttime;
+	public Date getInserted() {
+		return inserted;
 	}
 
-	public void setStarttime(Date starttime) {
-		this.starttime = starttime;
+	public void setInserted(Date inserted) {
+		this.inserted = inserted;
 	}
 
-	public Date getUpdatetime() {
-		return updatetime;
+	public Date getUpdated() {
+		return updated;
 	}
 
-	public void setUpdatetime(Date updatetime) {
-		this.updatetime = updatetime;
+	public void setUpdated(Date updated) {
+		this.updated = updated;
 	}
 
-	public boolean getDeleted() {
+	public boolean isDeleted() {
 		return deleted;
 	}
 
@@ -337,12 +340,12 @@ public class Appointment implements Seri
 		this.isDaily = isDaily;
 	}
 
-	public List<MeetingMember> getMeetingMember() {
-		return meetingMember;
+	public List<MeetingMember> getMeetingMembers() {
+		return meetingMembers;
 	}
 
-	public void setMeetingMember(List<MeetingMember> meetingMember) {
-		this.meetingMember = meetingMember;
+	public void setMeetingMembers(List<MeetingMember> meetingMembers) {
+		this.meetingMembers = meetingMembers;
 	}
 
 	public Room getRoom() {
@@ -369,12 +372,12 @@ public class Appointment implements Seri
 		language_id = languageId;
 	}
 
-	public Boolean getIsPasswordProtected() {
-		return isPasswordProtected;
+	public boolean isPasswordProtected() {
+		return passwordProtected;
 	}
 
-	public void setIsPasswordProtected(Boolean isPasswordProtected) {
-		this.isPasswordProtected = isPasswordProtected;
+	public void setPasswordProtected(boolean isPasswordProtected) {
+		this.passwordProtected = isPasswordProtected;
 	}
 
 	public String getPassword() {
@@ -385,29 +388,26 @@ public class Appointment implements Seri
 		this.password = password;
 	}
 
-	public boolean getIsConnectedEvent() {
-		return isConnectedEvent;
+	public boolean isConnectedEvent() {
+		return connectedEvent;
 	}
 
-	public void setIsConnectedEvent(boolean isConnectedEvent) {
-		this.isConnectedEvent = isConnectedEvent;
+	public void setConnectedEvent(boolean isConnectedEvent) {
+		this.connectedEvent = isConnectedEvent;
 	}
 
-	public Boolean getIsReminderEmailSend() {
-		return isReminderEmailSend;
+	public boolean isReminderEmailSend() {
+		return reminderEmailSend;
 	}
 
-	public void setIsReminderEmailSend(Boolean isReminderEmailSend) {
-		this.isReminderEmailSend = isReminderEmailSend;
+	public void setReminderEmailSend(boolean isReminderEmailSend) {
+		this.reminderEmailSend = isReminderEmailSend;
 	}
-	
-	@Override 
+
+	@Override
 	public String toString() {
-		return "" + super.toString() 
-				+ " Appointment ID: " + getAppointmentId()
-				+ " Starttime: " + getAppointmentStarttime()
-				+ " Endtime: " + getAppointmentEndtime()
-				+ " Name: " + getAppointmentName();
+		return "Appointment [id=" + id + ", title=" + title + ", start=" + start + ", end=" + end + ", owner=" + owner
+				+ ", deleted=" + deleted + ", icalId=" + icalId + "]";
 	}
-
+	
 }