Author: solomax
Date: Thu Feb 5 18:04:21 2015
New Revision: 1657645
URL: http://svn.apache.org/r1657645
Log:
[OPENMEETINGS-1157] DTO are being returned instead of DB objects
Added:
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
Modified:
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebService.java
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebServiceFacade.java
openmeetings/trunk/singlewebapp/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
Modified:
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebService.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebService.java?rev=1657645&r1=1657644&r2=1657645&view=diff
==============================================================================
---
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebService.java
(original)
+++
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebService.java
Thu Feb 5 18:04:21 2015
@@ -36,6 +36,8 @@ import org.apache.openmeetings.db.dao.ro
import org.apache.openmeetings.db.dao.room.RoomTypeDao;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.AppointmentReminderTypeDTO;
import org.apache.openmeetings.db.entity.calendar.Appointment;
import org.apache.openmeetings.db.entity.calendar.AppointmentCategory;
import org.apache.openmeetings.db.entity.calendar.AppointmentReminderTyps;
@@ -79,6 +81,14 @@ public class CalendarWebService {
@Autowired
private RoomTypeDao roomTypeDao;
+ private List<AppointmentDTO> getAppointments(List<Appointment> list) {
+ List<AppointmentDTO> result = new ArrayList<>(list.size());
+ for (Appointment a : list) {
+ result.add(new AppointmentDTO(a));
+ }
+ return result;
+ }
+
/**
* Load appointments by a start / end range for the current SID
*
@@ -91,15 +101,12 @@ public class CalendarWebService {
*
* @return - list of appointments in range
*/
- public List<Appointment> getAppointmentByRange(String SID, Date
starttime,
- Date endtime) {
- log.debug("getAppointmentByRange : startdate - " + starttime
- + ", enddate - " + endtime);
+ public List<AppointmentDTO> getAppointmentByRange(String SID, Calendar
starttime, Calendar endtime) {
+ log.debug("getAppointmentByRange : startdate - " +
starttime.getTime() + ", enddate - " + endtime.getTime());
try {
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return
appointmentDao.getAppointmentsByRange(users_id, starttime, endtime);
+ return
getAppointments(appointmentDao.getAppointmentsByRange(users_id,
starttime.getTime(), endtime.getTime()));
}
} catch (Exception err) {
log.error("[getAppointmentByRange]", err);
@@ -121,15 +128,12 @@ public class CalendarWebService {
*
* @return - list of appointments in range
*/
- public List<Appointment> getAppointmentByRangeForUserId(String SID,
- long userId, Date starttime, Date endtime) {
- log.debug("getAppointmentByRange : startdate - " + starttime
- + ", enddate - " + endtime);
+ public List<AppointmentDTO> getAppointmentByRangeForUserId(String SID,
long userId, Calendar starttime, Calendar endtime) {
+ log.debug("getAppointmentByRangeForUserId : startdate - " +
starttime.getTime() + ", enddate - " + endtime.getTime());
try {
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
- return
appointmentDao.getAppointmentsByRange(userId, starttime, endtime);
+ return
getAppointments(appointmentDao.getAppointmentsByRange(userId,
starttime.getTime(), endtime.getTime()));
}
} catch (Exception err) {
log.error("[getAppointmentByRangeForUserId]", err);
@@ -144,14 +148,11 @@ public class CalendarWebService {
* The SID of the User. This SID must be marked as Loggedin
* @return - next Calendar event
*/
- public Appointment getNextAppointment(String SID) {
-
+ public AppointmentDTO getNextAppointment(String SID) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return appointmentLogic.getNextAppointment();
+ return new
AppointmentDTO(appointmentLogic.getNextAppointment());
}
} catch (Exception err) {
log.error("[getNextAppointmentById]", err);
@@ -168,14 +169,11 @@ public class CalendarWebService {
*
* @return - next Calendar event
*/
- public Appointment getNextAppointmentForUserId(String SID, long userId)
{
-
+ public AppointmentDTO getNextAppointmentForUserId(String SID, long
userId) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return appointmentLogic.getNextAppointment();
+ return new
AppointmentDTO(appointmentLogic.getNextAppointment());
}
} catch (Exception err) {
log.error("[getNextAppointmentById]", err);
@@ -194,16 +192,11 @@ public class CalendarWebService {
*
* @return - calendar event list
*/
- public List<Appointment> searchAppointmentByName(String SID,
- String appointmentName) {
-
+ public List<AppointmentDTO> searchAppointmentByName(String SID, String
appointmentName) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return appointmentLogic
-
.searchAppointmentByName(appointmentName);
+ return
getAppointments(appointmentLogic.searchAppointmentByName(appointmentName));
}
} catch (Exception err) {
log.error("[searchAppointmentByName]", err);
@@ -307,14 +300,11 @@ public class CalendarWebService {
*
* @return - id of appointment updated
*/
- public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
- Date appointmentstart, Date appointmentend, Long
languageId) {
+ public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
Date appointmentstart, Date appointmentend, Long languageId) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
Set<Right> rights = userDao.getRights(users_id);
if (AuthLevelUtil.hasUserLevel(rights)) {
-
Appointment a =
appointmentDao.get(appointmentId);
if (!AuthLevelUtil.hasAdminLevel(rights) &&
!a.getOwner().getUser_id().equals(users_id)) {
throw new AxisFault("The Appointment
cannot be updated by the given user");
@@ -328,7 +318,6 @@ public class CalendarWebService {
}
} catch (Exception err) {
log.error("[updateAppointment]", err);
- err.printStackTrace();
}
return null;
@@ -491,25 +480,15 @@ public class CalendarWebService {
* @param room_id
* @return - calendar event by its room id
*/
- public Appointment getAppointmentByRoomId(String SID, Long room_id) {
+ public AppointmentDTO getAppointmentByRoomId(String SID, Long room_id) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- Appointment appointment = new Appointment();
-
- Appointment appStored =
appointmentDao.getAppointmentByRoomId(
- users_id, room_id);
-
- appointment.setStart(appStored
- .getStart());
- appointment.setEnd(appStored
- .getEnd());
-
- return appointment;
+ Appointment appStored =
appointmentDao.getAppointmentByRoomId(users_id, room_id);
+ if (appStored != null) {
+ return new AppointmentDTO(appStored);
+ }
}
-
} catch (Exception err) {
log.error("[getAppointmentByRoomId]", err);
}
@@ -523,21 +502,17 @@ public class CalendarWebService {
* @return - all categories of calendar events
*/
public List<AppointmentCategory> getAppointmentCategoryList(String SID)
{
-
log.debug("AppointmenetCategoryService.getAppointmentCategoryList SID : "
- + SID);
+
log.debug("AppointmenetCategoryService.getAppointmentCategoryList SID : " +
SID);
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
+ List<AppointmentCategory> res =
appointmentCategoryDao.getAppointmentCategoryList();
- List<AppointmentCategory> res =
appointmentCategoryDao
- .getAppointmentCategoryList();
-
- if (res == null || res.size() < 1)
+ if (res == null || res.size() < 1) {
log.debug("no AppointmentCategories
found");
- else {
+ } else {
for (int i = 0; i < res.size(); i++) {
AppointmentCategory ac =
res.get(i);
log.debug("found appCategory :
" + ac.getName());
@@ -555,14 +530,20 @@ public class CalendarWebService {
}
+ private List<AppointmentReminderTypeDTO>
getReminders(List<AppointmentReminderTyps> list) {
+ List<AppointmentReminderTypeDTO> result = new
ArrayList<>(list.size());
+ for (AppointmentReminderTyps rt : list) {
+ result.add(new AppointmentReminderTypeDTO(rt));
+ }
+ return result;
+ }
/**
* Get all reminder types for calendar events
*
* @param SID
* @return - all reminder types for calendar events
*/
- public List<AppointmentReminderTyps> getAppointmentReminderTypList(
- String SID) {
+ public List<AppointmentReminderTypeDTO>
getAppointmentReminderTypList(String SID) {
log.debug("getAppointmentReminderTypList");
try {
@@ -571,18 +552,7 @@ public class CalendarWebService {
User user = userDao.get(users_id);
long language_id = (user == null) ? 1 :
user.getLanguage_id();
- List<AppointmentReminderTyps> res =
appointmentReminderTypDao
-
.getAppointmentReminderTypList(language_id);
-
- if (res == null || res.size() < 1) {
- log.debug("no remindertyps found!");
- } else {
- for (int i = 0; i < res.size(); i++) {
- log.debug("found reminder " +
res.get(i).getName());
- }
- }
-
- return res;
+ return
getReminders(appointmentReminderTypDao.getAppointmentReminderTypList(language_id));
} else
log.debug("getAppointmentReminderTypList
:error - wrong authlevel!");
} catch (Exception err) {
Modified:
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebServiceFacade.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebServiceFacade.java?rev=1657645&r1=1657644&r2=1657645&view=diff
==============================================================================
---
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebServiceFacade.java
(original)
+++
openmeetings/branches/3.0.x/src/axis/java/org/apache/openmeetings/axis/services/CalendarWebServiceFacade.java
Thu Feb 5 18:04:21 2015
@@ -23,38 +23,30 @@ import java.util.Date;
import java.util.List;
import org.apache.axis2.AxisFault;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.AppointmentReminderTypeDTO;
import org.apache.openmeetings.db.entity.calendar.AppointmentCategory;
-import org.apache.openmeetings.db.entity.calendar.AppointmentReminderTyps;
public class CalendarWebServiceFacade extends BaseWebService {
- public List<Appointment> getAppointmentByRange(String SID, Date
starttime,
- Date endtime) throws AxisFault {
- return
getBean(CalendarWebService.class).getAppointmentByRange(SID, starttime,
- endtime);
+ public List<AppointmentDTO> getAppointmentByRange(String SID, Calendar
starttime, Calendar endtime) throws AxisFault {
+ return
getBean(CalendarWebService.class).getAppointmentByRange(SID, starttime,
endtime);
}
- public List<Appointment> getAppointmentByRangeForUserId(String SID,
- long userId, Date starttime, Date endtime) throws
AxisFault {
- return
getBean(CalendarWebService.class).getAppointmentByRangeForUserId(SID,
- userId, starttime, endtime);
+ public List<AppointmentDTO> getAppointmentByRangeForUserId(String SID,
long userId, Calendar starttime, Calendar endtime) throws AxisFault {
+ return
getBean(CalendarWebService.class).getAppointmentByRangeForUserId(SID, userId,
starttime, endtime);
}
- public Appointment getNextAppointment(String SID) throws AxisFault {
+ public AppointmentDTO getNextAppointment(String SID) throws AxisFault {
return
getBean(CalendarWebService.class).getNextAppointment(SID);
}
- public Appointment getNextAppointmentForUserId(String SID, long userId)
- throws AxisFault {
- return
getBean(CalendarWebService.class).getNextAppointmentForUserId(SID,
- userId);
+ public AppointmentDTO getNextAppointmentForUserId(String SID, long
userId) throws AxisFault {
+ return
getBean(CalendarWebService.class).getNextAppointmentForUserId(SID, userId);
}
- public List<Appointment> searchAppointmentByName(String SID,
- String appointmentName) throws AxisFault {
- return
getBean(CalendarWebService.class).searchAppointmentByName(SID,
- appointmentName);
+ public List<AppointmentDTO> searchAppointmentByName(String SID, String
appointmentName) throws AxisFault {
+ return
getBean(CalendarWebService.class).searchAppointmentByName(SID, appointmentName);
}
public Long saveAppointment(String SID, String appointmentName,
@@ -71,10 +63,8 @@ public class CalendarWebServiceFacade ex
isPasswordProtected, password, roomId);
}
- public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
- Date appointmentstart, Date appointmentend, Long
languageId) throws AxisFault {
- return
getBean(CalendarWebService.class).updateAppointmentTimeOnly(SID,
- appointmentId, appointmentstart,
appointmentend, languageId);
+ public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
Date appointmentstart, Date appointmentend, Long languageId) throws AxisFault {
+ return
getBean(CalendarWebService.class).updateAppointmentTimeOnly(SID, appointmentId,
appointmentstart, appointmentend, languageId);
}
public Long updateAppointment(String SID, Long appointmentId,
@@ -90,24 +80,19 @@ public class CalendarWebServiceFacade ex
isYearly, categoryId, remind, mmClient,
roomType, languageId, isPasswordProtected, password);
}
- public Long deleteAppointment(String SID, Long appointmentId,
- Long language_id) throws AxisFault {
- return getBean(CalendarWebService.class).deleteAppointment(SID,
appointmentId,
- language_id);
+ public Long deleteAppointment(String SID, Long appointmentId, Long
language_id) throws AxisFault {
+ return getBean(CalendarWebService.class).deleteAppointment(SID,
appointmentId, language_id);
}
- public Appointment getAppointmentByRoomId(String SID, Long room_id)
- throws AxisFault {
+ public AppointmentDTO getAppointmentByRoomId(String SID, Long room_id)
throws AxisFault {
return
getBean(CalendarWebService.class).getAppointmentByRoomId(SID, room_id);
}
- public List<AppointmentCategory> getAppointmentCategoryList(String SID)
- throws AxisFault {
+ public List<AppointmentCategory> getAppointmentCategoryList(String SID)
throws AxisFault {
return
getBean(CalendarWebService.class).getAppointmentCategoryList(SID);
}
- public List<AppointmentReminderTyps> getAppointmentReminderTypList(
- String SID) throws AxisFault {
+ public List<AppointmentReminderTypeDTO>
getAppointmentReminderTypList(String SID) throws AxisFault {
return
getBean(CalendarWebService.class).getAppointmentReminderTypList(SID);
}
}
Added:
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
(added)
+++
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+
+public class AppointmentDTO {
+ private Long id;
+ private String title;
+ private String location;
+ private Date start;
+ private Date end;
+ private String description;
+ private UserDTO owner;
+ private Date inserted;
+ private Date updated;
+ private boolean deleted;
+ private AppointmentReminderTypeDTO reminder;
+ private RoomDTO room;
+ private String icalId;
+ private List<MeetingMemberDTO> meetingMembers;
+ private Long languageId;
+ private boolean passwordProtected;
+ private boolean connectedEvent;
+ private boolean reminderEmailSend;
+
+ public AppointmentDTO(Appointment a) {
+ id = a.getId();
+ title = a.getTitle();
+ location = a.getLocation();
+ start = a.getStart();
+ end = a.getEnd();
+ description = a.getDescription();
+ owner = new UserDTO(a.getOwner());
+ inserted = a.getInserted();
+ updated = a.getUpdated();
+ deleted = a.isDeleted();
+ reminder = new AppointmentReminderTypeDTO(a.getRemind());
+ room = new RoomDTO(a.getRoom());
+ icalId = a.getIcalId();
+ meetingMembers = new ArrayList<>();
+ for(MeetingMember mm: a.getMeetingMembers()) {
+ meetingMembers.add(new MeetingMemberDTO(mm));
+ }
+ languageId = a.getLanguageId();
+ passwordProtected = a.isPasswordProtected();
+ connectedEvent = a.isConnectedEvent();
+ reminderEmailSend = a.isReminderEmailSend();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public Date getStart() {
+ return start;
+ }
+
+ public void setStart(Date start) {
+ this.start = start;
+ }
+
+ public Date getEnd() {
+ return end;
+ }
+
+ public void setEnd(Date end) {
+ this.end = end;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public UserDTO getOwner() {
+ return owner;
+ }
+
+ public void setOwner(UserDTO owner) {
+ this.owner = owner;
+ }
+
+ public Date getInserted() {
+ return inserted;
+ }
+
+ public void setInserted(Date inserted) {
+ this.inserted = inserted;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+ public AppointmentReminderTypeDTO getReminder() {
+ return reminder;
+ }
+
+ public void setReminder(AppointmentReminderTypeDTO reminder) {
+ this.reminder = reminder;
+ }
+
+ public RoomDTO getRoom() {
+ return room;
+ }
+
+ public void setRoom(RoomDTO room) {
+ this.room = room;
+ }
+
+ public String getIcalId() {
+ return icalId;
+ }
+
+ public void setIcalId(String icalId) {
+ this.icalId = icalId;
+ }
+
+ public List<MeetingMemberDTO> getMeetingMembers() {
+ return meetingMembers;
+ }
+
+ public void setMeetingMembers(List<MeetingMemberDTO> meetingMembers) {
+ this.meetingMembers = meetingMembers;
+ }
+
+ public Long getLanguageId() {
+ return languageId;
+ }
+
+ public void setLanguageId(Long languageId) {
+ this.languageId = languageId;
+ }
+
+ public boolean isPasswordProtected() {
+ return passwordProtected;
+ }
+
+ public void setPasswordProtected(boolean passwordProtected) {
+ this.passwordProtected = passwordProtected;
+ }
+
+ public boolean isConnectedEvent() {
+ return connectedEvent;
+ }
+
+ public void setConnectedEvent(boolean connectedEvent) {
+ this.connectedEvent = connectedEvent;
+ }
+
+ public boolean isReminderEmailSend() {
+ return reminderEmailSend;
+ }
+
+ public void setReminderEmailSend(boolean reminderEmailSend) {
+ this.reminderEmailSend = reminderEmailSend;
+ }
+}
Added:
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
(added)
+++
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import org.apache.openmeetings.db.entity.calendar.AppointmentReminderTyps;
+
+public class AppointmentReminderTypeDTO {
+ private Long id;
+ private String name;
+
+ public AppointmentReminderTypeDTO(AppointmentReminderTyps t) {
+ this.id = t.getTypId();
+ this.name = t.getName();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
(added)
+++
openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+
+public class MeetingMemberDTO {
+ private Long id;
+ private UserDTO user;
+
+ public MeetingMemberDTO(MeetingMember mm) {
+ this.id = mm.getId();
+ this.user = new UserDTO(mm.getUser());
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public UserDTO getUser() {
+ return user;
+ }
+
+ public void setUser(UserDTO user) {
+ this.user = user;
+ }
+}
Added:
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+
+public class AppointmentDTO {
+ private Long id;
+ private String title;
+ private String location;
+ private Date start;
+ private Date end;
+ private String description;
+ private UserDTO owner;
+ private Date inserted;
+ private Date updated;
+ private boolean deleted;
+ private AppointmentReminderTypeDTO reminder;
+ private RoomDTO room;
+ private String icalId;
+ private List<MeetingMemberDTO> meetingMembers;
+ private Long languageId;
+ private boolean passwordProtected;
+ private boolean connectedEvent;
+ private boolean reminderEmailSend;
+
+ public AppointmentDTO(Appointment a) {
+ id = a.getId();
+ title = a.getTitle();
+ location = a.getLocation();
+ start = a.getStart();
+ end = a.getEnd();
+ description = a.getDescription();
+ owner = new UserDTO(a.getOwner());
+ inserted = a.getInserted();
+ updated = a.getUpdated();
+ deleted = a.isDeleted();
+ reminder = new AppointmentReminderTypeDTO(a.getRemind());
+ room = new RoomDTO(a.getRoom());
+ icalId = a.getIcalId();
+ meetingMembers = new ArrayList<>();
+ for(MeetingMember mm: a.getMeetingMembers()) {
+ meetingMembers.add(new MeetingMemberDTO(mm));
+ }
+ languageId = a.getLanguageId();
+ passwordProtected = a.isPasswordProtected();
+ connectedEvent = a.isConnectedEvent();
+ reminderEmailSend = a.isReminderEmailSend();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public Date getStart() {
+ return start;
+ }
+
+ public void setStart(Date start) {
+ this.start = start;
+ }
+
+ public Date getEnd() {
+ return end;
+ }
+
+ public void setEnd(Date end) {
+ this.end = end;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public UserDTO getOwner() {
+ return owner;
+ }
+
+ public void setOwner(UserDTO owner) {
+ this.owner = owner;
+ }
+
+ public Date getInserted() {
+ return inserted;
+ }
+
+ public void setInserted(Date inserted) {
+ this.inserted = inserted;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+ public AppointmentReminderTypeDTO getReminder() {
+ return reminder;
+ }
+
+ public void setReminder(AppointmentReminderTypeDTO reminder) {
+ this.reminder = reminder;
+ }
+
+ public RoomDTO getRoom() {
+ return room;
+ }
+
+ public void setRoom(RoomDTO room) {
+ this.room = room;
+ }
+
+ public String getIcalId() {
+ return icalId;
+ }
+
+ public void setIcalId(String icalId) {
+ this.icalId = icalId;
+ }
+
+ public List<MeetingMemberDTO> getMeetingMembers() {
+ return meetingMembers;
+ }
+
+ public void setMeetingMembers(List<MeetingMemberDTO> meetingMembers) {
+ this.meetingMembers = meetingMembers;
+ }
+
+ public Long getLanguageId() {
+ return languageId;
+ }
+
+ public void setLanguageId(Long languageId) {
+ this.languageId = languageId;
+ }
+
+ public boolean isPasswordProtected() {
+ return passwordProtected;
+ }
+
+ public void setPasswordProtected(boolean passwordProtected) {
+ this.passwordProtected = passwordProtected;
+ }
+
+ public boolean isConnectedEvent() {
+ return connectedEvent;
+ }
+
+ public void setConnectedEvent(boolean connectedEvent) {
+ this.connectedEvent = connectedEvent;
+ }
+
+ public boolean isReminderEmailSend() {
+ return reminderEmailSend;
+ }
+
+ public void setReminderEmailSend(boolean reminderEmailSend) {
+ this.reminderEmailSend = reminderEmailSend;
+ }
+}
Added:
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentReminderTypeDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import org.apache.openmeetings.db.entity.calendar.AppointmentReminderType;
+
+public class AppointmentReminderTypeDTO {
+ private Long id;
+ private String name;
+
+ public AppointmentReminderTypeDTO(AppointmentReminderType t) {
+ this.id = t.getId();
+ this.name = t.getName();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java?rev=1657645&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/MeetingMemberDTO.java
Thu Feb 5 18:04:21 2015
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.dto.calendar;
+
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+
+public class MeetingMemberDTO {
+ private Long id;
+ private UserDTO user;
+
+ public MeetingMemberDTO(MeetingMember mm) {
+ this.id = mm.getId();
+ this.user = new UserDTO(mm.getUser());
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public UserDTO getUser() {
+ return user;
+ }
+
+ public void setUser(UserDTO user) {
+ this.user = user;
+ }
+}
Modified:
openmeetings/trunk/singlewebapp/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java?rev=1657645&r1=1657644&r2=1657645&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
Thu Feb 5 18:04:21 2015
@@ -40,6 +40,8 @@ import org.apache.openmeetings.db.dao.ro
import org.apache.openmeetings.db.dao.room.RoomTypeDao;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.AppointmentReminderTypeDTO;
import org.apache.openmeetings.db.entity.calendar.Appointment;
import org.apache.openmeetings.db.entity.calendar.AppointmentCategory;
import org.apache.openmeetings.db.entity.calendar.AppointmentReminderType;
@@ -89,6 +91,14 @@ public class CalendarWebService {
@Autowired
private RoomTypeDao roomTypeDao;
+ private List<AppointmentDTO> getAppointments(List<Appointment> list) {
+ List<AppointmentDTO> result = new ArrayList<>(list.size());
+ for (Appointment a : list) {
+ result.add(new AppointmentDTO(a));
+ }
+ return result;
+ }
+
/**
* Load appointments by a start / end range for the current SID
*
@@ -101,15 +111,12 @@ public class CalendarWebService {
*
* @return - list of appointments in range
*/
- public List<Appointment> getAppointmentByRange(String SID, Date
starttime,
- Date endtime) {
- log.debug("getAppointmentByRange : startdate - " + starttime
- + ", enddate - " + endtime);
+ public List<AppointmentDTO> getAppointmentByRange(String SID, Calendar
starttime, Calendar endtime) {
+ log.debug("getAppointmentByRange : startdate - " +
starttime.getTime() + ", enddate - " + endtime.getTime());
try {
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return
appointmentDao.getAppointmentsByRange(users_id, starttime, endtime);
+ return
getAppointments(appointmentDao.getAppointmentsByRange(users_id,
starttime.getTime(), endtime.getTime()));
}
} catch (Exception err) {
log.error("[getAppointmentByRange]", err);
@@ -131,15 +138,12 @@ public class CalendarWebService {
*
* @return - list of appointments in range
*/
- public List<Appointment> getAppointmentByRangeForUserId(String SID,
- long userId, Date starttime, Date endtime) {
- log.debug("getAppointmentByRange : startdate - " + starttime
- + ", enddate - " + endtime);
+ public List<AppointmentDTO> getAppointmentByRangeForUserId(String SID,
long userId, Calendar starttime, Calendar endtime) {
+ log.debug("getAppointmentByRangeForUserId : startdate - " +
starttime.getTime() + ", enddate - " + endtime.getTime());
try {
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
- return
appointmentDao.getAppointmentsByRange(userId, starttime, endtime);
+ return
getAppointments(appointmentDao.getAppointmentsByRange(userId,
starttime.getTime(), endtime.getTime()));
}
} catch (Exception err) {
log.error("[getAppointmentByRangeForUserId]", err);
@@ -154,14 +158,11 @@ public class CalendarWebService {
* The SID of the User. This SID must be marked as Loggedin
* @return - next Calendar event
*/
- public Appointment getNextAppointment(String SID) {
-
+ public AppointmentDTO getNextAppointment(String SID) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return appointmentLogic.getNextAppointment();
+ return new
AppointmentDTO(appointmentLogic.getNextAppointment());
}
} catch (Exception err) {
log.error("[getNextAppointmentById]", err);
@@ -178,14 +179,11 @@ public class CalendarWebService {
*
* @return - next Calendar event
*/
- public Appointment getNextAppointmentForUserId(String SID, long userId)
{
-
+ public AppointmentDTO getNextAppointmentForUserId(String SID, long
userId) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return appointmentLogic.getNextAppointment();
+ return new
AppointmentDTO(appointmentLogic.getNextAppointment());
}
} catch (Exception err) {
log.error("[getNextAppointmentById]", err);
@@ -204,15 +202,11 @@ public class CalendarWebService {
*
* @return - calendar event list
*/
- public List<Appointment> searchAppointmentByName(String SID,
- String appointmentName) {
-
+ public List<AppointmentDTO> searchAppointmentByName(String SID, String
appointmentName) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
-
- return
appointmentLogic.searchAppointmentByName(appointmentName);
+ return
getAppointments(appointmentLogic.searchAppointmentByName(appointmentName));
}
} catch (Exception err) {
log.error("[searchAppointmentByName]", err);
@@ -316,14 +310,11 @@ public class CalendarWebService {
*
* @return - id of appointment updated
*/
- public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
- Date appointmentstart, Date appointmentend, Long
languageId) {
+ public Long updateAppointmentTimeOnly(String SID, Long appointmentId,
Date appointmentstart, Date appointmentend, Long languageId) {
try {
-
Long users_id = sessiondataDao.checkSession(SID);
Set<Right> rights = userDao.getRights(users_id);
if (AuthLevelUtil.hasUserLevel(rights)) {
-
Appointment a =
appointmentDao.get(appointmentId);
if (!AuthLevelUtil.hasAdminLevel(rights) &&
!a.getOwner().getId().equals(users_id)) {
throw new ServiceException("The
Appointment cannot be updated by the given user");
@@ -499,17 +490,13 @@ public class CalendarWebService {
* @param room_id
* @return - calendar event by its room id
*/
- public Appointment getAppointmentByRoomId(String SID, Long room_id) {
+ public AppointmentDTO getAppointmentByRoomId(String SID, Long room_id) {
try {
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
Appointment appStored =
appointmentDao.getAppointmentByOwnerRoom(users_id, room_id);
if (appStored != null) {
- Appointment appointment = new
Appointment();
-
appointment.setStart(appStored.getStart());
- appointment.setEnd(appStored.getEnd());
-
- return appointment;
+ return new AppointmentDTO(appStored);
}
}
} catch (Exception err) {
@@ -525,21 +512,17 @@ public class CalendarWebService {
* @return - all categories of calendar events
*/
public List<AppointmentCategory> getAppointmentCategoryList(String SID)
{
-
log.debug("AppointmenetCategoryService.getAppointmentCategoryList SID : "
- + SID);
+
log.debug("AppointmenetCategoryService.getAppointmentCategoryList SID : " +
SID);
try {
-
Long users_id = sessiondataDao.checkSession(SID);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
+ List<AppointmentCategory> res =
appointmentCategoryDao.getAppointmentCategoryList();
- List<AppointmentCategory> res =
appointmentCategoryDao
- .getAppointmentCategoryList();
-
- if (res == null || res.size() < 1)
+ if (res == null || res.size() < 1) {
log.debug("no AppointmentCategories
found");
- else {
+ } else {
for (int i = 0; i < res.size(); i++) {
AppointmentCategory ac =
res.get(i);
log.debug("found appCategory :
" + ac.getName());
@@ -557,14 +540,20 @@ public class CalendarWebService {
}
+ private List<AppointmentReminderTypeDTO>
getReminders(List<AppointmentReminderType> list) {
+ List<AppointmentReminderTypeDTO> result = new
ArrayList<>(list.size());
+ for (AppointmentReminderType rt : list) {
+ result.add(new AppointmentReminderTypeDTO(rt));
+ }
+ return result;
+ }
/**
* Get all reminder types for calendar events
*
* @param SID
* @return - all reminder types for calendar events
*/
- public List<AppointmentReminderType> getAppointmentReminderTypList(
- String SID) {
+ public List<AppointmentReminderTypeDTO>
getAppointmentReminderTypList(String SID) {
log.debug("getAppointmentReminderTypList");
try {
@@ -573,18 +562,7 @@ public class CalendarWebService {
User user = userDao.get(users_id);
long language_id = (user == null) ? 1 :
user.getLanguageId();
- List<AppointmentReminderType> res =
appointmentReminderTypDao
- .getList(language_id);
-
- if (res == null || res.size() < 1) {
- log.debug("no remindertyps found!");
- } else {
- for (int i = 0; i < res.size(); i++) {
- log.debug("found reminder " +
res.get(i).getName());
- }
- }
-
- return res;
+ return
getReminders(appointmentReminderTypDao.getList(language_id));
} else
log.debug("getAppointmentReminderTypList
:error - wrong authlevel!");
} catch (Exception err) {