@Override
	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
		try {
			String title=request.getParameter(Room.TITLE);
			int masterRoom=Integer.parseInt(request.getParameter(Room.MULTIPURPOSE_ROOM));
			int capacity=Integer.parseInt(request.getParameter(Room.CAPACITY));
			
			DatabaseManager manager=DatabaseManager.getManager();
			
			MultipurposeRoom multipurposeRoom=manager.getMultipurposeRoomDao().queryForId(masterRoom);
		
			if(multipurposeRoom==null){
				ServletResult.sendResult(response, ServletResult.NOT_FOUND);
				return;
			}
			
			Room room=new Room();
			room.setRoom(multipurposeRoom);
			room.setCapacity(capacity);
			if(!MyServlet.isEmpty(title)) room.setTitle(title);
			
			if(manager.getRoomDao().create(room)==1){
				ServletResult.sendResult(response, new CreateResult(
						ServletResult.SUCCESS, room.getId()));
				
				response.setStatus(HttpServletResponse.SC_CREATED);
			}
			else{
				ServletResult.sendResult(response, ServletResult.ERROR);
			}
			
		} catch (NumberFormatException e) {
			e.printStackTrace();
			ServletResult.sendResult(response, ServletResult.BAD_NUMBER_FORMAT);
		} catch (SQLException e) {
			e.printStackTrace();
			ServletResult.sendResult(response, ServletResult.ERROR);
		}
	}