use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class BackupImport method importRooms.
/*
* ##################### Import Rooms
*/
private void importRooms(File f) throws Exception {
log.info("Users import complete, starting room import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
RegistryMatcher matcher = new RegistryMatcher();
Serializer ser = new Persister(strategy, matcher);
matcher.bind(Long.class, LongTransform.class);
matcher.bind(Integer.class, IntegerTransform.class);
registry.bind(User.class, new UserConverter(userDao, userMap));
registry.bind(Room.Type.class, RoomTypeConverter.class);
registry.bind(Date.class, DateConverter.class);
List<Room> list = readList(ser, f, "rooms.xml", "rooms", Room.class);
for (Room r : list) {
Long roomId = r.getId();
// We need to reset ids as openJPA reject to store them otherwise
r.setId(null);
if (r.getModerators() != null) {
for (Iterator<RoomModerator> i = r.getModerators().iterator(); i.hasNext(); ) {
RoomModerator rm = i.next();
if (rm.getUser().getId() == null) {
i.remove();
}
}
}
r = roomDao.update(r, null);
roomMap.put(roomId, r.getId());
}
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class IcalUtils method createDefaultRoom.
private static Room createDefaultRoom() {
Room r = new Room();
r.setAppointment(true);
if (r.getType() == null) {
r.setType(Room.Type.conference);
}
return r;
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class RecordingExpiringTemplate method getSubjectFragment.
@Override
Fragment getSubjectFragment() {
Fragment f = new Fragment(COMP_ID, "subject", this);
Room room = roomDao.get(rec.getRoomId());
f.add(new OmTextLabel("prefix", getString("template.recording.expiring.subj.prefix", locale)), new OmTextLabel("room", room == null ? null : getString("template.recording.expiring.subj.room", locale, room.getName())).setVisible(room != null));
return f;
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class RoomWebService method counters.
/**
* Returns current users for rooms ids
*
* @param sid - The SID of the User. This SID must be marked as Loggedin
* @param ids - id of the room you need counters for
* @return - current users for rooms ids
*/
@WebMethod
@GET
@Path("/counters")
public List<RoomCountDTO> counters(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "id") @QueryParam("id") List<Long> ids) {
return performCall(sid, User.Right.Soap, sd -> {
List<RoomCountDTO> roomBeans = new ArrayList<>();
List<Room> rooms = roomDao.get(ids);
for (Room room : rooms) {
RoomCountDTO rCountBean = new RoomCountDTO();
rCountBean.setRoomId(room.getId());
rCountBean.setRoomName(room.getName());
rCountBean.setMaxUser(room.getCapacity());
rCountBean.setRoomCount(clientManager.listByRoom(room.getId()).size());
roomBeans.add(rCountBean);
}
return roomBeans;
});
}
use of org.apache.openmeetings.db.entity.room.Room in project openmeetings by apache.
the class RoomWebService method getExternal.
/**
* Checks if a room with this exteralRoomId + externalRoomType does exist,
* if yes it returns the room id if not, it will create the room and then
* return the room id of the newly created room
*
* @param sid
* The SID of the User. This SID must be marked as Loggedin
* @param type
* type of the room
* @param externalType
* you can specify your system-name or type of room here, for
* example "moodle"
* @param externalId
* your external room id may set here
* @param room
* details of the room to be created if not found
*
* @return - id of the room or error code
*/
@WebMethod
@GET
@Path("/{type}/{externaltype}/{externaliId}")
public RoomDTO getExternal(@WebParam(name = "sid") @QueryParam("sid") String sid, @PathParam("type") @WebParam(name = "type") String type, @PathParam("externaltype") @WebParam(name = "externaltype") String externalType, @PathParam("externalid") @WebParam(name = "externalid") String externalId, @WebParam(name = "room") @QueryParam("room") RoomDTO room) {
return performCall(sid, User.Right.Soap, sd -> {
Room r = roomDao.getExternal(Room.Type.valueOf(type), externalType, externalId);
if (r == null) {
if (room == null) {
return null;
} else {
r = room.get(fileDao);
r.setExternalType(externalType);
r.setExternalId(externalId);
r = updateRtoRoom(r, sd.getUserId());
return new RoomDTO(r);
}
} else {
return new RoomDTO(r);
}
});
}
Aggregations