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 2015/11/06 07:18:49 UTC
svn commit: r1712911 [3/16] - in /openmeetings/branches/3.1.x:
openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/
openmeetings-core/src/main/java/org/apache/openmeetings/core/data/conference/
openmeetings-core/src/main/java/org/apa...
Copied: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java (from r1712825, openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/FLVRecorderService.java)
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java?p2=openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java&p1=openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/FLVRecorderService.java&r1=1712825&r2=1712911&rev=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/FLVRecorderService.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/RecordingService.java Fri Nov 6 06:18:44 2015
@@ -25,20 +25,21 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.openmeetings.core.converter.BaseConverter;
-import org.apache.openmeetings.core.data.flvrecord.converter.FlvInterviewConverterTask;
-import org.apache.openmeetings.core.data.flvrecord.converter.FlvRecorderConverterTask;
-import org.apache.openmeetings.core.data.flvrecord.listener.StreamListener;
-import org.apache.openmeetings.db.dao.record.FlvRecordingDao;
-import org.apache.openmeetings.db.dao.record.FlvRecordingMetaDataDao;
-import org.apache.openmeetings.db.dao.record.FlvRecordingMetaDeltaDao;
+import org.apache.openmeetings.core.data.record.converter.InterviewConverterTask;
+import org.apache.openmeetings.core.data.record.converter.RecordingConverterTask;
+import org.apache.openmeetings.core.data.record.listener.StreamListener;
+import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
+import org.apache.openmeetings.db.dao.record.RecordingDao;
+import org.apache.openmeetings.db.dao.record.RecordingMetaDataDao;
+import org.apache.openmeetings.db.dao.record.RecordingMetaDeltaDao;
import org.apache.openmeetings.db.dao.server.ISessionManager;
import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.record.FlvRecording;
-import org.apache.openmeetings.db.entity.record.FlvRecordingMetaData;
-import org.apache.openmeetings.db.entity.record.FlvRecordingMetaData.Status;
+import org.apache.openmeetings.db.entity.file.FileItem.Type;
+import org.apache.openmeetings.db.entity.record.Recording;
+import org.apache.openmeetings.db.entity.record.RecordingMetaData;
+import org.apache.openmeetings.db.entity.record.RecordingMetaData.Status;
import org.apache.openmeetings.db.entity.room.Client;
import org.apache.openmeetings.db.entity.user.User;
-import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.util.CalendarPatterns;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.IConnection;
@@ -52,8 +53,8 @@ import org.red5.server.stream.ClientBroa
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
-public class FLVRecorderService implements IPendingServiceCallback {
- private static final Logger log = Red5LoggerFactory.getLogger(FLVRecorderService.class, webAppRootKey);
+public class RecordingService implements IPendingServiceCallback {
+ private static final Logger log = Red5LoggerFactory.getLogger(RecordingService.class, webAppRootKey);
/**
* Stores a reference to all available listeners we need that reference, as the internal references stored with the
@@ -66,28 +67,26 @@ public class FLVRecorderService implemen
@Autowired
private ISessionManager sessionManager;
@Autowired
- private FlvRecordingDao flvRecordingDaoImpl;
- @Autowired
private UserDao userDao;
@Autowired
- private FlvRecorderConverterTask flvRecorderConverterTask;
+ private RecordingConverterTask recordingConverterTask;
@Autowired
- private FlvInterviewConverterTask flvInterviewConverterTask;
+ private InterviewConverterTask interviewConverterTask;
@Autowired
- private FlvRecordingDao recordingDao;
+ private RecordingDao recordingDao;
@Autowired
private ScopeApplicationAdapter scopeApplicationAdapter;
@Autowired
- private FlvRecordingMetaDeltaDao metaDeltaDao;
+ private RecordingMetaDeltaDao metaDeltaDao;
@Autowired
- private FlvRecordingMetaDataDao metaDataDao;
+ private RecordingMetaDataDao metaDataDao;
public void resultReceived(IPendingServiceCall arg0) {
}
- private static String generateFileName(Long flvRecording_id, String streamid) throws Exception {
+ private static String generateFileName(Long recordingId, String streamid) throws Exception {
String dateString = CalendarPatterns.getTimeForStreamId(new Date());
- return "rec_" + flvRecording_id + "_stream_" + streamid + "_" + dateString;
+ return "rec_" + recordingId + "_stream_" + streamid + "_" + dateString;
}
public String recordMeetingStream(IConnection current, Client client, String roomRecordingName, String comment, Boolean isInterview) {
@@ -98,10 +97,10 @@ public class FLVRecorderService implemen
Date now = new Date();
- FlvRecording flvRecording = new FlvRecording();
+ Recording recording = new Recording();
- flvRecording.setFileHash("");
- flvRecording.setFileName(roomRecordingName);
+ recording.setFileHash("");
+ recording.setFileName(roomRecordingName);
Long ownerId = client.getUser_id();
if (ownerId != null && ownerId < 0) {
User c = userDao.get(-ownerId);
@@ -109,30 +108,27 @@ public class FLVRecorderService implemen
ownerId = c.getOwnerId();
}
}
- flvRecording.setInsertedBy(ownerId);
- flvRecording.setFolder(false);
- flvRecording.setIsImage(false);
- flvRecording.setIsPresentation(false);
- flvRecording.setIsRecording(true);
- flvRecording.setComment(comment);
- flvRecording.setIsInterview(isInterview);
-
- flvRecording.setRoom_id(room_id);
- flvRecording.setRecordStart(now);
-
- flvRecording.setWidth(client.getVWidth());
- flvRecording.setHeight(client.getVHeight());
-
- flvRecording.setOwnerId(ownerId);
- flvRecording.setStatus(FlvRecording.Status.RECORDING);
- flvRecording = recordingDao.update(flvRecording);
- // Receive flvRecordingId
- Long flvRecordingId = flvRecording.getFlvRecordingId();
+ recording.setInsertedBy(ownerId);
+ recording.setType(Type.Recording);
+ recording.setComment(comment);
+ recording.setIsInterview(isInterview);
+
+ recording.setRoomId(room_id);
+ recording.setRecordStart(now);
+
+ recording.setWidth(client.getVWidth());
+ recording.setHeight(client.getVHeight());
+
+ recording.setOwnerId(ownerId);
+ recording.setStatus(Recording.Status.RECORDING);
+ recording = recordingDao.update(recording);
+ // Receive recordingId
+ Long recordingId = recording.getId();
log.debug("##REC:: recording created by USER: " + ownerId);
// Update Client and set Flag
client.setIsRecording(true);
- client.setFlvRecordingId(flvRecordingId);
+ client.setFlvRecordingId(recordingId);
sessionManager.updateClientByStreamId(client.getStreamid(), client, false, null);
// get all stream and start recording them
@@ -142,33 +138,33 @@ public class FLVRecorderService implemen
Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
// Send every user a notification that the recording did start
- if (!rcl.getIsAVClient()) {
+ if (!rcl.isAvClient()) {
((IServiceCapableConnection) conn).invoke("startedRecording", new Object[] { client }, this);
}
// If its the recording client we need another type of Meta Data
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
- String streamName_Screen = generateFileName(flvRecordingId, rcl.getStreamPublishName().toString());
+ String streamName_Screen = generateFileName(recordingId, rcl.getStreamPublishName().toString());
- Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(
- flvRecordingId, rcl.getFirstname() + " " + rcl.getLastname(), now, false,
+ Long metaDataId = metaDataDao.add(
+ recordingId, rcl.getFirstname() + " " + rcl.getLastname(), now, false,
false, true, streamName_Screen, rcl.getInterviewPodId());
// Start FLV Recording
- recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, flvRecordingMetaDataId, true, isInterview);
+ recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, metaDataId, true, isInterview);
// Add Meta Data
- rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);
+ rcl.setFlvRecordingMetaDataId(metaDataId);
sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
}
- } else if ((rcl.isMobile() || rcl.getIsAVClient())
+ } else if ((rcl.isMobile() || rcl.isAvClient())
&& (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
// if the user does publish av, a, v
// But we only record av or a, video only is not interesting
String broadcastId = "" + rcl.getBroadCastID();
- String streamName = generateFileName(flvRecordingId, broadcastId);
+ String streamName = generateFileName(recordingId, broadcastId);
// Add Meta Data
boolean isAudioOnly = false;
@@ -181,7 +177,7 @@ public class FLVRecorderService implemen
isVideoOnly = true;
}
- Long metaId = metaDataDao.addFlvRecordingMetaData(flvRecordingId,
+ Long metaId = metaDataDao.add(recordingId,
rcl.getFirstname() + " " + rcl.getLastname(), now, isAudioOnly, isVideoOnly, false, streamName,
rcl.getInterviewPodId());
@@ -230,7 +226,7 @@ public class FLVRecorderService implemen
log.debug("### stream " + stream);
log.debug("### streamName " + streamName);
log.debug("### conn.getScope() " + conn.getScope());
- log.debug("### flvRecordingMetaDataId " + metaId);
+ log.debug("### recordingMetaDataId " + metaId);
log.debug("### isScreenData " + isScreenData);
log.debug("### isInterview " + isInterview);
StreamListener streamListener = new StreamListener(!isScreenData, streamName, conn.getScope(), metaId, isScreenData, isInterview, metaDataDao, metaDeltaDao);
@@ -255,7 +251,7 @@ public class FLVRecorderService implemen
if (metaId == null) {
// this should be fixed, can be useful for debugging, after all this is an error
// but we don't want the application to completely stop the process
- log.error("flvRecordingMetaDataId is null");
+ log.error("recordingMetaDataId is null");
}
log.debug("** stopRecordingShow: " + conn);
@@ -280,9 +276,9 @@ public class FLVRecorderService implemen
}
}
- FlvRecordingMetaData metaData = metaDataDao.get(metaId);
+ RecordingMetaData metaData = metaDataDao.get(metaId);
BaseConverter.printMetaInfo(metaData, "Stopping the stream");
- // Manually call finish on the stream so that there is no endless loop waiting in the FlvRecorderConverter waiting for the stream to finish
+ // Manually call finish on the stream so that there is no endless loop waiting in the RecordingConverter waiting for the stream to finish
// this would normally happen in the Listener
Status s = metaData.getStreamStatus();
if (Status.NONE == s) {
@@ -297,9 +293,9 @@ public class FLVRecorderService implemen
log.debug("Available Streams :: " + streamListeners.size());
for (Long entryKey : streamListeners.keySet()) {
- log.debug("Stored flvRecordingMetaDataId in Map: " + entryKey);
+ log.debug("Stored recordingMetaDataId in Map: " + entryKey);
}
- throw new IllegalStateException("Could not find Listener to stop! flvRecordingMetaDataId " + metaId);
+ throw new IllegalStateException("Could not find Listener to stop! recordingMetaDataId " + metaId);
}
listenerAdapter.closeStream();
@@ -310,7 +306,7 @@ public class FLVRecorderService implemen
}
}
- public Long stopRecordAndSave(IScope scope, Client currentClient, Long storedFlvRecordingId) {
+ public Long stopRecordAndSave(IScope scope, Client currentClient, Long storedRecordingId) {
try {
log.debug("stopRecordAndSave " + currentClient.getUsername() + "," + currentClient.getUserip());
@@ -325,49 +321,49 @@ public class FLVRecorderService implemen
}
log.debug("is this users still alive? stop it :" + rcl);
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
// Stop FLV Recording
stopRecordingShow(conn, rcl.getStreamPublishName(), rcl.getFlvRecordingMetaDataId());
// Update Meta Data
- metaDataDao.updateFlvRecordingMetaDataEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
+ metaDataDao.updateEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
}
- } else if ((rcl.isMobile() || rcl.getIsAVClient())
+ } else if ((rcl.isMobile() || rcl.isAvClient())
&& (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
stopRecordingShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), rcl.getFlvRecordingMetaDataId());
// Update Meta Data
- metaDataDao.updateFlvRecordingMetaDataEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
+ metaDataDao.updateEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
}
}
}
}
// Store to database
- Long flvRecordingId = currentClient.getFlvRecordingId();
+ Long recordingId = currentClient.getFlvRecordingId();
// In the Case of an Interview the stopping client does not mean
// that its actually the recording client
- if (storedFlvRecordingId != null) {
- flvRecordingId = storedFlvRecordingId;
+ if (storedRecordingId != null) {
+ recordingId = storedRecordingId;
}
- if (flvRecordingId != null) {
- flvRecordingDaoImpl.updateFlvRecordingEndTime(flvRecordingId, new Date(), currentClient.getOrganization_id());
+ if (recordingId != null) {
+ recordingDao.updateEndTime(recordingId, new Date());
// Reset values
currentClient.setFlvRecordingId(null);
currentClient.setIsRecording(false);
sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
- log.debug("flvRecorderConverterTask ", flvRecorderConverterTask);
+ log.debug("recordingConverterTask ", recordingConverterTask);
- FlvRecording flvRecording = flvRecordingDaoImpl.get(flvRecordingId);
- if (flvRecording.getIsInterview() == null || !flvRecording.getIsInterview()) {
- flvRecorderConverterTask.startConversionThread(flvRecordingId);
+ Recording recording = recordingDao.get(recordingId);
+ if (recording.getIsInterview() == null || !recording.getIsInterview()) {
+ recordingConverterTask.startConversionThread(recordingId);
} else {
- flvInterviewConverterTask.startConversionThread(flvRecordingId);
+ interviewConverterTask.startConversionThread(recordingId);
}
}
} catch (Exception err) {
@@ -408,7 +404,7 @@ public class FLVRecorderService implemen
// rcl.getUserip(), false);
log.debug("### stopRecordingShowForClient: " + rcl);
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
@@ -419,10 +415,10 @@ public class FLVRecorderService implemen
stopRecordingShow(conn, rcl.getStreamPublishName(), rcl.getFlvRecordingMetaDataId());
// Update Meta Data
- metaDataDao.updateFlvRecordingMetaDataEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
+ metaDataDao.updateEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
}
- } else if (rcl.getIsAVClient()
+ } else if (rcl.isAvClient()
&& (rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v") || rcl.getAvsettings().equals("av"))) {
// FIXME: Is there really a need to stop it manually if the user
@@ -430,7 +426,7 @@ public class FLVRecorderService implemen
stopRecordingShow(conn, String.valueOf(rcl.getBroadCastID()), rcl.getFlvRecordingMetaDataId());
// Update Meta Data
- metaDataDao.updateFlvRecordingMetaDataEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
+ metaDataDao.updateEndDate(rcl.getFlvRecordingMetaDataId(), new Date());
}
} catch (Exception err) {
@@ -438,37 +434,37 @@ public class FLVRecorderService implemen
}
}
- public void addRecordingByStreamId(IConnection conn, String streamId, Client rcl, Long flvRecordingId) {
+ public void addRecordingByStreamId(IConnection conn, String streamId, Client rcl, Long recordingId) {
try {
- FlvRecording flvRecording = flvRecordingDaoImpl.get(flvRecordingId);
+ Recording recording = recordingDao.get(recordingId);
Date now = new Date();
// If its the recording client we need another type of Meta Data
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
- String streamName_Screen = generateFileName(flvRecordingId, rcl.getStreamPublishName().toString());
+ String streamName_Screen = generateFileName(recordingId, rcl.getStreamPublishName().toString());
log.debug("############## ADD SCREEN OF SHARER :: " + rcl.getStreamPublishName());
- Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId, rcl.getFirstname()
+ Long metaDataId = metaDataDao.add(recordingId, rcl.getFirstname()
+ " " + rcl.getLastname(), now, false, false, true, streamName_Screen, rcl.getInterviewPodId());
// Start FLV Recording
- recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, flvRecordingMetaDataId, true,
- flvRecording.getIsInterview());
+ recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, metaDataId, true,
+ recording.getIsInterview());
// Add Meta Data
- rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);
+ rcl.setFlvRecordingMetaDataId(metaDataId);
sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
}
- } else if (rcl.getIsAVClient()
+ } else if (rcl.isAvClient()
&& (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
// if the user does publish av, a, v
// But we only record av or a, video only is not interesting
- String streamName = generateFileName(flvRecordingId, String.valueOf(rcl.getBroadCastID()).toString());
+ String streamName = generateFileName(recordingId, String.valueOf(rcl.getBroadCastID()).toString());
// Add Meta Data
boolean isAudioOnly = false;
@@ -480,14 +476,14 @@ public class FLVRecorderService implemen
isVideoOnly = true;
}
- Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId, rcl.getFirstname() + " "
+ Long metaDataId = metaDataDao.add(recordingId, rcl.getFirstname() + " "
+ rcl.getLastname(), now, isAudioOnly, isVideoOnly, false, streamName, rcl.getInterviewPodId());
// Start FLV recording
- recordShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), streamName, flvRecordingMetaDataId, false,
- flvRecording.getIsInterview());
+ recordShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), streamName, metaDataId, false,
+ recording.getIsInterview());
- rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);
+ rcl.setFlvRecordingMetaDataId(metaDataId);
sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
Modified: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/UserService.java Fri Nov 6 06:18:44 2015
@@ -18,42 +18,31 @@
*/
package org.apache.openmeetings.core.remote;
-import static org.apache.openmeetings.db.entity.user.PrivateMessage.INBOX_FOLDER_ID;
-import static org.apache.openmeetings.db.entity.user.PrivateMessage.SENT_FOLDER_ID;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.TimeZone;
-import org.apache.openmeetings.db.dao.calendar.AppointmentCategoryDao;
+import org.apache.openmeetings.core.mail.MailHandler;
+import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
import org.apache.openmeetings.db.dao.label.LabelDao;
-import org.apache.openmeetings.db.dao.room.RoomTypeDao;
import org.apache.openmeetings.db.dao.server.ISessionManager;
import org.apache.openmeetings.db.dao.server.ServerDao;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
import org.apache.openmeetings.db.dao.user.IUserService;
-import org.apache.openmeetings.db.dao.user.PrivateMessagesDao;
-import org.apache.openmeetings.db.dao.user.SalutationDao;
-import org.apache.openmeetings.db.dao.user.UserContactsDao;
+import org.apache.openmeetings.db.dao.user.PrivateMessageDao;
+import org.apache.openmeetings.db.dao.user.UserContactDao;
import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
-import org.apache.openmeetings.db.entity.calendar.MeetingMember;
import org.apache.openmeetings.db.entity.room.Client;
-import org.apache.openmeetings.db.entity.room.Room;
import org.apache.openmeetings.db.entity.server.Server;
-import org.apache.openmeetings.db.entity.user.Salutation;
import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.db.entity.user.UserContact;
-import org.apache.openmeetings.db.util.TimezoneUtil;
-import org.apache.openmeetings.core.mail.MailHandler;
-import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.db.util.AuthLevelUtil;
-import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.openmeetings.db.util.TimezoneUtil;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.scope.IScope;
import org.slf4j.Logger;
@@ -75,17 +64,13 @@ public class UserService implements IUse
@Autowired
private AppointmentDao appointmentDao;
@Autowired
- private AppointmentCategoryDao appointmentCategoryDao;
- @Autowired
private SessiondataDao sessiondataDao;
@Autowired
private UserDao userDao;
@Autowired
- private SalutationDao salutationmanagement;
+ private PrivateMessageDao privateMessagesDao;
@Autowired
- private PrivateMessagesDao privateMessagesDao;
- @Autowired
- private UserContactsDao userContactsDao;
+ private UserContactDao userContactsDao;
@Autowired
private MailHandler mailHandler;
@Autowired
@@ -96,8 +81,6 @@ public class UserService implements IUse
private ISlaveHTTPConnectionManager slaveHTTPConnectionManager;
@Autowired
private LabelDao labelDao;
- @Autowired
- private RoomTypeDao roomTypeDao;
/**
* get user by id, admin only
@@ -131,16 +114,6 @@ public class UserService implements IUse
}
/**
- * get all availible Salutations
- *
- * @param SID
- * @return all availible Salutations
- */
- public List<Salutation> getUserSalutations(String SID, long language_id) {
- return salutationmanagement.getUserSalutations(language_id);
- }
-
- /**
* gets a whole user-list(admin-role only)
*
* @param SID
@@ -230,7 +203,7 @@ public class UserService implements IUse
}
return null;
}
-
+/* TODO FIXME should replaced by wicket component
@Deprecated
public Long requestUserToContactList(String SID, Long userToAdd_id,
String domain, String port, String webapp) {
@@ -245,7 +218,7 @@ public class UserService implements IUse
}
return null;
}
-
+*/
public List<UserContact> getPendingUserContacts(String SID) {
try {
Long users_id = sessiondataDao.checkSession(SID);
@@ -311,6 +284,7 @@ public class UserService implements IUse
return cal.getTime();
}
+ /* TODO FIXME should replaced by wicket component
public Long composeMail(String SID, List<String> recipients,
String subject, String message, Boolean bookedRoom,
@@ -364,7 +338,7 @@ public class UserService implements IUse
// We do not send an email to the one that has created the
// private message
- if (to != null && from.getUser_id().equals(to.getUser_id())) {
+ if (to != null && from.getId().equals(to.getId())) {
continue;
}
@@ -379,12 +353,12 @@ public class UserService implements IUse
message, INBOX_FOLDER_ID, from, to, to,
bookedRoom, room, false, 0L);
- if (to.getAdresses() != null) {
+ if (to.getAddress() != null) {
AbstractTemplatePanel.ensureApplication(from.getLanguage_id());
String aLinkHTML = "<br/><br/>" + "<a href='" + ContactsHelper.getLink() + "'>"
+ labelDao.getString(1302, from.getLanguage_id()) + "</a><br/>";
- mailHandler.send(to.getAdresses().getEmail(),
+ mailHandler.send(to.getAddress().getEmail(),
labelDao.getString(1301, from.getLanguage_id()) + subject,
message.replaceAll("\\<.*?>", "") + aLinkHTML);
}
@@ -396,7 +370,7 @@ public class UserService implements IUse
}
return null;
}
-
+*/
public Boolean checkUserIsInContactList(String SID, Long user_id) {
try {
Long users_id = sessiondataDao.checkSession(SID);
@@ -405,7 +379,7 @@ public class UserService implements IUse
List<UserContact> uList = userContactsDao.getContactsByUserAndStatus(users_id, false);
for (UserContact userContact : uList) {
- if (userContact.getContact().getUser_id().equals(user_id)) {
+ if (userContact.getContact().getId().equals(user_id)) {
return true;
}
}
@@ -480,6 +454,7 @@ public class UserService implements IUse
@Override
public Boolean kickUserBySessionId(String SID, long userId, String sessionId) {
+ /* TODO FIXME should replaced by wicket component
try {
Long users_id = sessiondataDao.checkSession(SID);
// admin only
@@ -492,6 +467,7 @@ public class UserService implements IUse
} catch (Exception err) {
log.error("[kickUserBySessionId]", err);
}
+ */
return null;
}
}
Modified: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java Fri Nov 6 06:18:44 2015
@@ -35,14 +35,14 @@ import java.util.concurrent.atomic.Atomi
import org.apache.openmeetings.core.data.conference.RoomManager;
import org.apache.openmeetings.core.data.whiteboard.EmoticonsManager;
import org.apache.openmeetings.core.data.whiteboard.WhiteboardManager;
-import org.apache.openmeetings.core.remote.FLVRecorderService;
+import org.apache.openmeetings.core.remote.RecordingService;
import org.apache.openmeetings.core.remote.WhiteBoardService;
import org.apache.openmeetings.core.remote.util.SessionVariablesUtil;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
import org.apache.openmeetings.db.dao.label.LabelDao;
import org.apache.openmeetings.db.dao.log.ConferenceLogDao;
-import org.apache.openmeetings.db.dao.record.FlvRecordingDao;
+import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.dao.room.RoomDao;
import org.apache.openmeetings.db.dao.server.ISessionManager;
import org.apache.openmeetings.db.dao.server.ServerDao;
@@ -52,6 +52,7 @@ import org.apache.openmeetings.db.dto.ro
import org.apache.openmeetings.db.dto.room.RoomStatus;
import org.apache.openmeetings.db.entity.calendar.Appointment;
import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+import org.apache.openmeetings.db.entity.log.ConferenceLog;
import org.apache.openmeetings.db.entity.room.Client;
import org.apache.openmeetings.db.entity.room.Room;
import org.apache.openmeetings.db.entity.server.Server;
@@ -90,7 +91,7 @@ public class ScopeApplicationAdapter ext
@Autowired
private WhiteboardManager whiteboardManagement;
@Autowired
- private FLVRecorderService flvRecorderService;
+ private RecordingService flvRecorderService;
@Autowired
private ConfigurationDao configurationDao;
@Autowired
@@ -106,7 +107,7 @@ public class ScopeApplicationAdapter ext
@Autowired
private RoomDao roomDao;
@Autowired
- private FlvRecordingDao recordingDao;
+ private RecordingDao recordingDao;
@Autowired
private ServerDao serverDao;
@@ -183,7 +184,7 @@ public class ScopeApplicationAdapter ext
//TODO add check for room rights
String parentSid = (String)map.get("parentSid");
rcm.setRoom_id(Long.parseLong(conn.getScope().getName()));
- rcm.setIsScreenClient(true);
+ rcm.setScreenClient(true);
SessionVariablesUtil.setIsScreenClient(conn.getClient());
rcm.setUser_id(((Integer)map.get("userId")).longValue());
@@ -199,11 +200,9 @@ public class ScopeApplicationAdapter ext
}
// Log the User
- conferenceLogDao.addConferenceLog("ClientConnect",
+ conferenceLogDao.addConferenceLog(ConferenceLog.Type.clientConnect,
rcm.getUser_id(), streamId, null, rcm.getUserip(),
- rcm.getScope(), rcm.getExternalUserId(),
- rcm.getExternalUserType(), rcm.getEmail(),
- rcm.getFirstname(), rcm.getLastname());
+ rcm.getScope());
return true;
}
@@ -385,7 +384,7 @@ public class ScopeApplicationAdapter ext
Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
if (rcl == null) {
// continue;
- } else if (rcl.getIsScreenClient()) {
+ } else if (rcl.isScreenClient()) {
// continue;
} else {
if (!streamid.equals(rcl.getStreamid())) {
@@ -508,13 +507,9 @@ public class ScopeApplicationAdapter ext
Long room_id = currentClient.getRoom_id();
// Log the User
- conferenceLogDao.addConferenceLog("roomLeave",
+ conferenceLogDao.addConferenceLog(ConferenceLog.Type.roomLeave,
currentClient.getUser_id(), currentClient.getStreamid(),
- room_id, currentClient.getUserip(), "",
- currentClient.getExternalUserId(),
- currentClient.getExternalUserType(),
- currentClient.getEmail(), currentClient.getFirstname(),
- currentClient.getLastname());
+ room_id, currentClient.getUserip(), "");
// Remove User from Sync List's
if (room_id != null) {
@@ -568,11 +563,11 @@ public class ScopeApplicationAdapter ext
}
//If the user was a avclient, we do not broadcast a message about that to everybody
- if (currentClient.getIsAVClient()) {
+ if (currentClient.isAvClient()) {
continue;
}
- boolean isScreen = rcl.getIsScreenClient();
+ boolean isScreen = rcl.isScreenClient();
if (isScreen && currentClient.getPublicSID().equals(rcl.getStreamPublishName())) {
//going to terminate screen sharing started by this client
((IServiceCapableConnection) cons).invoke("stopStream", new Object[] { },this);
@@ -580,7 +575,7 @@ public class ScopeApplicationAdapter ext
} else if (isScreen) {
// screen sharing clients do not receive events
continue;
- } else if (rcl.getIsAVClient()) {
+ } else if (rcl.isAvClient()) {
// AVClients or potential AVClients do not receive events
continue;
}
@@ -625,12 +620,12 @@ public class ScopeApplicationAdapter ext
log.debug("start streamPublishStart broadcast start: " + stream.getPublishedName() + " CONN " + current);
// In case its a screen sharing we start a new Video for that
- if (currentClient.getIsScreenClient()) {
+ if (currentClient.isScreenClient()) {
currentClient.setScreenPublishStarted(true);
sessionManager.updateClientByStreamId(streamid, currentClient, false, null);
}
//If its an audio/video client then send the session object with the full data to everybody
- else if (currentClient.getIsAVClient()) {
+ else if (currentClient.isAvClient()) {
clientObjectSendToSync = sessionManager.getClientByPublicSID(currentClient.getPublicSID(), false, null);
}
@@ -658,11 +653,11 @@ public class ScopeApplicationAdapter ext
log.debug("RCL getIsRecording newStream SEND");
flvRecorderService.addRecordingByStreamId(current, streamid, currentClient, rcl.getFlvRecordingId());
}
- if (rcl.getIsAVClient()) {
+ if (rcl.isAvClient()) {
log.debug("RCL getIsAVClient newStream SEND");
return true;
}
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
log.debug("RCL getIsScreenClient newStream SEND");
return true;
}
@@ -762,7 +757,7 @@ public class ScopeApplicationAdapter ext
} else {
Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
if (rcl != null) {
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
// continue;
} else {
log.debug("is this users still alive? :" + rcl);
@@ -909,7 +904,7 @@ public class ScopeApplicationAdapter ext
public boolean filter(IConnection conn) {
Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
if (rcl == null) {
- } else if (rcl.getIsScreenClient()) {
+ } else if (rcl.isScreenClient()) {
} else {
if (rcl != currentClient) {
rcl.setMicMuted(true);
@@ -990,7 +985,7 @@ public class ScopeApplicationAdapter ext
// No moderator in this room at the moment
Room room = roomDao.get(currentClient.getRoom_id());
- return room.getIsModeratedRoom() ? 3L : 1L;
+ return room.isModerated() ? 3L : 1L;
}
} catch (Exception err) {
@@ -1081,8 +1076,8 @@ public class ScopeApplicationAdapter ext
Room room = roomDao.get(room_id);
// not really - default logic
- if (room.getAppointment() == null || room.getAppointment() == false) {
- if (room.getIsModeratedRoom()) {
+ if (!room.isAppointment()) {
+ if (room.isModerated()) {
// if this is a Moderated Room then the Room can be only
// locked off by the Moderator Bit
List<Client> clientModeratorListRoom = sessionManager.getCurrentModeratorByRoom(room_id);
@@ -1133,21 +1128,21 @@ public class ScopeApplicationAdapter ext
* current conference room<br/>
* <br/>
*
- * @param room_id - id of the room
+ * @param roomId - id of the room
* @param becomeModerator - is user will become moderator
* @param isSuperModerator - is user super moderator
* @param organization_id - organization id of the user
* @param colorObj - some color
* @return RoomStatus object
*/
- public synchronized RoomStatus setRoomValues(Long room_id, Boolean becomeModerator, Boolean isSuperModerator,
+ public synchronized RoomStatus setRoomValues(Long roomId, Boolean becomeModerator, Boolean isSuperModerator,
Long organization_id, String colorObj) {
try {
log.debug("----------- setRoomValues");
IConnection current = Red5.getConnectionLocal();
String streamid = current.getClient().getId();
Client currentClient = sessionManager.getClientByStreamId(streamid, null);
- currentClient.setRoom_id(room_id);
+ currentClient.setRoom_id(roomId);
currentClient.setRoomEnter(new Date());
currentClient.setOrganization_id(organization_id);
@@ -1158,8 +1153,8 @@ public class ScopeApplicationAdapter ext
if (currentClient.getUser_id() != null) {
User us = usersDao.get(currentClient.getUser_id());
if (us != null) {
- currentClient.setExternalUserId(us.getExternalUserId());
- currentClient.setExternalUserType(us.getExternalUserType());
+ currentClient.setExternalUserId(us.getExternalId());
+ currentClient.setExternalUserType(us.getExternalType());
}
}
}
@@ -1169,22 +1164,18 @@ public class ScopeApplicationAdapter ext
sessionManager.updateClientByStreamId(streamid, currentClient, true, null);
- Room room = roomDao.get(room_id);
+ Room room = roomDao.get(roomId);
if (room.getShowMicrophoneStatus()) {
currentClient.setCanGiveAudio(true);
}
// Log the User
- conferenceLogDao.addConferenceLog("roomEnter",
- currentClient.getUser_id(), streamid, room_id,
- currentClient.getUserip(), "",
- currentClient.getExternalUserId(),
- currentClient.getExternalUserType(),
- currentClient.getEmail(), currentClient.getFirstname(),
- currentClient.getLastname());
+ conferenceLogDao.addConferenceLog(ConferenceLog.Type.roomEnter,
+ currentClient.getUser_id(), streamid, roomId,
+ currentClient.getUserip(), "");
// Check for Moderation LogicalRoom ENTER
- List<Client> clientListRoom = sessionManager.getClientListByRoom(room_id);
+ List<Client> clientListRoom = sessionManager.getClientListByRoom(roomId);
// Return Object
RoomStatus roomStatus = new RoomStatus();
@@ -1195,8 +1186,8 @@ public class ScopeApplicationAdapter ext
}
// default logic for non regular rooms
- if (room.getAppointment() == null || room.getAppointment() == false) {
- if (room.getIsModeratedRoom()) {
+ if (!room.isAppointment()) {
+ if (room.isModerated()) {
// if this is a Moderated Room then the Room can be only
// locked off by the Moderator Bit
// List<RoomClient> clientModeratorListRoom =
@@ -1229,7 +1220,7 @@ public class ScopeApplicationAdapter ext
} else {
// If this is a normal Room Moderator rules : first come, first draw ;-)
log.debug("setRoomValues : Room"
- + room_id
+ + roomId
+ " not appointed! Moderator rules : first come, first draw ;-)");
if (clientListRoom.size() == 1) {
log.debug("Room is empty so set this user to be moderation role");
@@ -1265,14 +1256,14 @@ public class ScopeApplicationAdapter ext
} else {
// If this is an Appointment then the Moderator will be set to the Invitor
- Appointment ment = appointmentDao.getAppointmentByRoom(room_id);
+ Appointment ment = appointmentDao.getByRoom(roomId);
Long userIdInRoomClient = currentClient.getUser_id();
boolean found = false;
boolean moderator_set = false;
// First check owner who is not in the members list
- if (ment.getOwner().getUser_id().equals(userIdInRoomClient)) {
+ if (ment.getOwner().getId().equals(userIdInRoomClient)) {
found = true;
log.debug("User "
+ userIdInRoomClient
@@ -1299,9 +1290,9 @@ public class ScopeApplicationAdapter ext
if (member.getUser() != null) {
log.debug("checking user " + member.getUser().getFirstname()
+ " for moderator role - ID : "
- + member.getUser().getUser_id());
+ + member.getUser().getId());
- if (member.getUser().getUser_id().equals(userIdInRoomClient)) {
+ if (member.getUser().getId().equals(userIdInRoomClient)) {
found = true;
log.debug("User " + userIdInRoomClient+ " is NOT moderator due to flag in MeetingMember record");
currentClient.setIsMod(false);
@@ -1399,8 +1390,8 @@ public class ScopeApplicationAdapter ext
User us = usersDao.get(userId);
if (us != null) {
- currentClient.setExternalUserId(us.getExternalUserId());
- currentClient.setExternalUserType(us.getExternalUserType());
+ currentClient.setExternalUserId(us.getExternalId());
+ currentClient.setExternalUserType(us.getExternalType());
if (us.getPictureuri() != null) {
// set Picture-URI
currentClient.setPicture_uri(us.getPictureuri());
@@ -1444,8 +1435,8 @@ public class ScopeApplicationAdapter ext
User user = usersDao.get(userId);
if (user != null) {
- currentClient.setExternalUserId(user.getExternalUserId());
- currentClient.setExternalUserType(user.getExternalUserType());
+ currentClient.setExternalUserId(user.getExternalId());
+ currentClient.setExternalUserType(user.getExternalType());
}
// only fill this value from User-Record
Modified: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/DownloadHandler.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/DownloadHandler.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/DownloadHandler.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/DownloadHandler.java Fri Nov 6 06:18:44 2015
@@ -254,7 +254,7 @@ public class DownloadHandler extends Bas
String fileNameResult = requestedFile;
if (fileExplorerItemId != null && fileExplorerItemId > 0) {
- FileExplorerItem fileExplorerItem = getBean(FileExplorerItemDao.class).getFileExplorerItemsById(fileExplorerItemId);
+ FileExplorerItem fileExplorerItem = getBean(FileExplorerItemDao.class).get(fileExplorerItemId);
if (fileExplorerItem != null) {
fileNameResult = fileExplorerItem.getFileName().substring(0, fileExplorerItem.getFileName().length()-4)
Modified: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/UploadController.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/UploadController.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/UploadController.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/servlet/outputhandler/UploadController.java Fri Nov 6 06:18:44 2015
@@ -41,6 +41,7 @@ import org.apache.openmeetings.core.remo
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
+import org.apache.openmeetings.db.entity.file.FileItem.Type;
import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.OpenmeetingsVariables;
@@ -122,7 +123,7 @@ public class UploadController extends Ab
uploadCompleteMessage.setAction("newFile");
setFileExplorerItem(uploadCompleteMessage,
- fileExplorerItemDao.getFileExplorerItemsById(
+ fileExplorerItemDao.get(
returnError.getFileExplorerItemId()));
uploadCompleteMessage.setHasError(returnError.hasError());
@@ -143,14 +144,14 @@ public class UploadController extends Ab
}
public void setFileExplorerItem(UploadCompleteMessage msg, FileExplorerItem fileExplorerItem) {
- if (fileExplorerItem.getIsImage() != null) {
- msg.setIsImage(fileExplorerItem.getIsImage());
+ if (Type.Image == fileExplorerItem.getType()) {
+ msg.setIsImage(true);
}
- if (fileExplorerItem.getIsVideo() != null) {
- msg.setIsVideo(fileExplorerItem.getIsVideo());
+ if (Type.Video == fileExplorerItem.getType()) {
+ msg.setIsVideo(true);
}
- if (fileExplorerItem.getIsPresentation() != null) {
- msg.setIsPresentation(fileExplorerItem.getIsPresentation());
+ if (Type.Presentation == fileExplorerItem.getType()) {
+ msg.setIsPresentation(true);
}
msg.setFileSystemName(fileExplorerItem.getFileName());
msg.setFileHash(fileExplorerItem.getFileHash());
Modified: openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/session/SessionManager.java Fri Nov 6 06:18:44 2015
@@ -94,7 +94,7 @@ public class SessionManager implements I
rcm.setSwfurl(swfUrl);
rcm.setIsMod(new Boolean(false));
rcm.setCanDraw(new Boolean(false));
- rcm.setIsAVClient(isAVClient);
+ rcm.setAvClient(isAVClient);
if (cache.containsKey(null, streamId)) {
log.error("Tried to add an existing Client " + streamId);
@@ -134,7 +134,7 @@ public class SessionManager implements I
public Client getClientByPublicSID(String publicSID, boolean isAVClient, Server server) {
try {
for (Client rcl : cache.getClientsByPublicSID(server, publicSID)) {
- if (rcl.getIsAVClient() != isAVClient) {
+ if (rcl.isAvClient() != isAVClient) {
continue;
}
return rcl;
@@ -149,7 +149,7 @@ public class SessionManager implements I
try {
for (Entry<Long,List<Client>> entry : cache.getClientsByPublicSID(publicSID).entrySet()) {
for (Client rcl : entry.getValue()) {
- if (rcl.getIsAVClient() != isAVClient) {
+ if (rcl.isAvClient() != isAVClient) {
continue;
}
return new ClientSessionInfo(rcl, entry.getKey());
@@ -165,11 +165,11 @@ public class SessionManager implements I
try {
for (Client rcl : cache.getClientsByUserId(null, userId)) {
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
continue;
}
- if (rcl.getIsAVClient()) {
+ if (rcl.isAvClient()) {
continue;
}
@@ -247,10 +247,10 @@ public class SessionManager implements I
for (Client rcl : cache.getClientsByRoomId(roomId)) {
- if (rcl.getIsScreenClient()) {
+ if (rcl.isScreenClient()) {
continue;
}
- if (rcl.getIsAVClient()) {
+ if (rcl.isAvClient()) {
continue;
}
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ChatDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ChatDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ChatDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ChatDao.java Fri Nov 6 06:18:44 2015
@@ -38,8 +38,31 @@ public class ChatDao {
.getSingleResult();
}
- //TODO additional methods should be added to get messages by external email
- public List<ChatMessage> get(long userId, int start, int count) {
+ //for export
+ public List<ChatMessage> get(int start, int count) {
+ return em.createNamedQuery("getGlobalChatMessages", ChatMessage.class)
+ .setFirstResult(start)
+ .setMaxResults(count)
+ .getResultList();
+ }
+
+ public List<ChatMessage> getGlobal(int start, int count) {
+ return em.createNamedQuery("getGlobalChatMessages", ChatMessage.class)
+ .setFirstResult(start)
+ .setMaxResults(count)
+ .getResultList();
+ }
+
+ public List<ChatMessage> getRoom(long roomId, int start, int count, boolean all) {
+ return em.createNamedQuery("getChatMessagesByRoom", ChatMessage.class)
+ .setParameter("roomId", roomId)
+ .setParameter("all", all)
+ .setFirstResult(start)
+ .setMaxResults(count)
+ .getResultList();
+ }
+
+ public List<ChatMessage> getUser(long userId, int start, int count) {
return em.createNamedQuery("getChatMessagesByUser", ChatMessage.class)
.setParameter("userId", userId)
.setFirstResult(start)
@@ -47,8 +70,10 @@ public class ChatDao {
.getResultList();
}
- public List<ChatMessage> get(int start, int count) {
- return em.createNamedQuery("getGlobalChatMessages", ChatMessage.class)
+ public List<ChatMessage> getUserRecent(long userId, Date date, int start, int count) {
+ return em.createNamedQuery("getChatMessagesByUserTime", ChatMessage.class)
+ .setParameter("userId", userId)
+ .setParameter("date", date)
.setFirstResult(start)
.setMaxResults(count)
.getResultList();
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java Fri Nov 6 06:18:44 2015
@@ -120,7 +120,7 @@ public class ConfigurationDao implements
List<Configuration> list = get(key);
if (list == null || list.isEmpty() || list.get(0) == null) {
- log.warn("Could not find key in configuration CONF_KEY: " + key);
+ log.warn("Could not find key in configurations: " + key);
} else {
String val = list.get(0).getConf_value();
// Use the custom value as default value
@@ -141,7 +141,7 @@ public class ConfigurationDao implements
return c.newInstance(defaultValue);
} catch (Exception err) {
- log.error("cannot be cast to return type, you have misconfigured your configuration CONF_KEY: " + key, err);
+ log.error("cannot be cast to return type, you have misconfigured your configurations: " + key, err);
return null;
}
}
@@ -183,7 +183,7 @@ public class ConfigurationDao implements
public Long addConfig(Configuration conf) {
try {
conf = em.merge(conf);
- Long configuration_id = conf.getConfiguration_id();
+ Long configuration_id = conf.getId();
return configuration_id;
} catch (Exception ex2) {
log.error("[updateConfByUID]: ", ex2);
@@ -198,9 +198,9 @@ public class ConfigurationDao implements
*/
public Long updateConfig(Configuration conf) {
try {
- if (conf.getConfiguration_id() == null
- || conf.getConfiguration_id() == 0
- || conf.getConfiguration_id() == 0L) {
+ if (conf.getId() == null
+ || conf.getId() == 0
+ || conf.getId() == 0L) {
em.persist(conf);
} else {
if (!em.contains(conf)) {
@@ -212,7 +212,7 @@ public class ConfigurationDao implements
} else if ("show.whiteboard.draw.status".equals(conf.getConf_key())) {
whiteboardDrawStatus = "1".equals(conf.getConf_value());
}
- return conf.getConfiguration_id();
+ return conf.getId();
} catch (Exception ex2) {
log.error("[updateConfByUID]: ", ex2);
}
@@ -270,7 +270,7 @@ public class ConfigurationDao implements
public Configuration update(Configuration entity, Long userId, boolean deleted) {
String key = entity.getConf_key();
String value = entity.getConf_value();
- if (entity.getConfiguration_id() == null || entity.getConfiguration_id() <= 0) {
+ if (entity.getId() == null || entity.getId() <= 0) {
entity.setStarttime(new Date());
entity.setDeleted(deleted);
em.persist(entity);
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ErrorDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ErrorDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ErrorDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ErrorDao.java Fri Nov 6 06:18:44 2015
@@ -21,15 +21,14 @@ package org.apache.openmeetings.db.dao.b
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.util.Date;
-import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
-import org.apache.openmeetings.db.entity.basic.ErrorType;
import org.apache.openmeetings.db.entity.basic.ErrorValue;
+import org.apache.openmeetings.db.entity.basic.ErrorValue.Type;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;
@@ -41,87 +40,44 @@ public class ErrorDao {
@PersistenceContext
private EntityManager em;
- public Long addErrorType(Long errortype_id, Long fieldvalues_id) {
- try {
- ErrorType eType = new ErrorType();
- eType.setErrortype_id(errortype_id);
- eType.setStarttime(new Date());
- eType.setDeleted(false);
- eType.setFieldvalues_id(fieldvalues_id);
- eType = em.merge(eType);
- Long newerrortype_id = eType.getErrortype_id();
- return newerrortype_id;
- } catch (Exception ex2) {
- log.error("[addErrorType]: ", ex2);
- }
- return null;
- }
-
- public List<ErrorType> getErrorTypes() {
- try {
- TypedQuery<ErrorType> query = em.createNamedQuery("getErrorTypes", ErrorType.class);
- query.setParameter("deleted", true);
- List<ErrorType> ll = query.getResultList();
- return ll;
- } catch (Exception ex2) {
- log.error("[getErrorTypes]: ", ex2);
- }
- return null;
- }
-
- public ErrorType getErrorType(Long errortype_id) {
- try {
- TypedQuery<ErrorType> query = em.createNamedQuery("getErrorType", ErrorType.class);
- query.setParameter("deleted", true);
- query.setParameter("errortype_id", errortype_id);
- return query.getSingleResult();
- } catch (Exception ex2) {
- log.error("[getErrorType(" + errortype_id + ")]", ex2);
- }
- return null;
- }
-
- public Long addErrorValues(Long errorvalues_id, Long errortype_id,
- Long fieldvalues_id) {
+ public Long addErrorValues(Long id, Type type, Long labelId) {
try {
ErrorValue eValue = new ErrorValue();
- eValue.setErrorvalues_id(errorvalues_id);
- eValue.setErrortype_id(errortype_id);
+ eValue.setId(id);
+ eValue.setType(type);
eValue.setDeleted(false);
- eValue.setStarttime(new Date());
- eValue.setFieldvalues_id(fieldvalues_id);
+ eValue.setInserted(new Date());
+ eValue.setLabelId(labelId);
eValue = em.merge(eValue);
- return eValue.getErrorvalues_id();
+ return eValue.getId();
} catch (Exception ex2) {
log.error("[addErrorValues]: ", ex2);
}
return null;
}
- public Long getErrorValueById(Long errortype_id, Long fieldvalues_id) {
+ public Long getErrorValueById(Type type, Long labelId) {
try {
ErrorValue eValue = new ErrorValue();
- eValue.setErrortype_id(errortype_id);
- eValue.setStarttime(new Date());
- eValue.setFieldvalues_id(fieldvalues_id);
+ eValue.setType(type);
+ eValue.setInserted(new Date());
+ eValue.setLabelId(labelId);
eValue = em.merge(eValue);
- Long newerrorvalues_id = eValue.getErrorvalues_id();
- return newerrorvalues_id;
+ return eValue.getId();
} catch (Exception ex2) {
log.error("[getErrorValueById]: ", ex2);
}
return null;
}
- public Long updateErrorValues(Long errortype_id, Long fieldvalues_id) {
+ public Long updateErrorValues(Type type, Long labelId) {
try {
ErrorValue eValue = new ErrorValue();
- eValue.setErrortype_id(errortype_id);
- eValue.setStarttime(new Date());
- eValue.setFieldvalues_id(fieldvalues_id);
+ eValue.setType(type);
+ eValue.setInserted(new Date());
+ eValue.setLabelId(labelId);
eValue = em.merge(eValue);
- Long newerrorvalues_id = eValue.getErrorvalues_id();
- return newerrorvalues_id;
+ return eValue.getId();
} catch (Exception ex2) {
log.error("[addErrorType]: ", ex2);
}
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java Fri Nov 6 06:18:44 2015
@@ -38,6 +38,7 @@ import org.apache.openmeetings.db.dao.ro
import org.apache.openmeetings.db.dao.room.RoomDao;
import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
import org.apache.openmeetings.db.entity.calendar.MeetingMember;
import org.apache.openmeetings.db.entity.room.Invitation.MessageType;
import org.apache.openmeetings.db.entity.room.Room;
@@ -55,39 +56,20 @@ public class AppointmentDao {
@Autowired
private MeetingMemberDao meetingMemberDao;
@Autowired
- private UserDao usersDao;
+ private UserDao userDao;
@Autowired
private RoomDao roomDao;
@Autowired
private ConfigurationDao cfgDao;
@Autowired
- private IInvitationManager invitationManager;
- @Autowired
private TimezoneUtil timezoneUtil;
+ @Autowired
+ private IInvitationManager invitationManager;
/*
* insert, update, delete, select
*/
- /**
- * @author o.becherer Retrievment of Appointment for room
- */
- // -----------------------------------------------------------------------------------------------
- public Appointment getAppointmentByRoom(Long room_id) {
- log.debug("AppointMentDaoImpl.getAppointmentByRoom");
-
- TypedQuery<Appointment> query = em.createNamedQuery("getAppointmentByRoomId", Appointment.class);
- query.setParameter("room_id", room_id);
-
- List<Appointment> appoint = query.getResultList();
-
- if (appoint.size() > 0) {
- return appoint.get(0);
- }
-
- return null;
- }
-
// -----------------------------------------------------------------------------------------------
public Appointment get(Long id) {
@@ -102,8 +84,8 @@ public class AppointmentDao {
return appoint;
}
- public Appointment getAppointmentByIdBackup(Long appointmentId) {
- TypedQuery<Appointment> query = em.createNamedQuery("getAppointmentByIdAny", Appointment.class).setParameter("id", appointmentId);
+ public Appointment getAny(Long id) {
+ TypedQuery<Appointment> query = em.createNamedQuery("getAppointmentByIdAny", Appointment.class).setParameter("id", id);
Appointment appoint = null;
try {
@@ -114,7 +96,7 @@ public class AppointmentDao {
return appoint;
}
- public List<Appointment> getAppointments() {
+ public List<Appointment> get() {
return em.createNamedQuery("getAppointments", Appointment.class).getResultList();
}
@@ -124,7 +106,7 @@ public class AppointmentDao {
public Appointment update(Appointment a, Long userId, boolean sendmails) {
Room r = a.getRoom();
- if (r.getRooms_id() == null) {
+ if (r.getId() == null) {
r.setName(a.getTitle());
r.setNumberOfPartizipants(cfgDao.getConfValue("calendar.conference.rooms.default.size", Long.class, "50"));
}
@@ -174,48 +156,30 @@ public class AppointmentDao {
return a;
}
- public List<Appointment> getAppointmentsByRoomId(Long roomId) {
- try {
-
- String hql = "select a from Appointment a "
- + "WHERE a.room.rooms_id = :roomId ";
-
- TypedQuery<Appointment> query = em.createQuery(hql,
- Appointment.class);
- query.setParameter("roomId", roomId);
- List<Appointment> ll = query.getResultList();
-
- return ll;
- } catch (Exception e) {
- log.error("[getAppointmentsByRoomId]", e);
- }
- return null;
- }
-
// ----------------------------------------------------------------------------------------------------------
public void delete(Appointment a, Long userId) {
a.setUpdated(new Date());
a.setDeleted(true);
a.setMeetingMembers(null);
- if (Boolean.TRUE.equals(a.getRoom().getAppointment())) {
+ if (a.getRoom().isAppointment()) {
a.getRoom().setDeleted(true);
}
update(a, userId);
}
- public List<Appointment> getAppointmentsByRange(Long userId, Date start, Date end) {
+ public List<Appointment> getInRange(Long userId, Date start, Date end) {
log.debug("Start " + start + " End " + end);
TypedQuery<Appointment> query = em.createNamedQuery("appointmentsInRange", Appointment.class);
- query.setParameter("starttime", start);
- query.setParameter("endtime", end);
+ query.setParameter("start", start);
+ query.setParameter("end", end);
query.setParameter("userId", userId);
List<Appointment> listAppoints = new ArrayList<Appointment>(query.getResultList());
TypedQuery<Appointment> q1 = em.createNamedQuery("joinedAppointmentsInRange", Appointment.class);
- q1.setParameter("starttime", start);
- q1.setParameter("endtime", end);
+ q1.setParameter("start", start);
+ q1.setParameter("end", end);
q1.setParameter("userId", userId);
for (Appointment a : q1.getResultList()) {
a.setConnectedEvent(true); //TODO need to be reviewed
@@ -225,34 +189,16 @@ public class AppointmentDao {
return listAppoints;
}
- public List<Appointment> getAppointmentsInRange(Calendar start, Calendar end) {
+ public List<Appointment> getInRange(Calendar start, Calendar end) {
TypedQuery<Appointment> q = em.createNamedQuery("appointmentsInRangeRemind", Appointment.class);
- q.setParameter("starttime", start.getTime());
- q.setParameter("endtime", end.getTime());
+ q.setParameter("none", Reminder.none);
+ q.setParameter("start", start.getTime());
+ q.setParameter("end", end.getTime());
return q.getResultList();
}
- public List<Appointment> getAppointmentsByCat(Long categoryId) {
- try {
-
- String hql = "select a from Appointments a "
- + "WHERE a.deleted false "
- + "AND a.appointmentCategory.categoryId = :categoryId";
-
- TypedQuery<Appointment> query = em.createQuery(hql,
- Appointment.class);
- query.setParameter("categoryId", categoryId);
-
- List<Appointment> listAppoints = query.getResultList();
- return listAppoints;
- } catch (Exception ex2) {
- log.error("[getAppointements]: ", ex2);
- }
- return null;
- }
-
// next appointment to select date
- public Appointment getNextAppointment(Long userId, Date start) {
+ public Appointment getNext(Long userId, Date start) {
List<Appointment> list = em.createNamedQuery("getNextAppointment", Appointment.class)
.setParameter("start", start).setParameter("userId", userId).getResultList();
return list == null || list.isEmpty() ? null : list.get(0);
@@ -268,10 +214,10 @@ public class AppointmentDao {
* @param userId
* @return
*/
- public List<Appointment> getTodaysAppointmentsbyRangeAndMember(Long userId) {
+ public List<Appointment> getForToday(Long userId) {
log.debug("getAppoitmentbyRangeAndMember : UserID - " + userId);
- TimeZone timeZone = timezoneUtil.getTimeZone(usersDao.get(userId));
+ TimeZone timeZone = timezoneUtil.getTimeZone(userDao.get(userId));
Calendar startCal = Calendar.getInstance(timeZone);
startCal.set(Calendar.MINUTE, 0);
@@ -287,8 +233,8 @@ public class AppointmentDao {
query.setParameter("userId", userId);
- query.setParameter("starttime", startCal.getTime());
- query.setParameter("endtime", endCal.getTime());
+ query.setParameter("start", startCal.getTime());
+ query.setParameter("end", endCal.getTime());
List<Appointment> listAppoints = query.getResultList();
return listAppoints;
@@ -296,33 +242,30 @@ public class AppointmentDao {
// ---------------------------------------------------------------------------------------------
- public Appointment getAppointmentByRoomId(Long user_id, Long rooms_id) {
+ public Appointment getByRoom(Long userId, Long roomId) {
try {
+ List<Appointment> list = em.createNamedQuery("getAppointmentByOwnerRoomId", Appointment.class)
+ .setParameter("userId", userId)
+ .setParameter("roomId", roomId)
+ .getResultList();
- String hql = "select a from Appointment a "
- + "WHERE a.deleted <> :deleted "
- + "AND a.owner.user_id = :user_id "
- + "AND a.room.rooms_id = :rooms_id ";
-
- TypedQuery<Appointment> query = em.createQuery(hql,
- Appointment.class);
-
- query.setParameter("deleted", true);
- query.setParameter("user_id", user_id);
- query.setParameter("rooms_id", rooms_id);
-
- List<Appointment> listAppoints = query.getResultList();
-
- if (listAppoints.size() > 0) {
- return listAppoints.get(0);
- }
-
- return null;
-
+ return list.size() > 0 ? list.get(0) : null;
} catch (Exception e) {
- log.error("[getAppointmentByRoomId]", e);
+ log.error("[getByRoom]", e);
return null;
}
}
+ public Appointment getByRoom(Long roomId) {
+ List<Appointment> list = em.createNamedQuery("getAppointmentByRoomId", Appointment.class)
+ .setParameter("roomId", roomId)
+ .getResultList();
+
+ Appointment a = list.size() > 0 ? list.get(0) : null;
+ if (a != null && !a.getRoom().isAppointment()) {
+ throw new RuntimeException("Room " + a.getRoom().getName() + " isnt part of an appointed meeting");
+ }
+
+ return a;
+ }
}
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java Fri Nov 6 06:18:44 2015
@@ -27,7 +27,10 @@ import javax.persistence.PersistenceCont
import javax.persistence.TypedQuery;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
-import org.apache.openmeetings.util.OpenmeetingsVariables;
+import org.apache.openmeetings.db.entity.file.FileItem.Type;
+
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;
@@ -39,41 +42,51 @@ import org.springframework.transaction.a
@Transactional
public class FileExplorerItemDao {
- private static final Logger log = Red5LoggerFactory.getLogger(
- FileExplorerItemDao.class,
- OpenmeetingsVariables.webAppRootKey);
+ private static final Logger log = Red5LoggerFactory.getLogger(FileExplorerItemDao.class, webAppRootKey);
@PersistenceContext
private EntityManager em;
public Long add(String fileName, String fileHash,
- Long parentFileExplorerItemId, Long ownerId, Long room_id,
+ Long parentItemId, Long ownerId, Long roomId,
Long insertedBy, Boolean isFolder, Boolean isImage,
Boolean isPresentation, String wmlFilePath,
Boolean isStoredWmlFile, Boolean isChart,
- Long externalFileId, String externalType) {
- log.debug(".add(): adding file " + fileName+ " roomID: "+room_id);
+ Long externalId, String externalType) {
+ log.debug(".add(): adding file " + fileName+ " roomID: "+roomId);
try {
FileExplorerItem fileItem = new FileExplorerItem();
fileItem.setFileName(fileName);
fileItem.setFileHash(fileHash);
fileItem.setDeleted(false);
- fileItem.setParentFileExplorerItemId(parentFileExplorerItemId);
+ fileItem.setParentItemId(parentItemId);
fileItem.setOwnerId(ownerId);
- fileItem.setRoom_id(room_id);
+ fileItem.setRoomId(roomId);
fileItem.setInserted(new Date());
fileItem.setInsertedBy(insertedBy);
- fileItem.setIsFolder(isFolder);
- fileItem.setIsImage(isImage);
- fileItem.setIsPresentation(isPresentation);
+ Type t = null;
+ if (isStoredWmlFile) {
+ t = Type.WmlFile;
+ }
+ if (isChart) {
+ t = Type.PollChart;
+ }
+ if (isImage) {
+ t = Type.Image;
+ }
+ if (isPresentation) {
+ t = Type.Presentation;
+ }
+ if (isFolder) {
+ t = Type.Folder;
+ }
+ fileItem.setType(t);
fileItem.setUpdated(new Date());
fileItem.setWmlFilePath(wmlFilePath);
- fileItem.setIsStoredWmlFile(isStoredWmlFile);
- fileItem.setIsChart(isChart);
- fileItem.setExternalFileId(externalFileId);
+ fileItem.setExternalId(externalId);
fileItem.setExternalType(externalType);
fileItem = em.merge(fileItem);
- Long fileItemId = fileItem.getFileExplorerItemId();
+ Long fileItemId = fileItem.getId();
log.debug(".add(): file " + fileName + " added as " + fileItemId);
return fileItemId;
@@ -87,7 +100,7 @@ public class FileExplorerItemDao {
try {
fileItem = em.merge(fileItem);
- Long fileItemId = fileItem.getFileExplorerItemId();
+ Long fileItemId = fileItem.getId();
return fileItemId;
} catch (Exception ex2) {
@@ -96,18 +109,11 @@ public class FileExplorerItemDao {
return null;
}
- public List<FileExplorerItem> getFileExplorerItemsByRoomAndOwner(
- Long room_id, Long ownerId) {
+ public List<FileExplorerItem> getFileExplorerItemsByRoomAndOwner(Long roomId, Long ownerId) {
log.debug(".getFileExplorerItemsByRoomAndOwner() started");
try {
- String hql = "SELECT c FROM FileExplorerItem c "
- + "WHERE c.deleted <> :deleted "
- + "AND c.room_id = :room_id " + "AND c.ownerId = :ownerId "
- + "ORDER BY c.isFolder DESC, c.fileName ";
-
- TypedQuery<FileExplorerItem> query = em.createQuery(hql, FileExplorerItem.class);
- query.setParameter("deleted", true);
- query.setParameter("room_id",room_id);
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFilesByRoomAndOwner", FileExplorerItem.class);
+ query.setParameter("roomId",roomId);
query.setParameter("ownerId",ownerId);
List<FileExplorerItem> fileExplorerList = query.getResultList();
@@ -119,84 +125,34 @@ public class FileExplorerItemDao {
return null;
}
- public FileExplorerItem[] getFileExplorerItemsByRoom(Long room_id,
- Long parentFileExplorerItemId) {
- log.debug("getFileExplorerItemsByRoom room_id :: "+room_id);
- try {
-
- String hql = "SELECT c FROM FileExplorerItem c " +
- "WHERE c.deleted <> :deleted " +
- "AND c.room_id = :room_id " +
- "AND c.ownerId IS NULL " +
- "AND c.parentFileExplorerItemId = :parentFileExplorerItemId " +
- "ORDER BY c.isFolder DESC, c.fileName ";
-
- TypedQuery<FileExplorerItem> query = em.createQuery(hql, FileExplorerItem.class);
- query.setParameter("deleted", true);
- query.setParameter("room_id",room_id);
- query.setParameter("parentFileExplorerItemId", parentFileExplorerItemId);
-
- FileExplorerItem[] fileExplorerList = query.getResultList().toArray(new FileExplorerItem[0]);
-
- return fileExplorerList;
- } catch (Exception ex2) {
- log.error("[getFileExplorerRootItemsByRoom]: ", ex2);
- }
- return null;
+ public List<FileExplorerItem> getByRoom(Long roomId) {
+ log.debug("getFileExplorerItemsByRoom roomId :: "+roomId);
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFilesByRoom", FileExplorerItem.class);
+ query.setParameter("roomId",roomId);
+
+ return query.getResultList();
}
- public FileExplorerItem[] getFileExplorerItemsByOwner(Long ownerId,
- Long parentFileExplorerItemId) {
+ public List<FileExplorerItem> getByOwner(Long ownerId) {
log.debug(".getFileExplorerItemsByOwner() started");
- try {
-
- String hql = "SELECT c FROM FileExplorerItem c "
- + "WHERE c.deleted <> :deleted "
- + "AND c.ownerId = :ownerId "
- + "AND c.parentFileExplorerItemId = :parentFileExplorerItemId "
- + "ORDER BY c.isFolder DESC, c.fileName ";
-
- TypedQuery<FileExplorerItem> query = em.createQuery(hql, FileExplorerItem.class);
- query.setParameter("deleted", true);
- query.setParameter("ownerId",ownerId);
- query.setParameter("parentFileExplorerItemId", parentFileExplorerItemId);
-
- FileExplorerItem[] fileExplorerList = query.getResultList().toArray(new FileExplorerItem[0]);
-
- return fileExplorerList;
- } catch (Exception ex2) {
- log.error("[getFileExplorerRootItemsByOwner]: ", ex2);
- }
- return null;
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFilesByOwner", FileExplorerItem.class);
+ query.setParameter("ownerId",ownerId);
+
+ return query.getResultList();
}
- public FileExplorerItem[] getFileExplorerItemsByParent(
- Long parentFileExplorerItemId) {
+ public List<FileExplorerItem> getByParent(Long parentId) {
log.debug(".getFileExplorerItemsByParent() started");
- try {
-
- String hql = "SELECT c FROM FileExplorerItem c "
- + "WHERE c.deleted <> :deleted "
- + "AND c.parentFileExplorerItemId = :parentFileExplorerItemId "
- + "ORDER BY c.isFolder DESC, c.fileName ";
-
- TypedQuery<FileExplorerItem> query = em.createQuery(hql, FileExplorerItem.class);
- query.setParameter("deleted", true);
- query.setParameter("parentFileExplorerItemId", parentFileExplorerItemId);
-
- FileExplorerItem[] fileExplorerList = query.getResultList().toArray(new FileExplorerItem[0]);
-
- return fileExplorerList;
- } catch (Exception ex2) {
- log.error("[getFileExplorerRootItemsByOwner]: ", ex2);
- }
- return null;
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFilesByParent", FileExplorerItem.class);
+ query.setParameter("parentItemId", parentId);
+
+ return query.getResultList();
}
public FileExplorerItem getFileExplorerItemsByHash(String hash) {
try {
- TypedQuery<FileExplorerItem> query = em.createNamedQuery("getByHash", FileExplorerItem.class);
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFileByHash", FileExplorerItem.class);
query.setParameter("fileHash", hash);
FileExplorerItem fileExplorerList = null;
@@ -212,11 +168,11 @@ public class FileExplorerItemDao {
return null;
}
- public FileExplorerItem getFileExplorerItemsById(Long fileExplorerItemId) {
+ public FileExplorerItem get(Long fileId) {
try {
- TypedQuery<FileExplorerItem> query = em.createNamedQuery("getById", FileExplorerItem.class);
- query.setParameter("fileExplorerItemId", fileExplorerItemId);
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFileById", FileExplorerItem.class);
+ query.setParameter("id", fileId);
FileExplorerItem fileExplorerList = null;
try {
@@ -235,12 +191,7 @@ public class FileExplorerItemDao {
log.debug(".getFileExplorerItemsByExternalIdAndType() started");
try {
-
- String hql = "SELECT c FROM FileExplorerItem c "
- + "WHERE c.externalFileId = :externalFileId " +
- "AND c.externalType LIKE :externalType";
-
- TypedQuery<FileExplorerItem> query = em.createQuery(hql, FileExplorerItem.class);
+ TypedQuery<FileExplorerItem> query = em.createNamedQuery("getFileExternal", FileExplorerItem.class);
query.setParameter("externalFileId", externalFileId);
query.setParameter("externalType", externalType);
@@ -273,29 +224,18 @@ public class FileExplorerItemDao {
}
/**
- * @param fileExplorerItemId
+ * @param fileId
*/
- public void deleteFileExplorerItem(Long fileExplorerItemId) {
- log.debug(".deleteFileExplorerItem() started");
-
- try {
-
- FileExplorerItem fId = this
- .getFileExplorerItemsById(fileExplorerItemId);
-
- fId.setDeleted(true);
- fId.setUpdated(new Date());
+ public void delete(Long fileId) {
+ log.debug(".delete() started");
+ delete(get(fileId));
+ }
+
+ public void delete(FileExplorerItem f) {
+ f.setDeleted(true);
+ f.setUpdated(new Date());
- if (fId.getFileExplorerItemId() == 0) {
- em.persist(fId);
- } else {
- if (!em.contains(fId)) {
- em.merge(fId);
- }
- }
- } catch (Exception ex2) {
- log.error("[deleteFileExplorerItem]: ", ex2);
- }
+ update(f);
}
public void deleteFileExplorerItemByExternalIdAndType(Long externalFilesid, String externalType) {
@@ -303,8 +243,7 @@ public class FileExplorerItemDao {
try {
- FileExplorerItem fId = this
- .getFileExplorerItemsByExternalIdAndType(externalFilesid, externalType);
+ FileExplorerItem fId = getFileExplorerItemsByExternalIdAndType(externalFilesid, externalType);
if (fId == null) {
throw new Exception("externalFilesid: "+externalFilesid+" and externalType: "+externalType+" Not found");
@@ -313,86 +252,66 @@ public class FileExplorerItemDao {
fId.setDeleted(true);
fId.setUpdated(new Date());
- if (fId.getFileExplorerItemId() == 0) {
- em.persist(fId);
- } else {
- if (!em.contains(fId)) {
- em.merge(fId);
- }
- }
+ update(fId);
} catch (Exception ex2) {
log.error("[deleteFileExplorerItemByExternalIdAndType]: ", ex2);
}
}
/**
- * @param fileExplorerItemId
+ * @param fileId
* @param fileName
*/
- public void updateFileOrFolderName(Long fileExplorerItemId, String fileName) {
+ public void updateFileOrFolderName(Long fileId, String fileName) {
log.debug(".updateFileOrFolderName() started");
try {
- FileExplorerItem fId = this
- .getFileExplorerItemsById(fileExplorerItemId);
+ FileExplorerItem fId = get(fileId);
fId.setFileName(fileName);
fId.setUpdated(new Date());
- if (fId.getFileExplorerItemId() == 0) {
- em.persist(fId);
- } else {
- if (!em.contains(fId)) {
- em.merge(fId);
- }
- }
+ update(fId);
} catch (Exception ex2) {
log.error("[updateFileOrFolderName]: ", ex2);
}
}
- public void updateFileOrFolder(FileExplorerItem fId) {
- log.debug(".updateFileOrFolder() started");
- try {
- // fId.setUpdated(new Date());
+ public FileExplorerItem update(FileExplorerItem f) {
+ // fId.setUpdated(new Date());
- if (fId.getFileExplorerItemId() == 0) {
- em.persist(fId);
- } else {
- if (!em.contains(fId)) {
- em.merge(fId);
- }
- }
- } catch (Exception ex2) {
- log.error("[updateFileOrFolder]: ", ex2);
- }
+ if (f.getId() == null) {
+ em.persist(f);
+ } else {
+ if (!em.contains(f)) {
+ f = em.merge(f);
+ }
+ }
+ return f;
}
/**
- * @param fileExplorerItemId
+ * @param fileId
* @param newParentFileExplorerItemId
* @param isOwner
*/
- public void moveFile(Long fileExplorerItemId,
- Long parentFileExplorerItemId, Long room_id, Boolean isOwner,
- Long ownerId) {
+ public void moveFile(Long fileId, Long parentId, Long roomId, Boolean isOwner, Long ownerId) {
log.debug(".moveFile() started");
try {
- FileExplorerItem fId = this
- .getFileExplorerItemsById(fileExplorerItemId);
+ FileExplorerItem fId = get(fileId);
- fId.setParentFileExplorerItemId(parentFileExplorerItemId);
+ fId.setParentItemId(parentId);
- if (parentFileExplorerItemId == 0) {
+ if (parentId == 0) {
if (isOwner) {
// move to personal Folder
fId.setOwnerId(ownerId);
} else {
// move to public room folder
fId.setOwnerId(null);
- fId.setRoom_id(room_id);
+ fId.setRoomId(roomId);
}
} else {
fId.setOwnerId(null);
@@ -400,7 +319,7 @@ public class FileExplorerItemDao {
fId.setUpdated(new Date());
- if (fId.getFileExplorerItemId() == 0) {
+ if (fId.getId() == null) {
em.persist(fId);
} else {
if (!em.contains(fId)) {
Modified: openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/log/ConferenceLogDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/log/ConferenceLogDao.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/log/ConferenceLogDao.java (original)
+++ openmeetings/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/log/ConferenceLogDao.java Fri Nov 6 06:18:44 2015
@@ -24,11 +24,10 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.openmeetings.db.entity.log.ConferenceLog;
-import org.apache.openmeetings.db.entity.log.ConferenceLogType;
+import org.apache.openmeetings.db.entity.log.ConferenceLog.Type;
import org.apache.openmeetings.util.OpenmeetingsVariables;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@@ -37,37 +36,21 @@ public class ConferenceLogDao {
private static final Logger log = Red5LoggerFactory.getLogger(ConferenceLogDao.class, OpenmeetingsVariables.webAppRootKey);
@PersistenceContext
private EntityManager em;
- @Autowired
- private ConferenceLogTypeDao conferenceLogTypeDao;
- public Long addConferenceLog(String eventType, Long userId, String streamid,
- Long room_id, String userip, String scopeName,
- String externalUserId, String externalUserType, String email,
- String firstname, String lastname) {
+ public Long addConferenceLog(Type type, Long userId, String streamid, Long roomId, String userip, String scopeName) {
try {
- ConferenceLogType confLogType = conferenceLogTypeDao.getConferenceLogTypeByEventName(eventType);
- if (confLogType == null) {
- conferenceLogTypeDao.addConferenceLogType(eventType);
- confLogType = conferenceLogTypeDao.getConferenceLogTypeByEventName(eventType);
- }
-
ConferenceLog confLog = new ConferenceLog();
- confLog.setConferenceLogType(confLogType);
+ confLog.setType(type);
confLog.setInserted(new Date());
confLog.setUserId(userId);
confLog.setStreamid(streamid);
confLog.setScopeName(scopeName);
- confLog.setRoom_id(room_id);
+ confLog.setRoomId(roomId);
confLog.setUserip(userip);
- confLog.setExternalUserId(externalUserId);
- confLog.setExternalUserType(externalUserType);
- confLog.setFirstname(firstname);
- confLog.setLastname(lastname);
- confLog.setEmail(email);
confLog = em.merge(confLog);
- Long confLogId = confLog.getConferenceLogId();
+ Long confLogId = confLog.getId();
return confLogId;
} catch (Exception ex2) {