log.debug("addRoom");
try {
if (AuthLevelmanagement.getInstance().checkAdminLevel(user_level)){
Rooms r = new Rooms();
r.setName(name);
r.setComment(comment);
r.setStarttime(new Date());
r.setNumberOfPartizipants(numberOfPartizipants);
r.setRoomtype(this.getRoomTypesById(roomtypes_id));
r.setIspublic(ispublic);
r.setAllowUserQuestions(allowUserQuestions);
r.setIsAudioOnly(isAudioOnly);
r.setAppointment(appointment);
r.setIsDemoRoom(isDemoRoom);
r.setDemoTime(demoTime);
r.setIsModeratedRoom(isModeratedRoom);
r.setHideTopBar(hideTopBar);
r.setDeleted("false");
r.setIsClosed(isClosed);
r.setRedirectURL(redirectURL);
r.setSipNumber(sipNumber);
r.setConferencePin(conferencePin);
r.setOwnerId(ownerId);
r.setWaitForRecording(waitForRecording);
r.setAllowRecording(allowRecording);
//handle SIP Issues
OpenXGReturnObject openXGReturnObject = OpenXGHttpClient.getInstance().openSIPgCreateConference();
if (openXGReturnObject != null) {
r.setSipNumber(openXGReturnObject.getConferenceNumber());
r.setConferencePin(openXGReturnObject.getConferencePin());
}
Object idf = PersistenceSessionUtil.createSession();
EntityManager session = PersistenceSessionUtil.getSession();
EntityTransaction tx = session.getTransaction();
tx.begin();
r = session.merge(r);
session.flush();
long returnId = r.getRooms_id();
tx.commit();
PersistenceSessionUtil.closeSession(idf);
if (organisations!=null){
Long t = this.updateRoomOrganisations(organisations, r);
if (t==null) return null;
}
if (roomModerators!=null) {
RoomModeratorsDaoImpl.getInstance().addRoomModeratorByUserList(roomModerators, r.getRooms_id());
}
return returnId;
}
} catch (Exception ex2) {