@Override
	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
		DatabaseManager manager=DatabaseManager.getManager();
		
		try {
			Equipment equipment = manager.getEquipmentDao().queryForId(
					Integer.parseInt(request.getParameter(ID)));
			
			if(equipment==null){
				ServletResult.sendResult(response, ServletResult.NOT_FOUND);
				return;
			}
			
			String title=request.getParameter(Equipment.TITLE);
			String masterRoom=request.getParameter(Equipment.MULTIPURPOSE_ROOM);
			String description=request.getParameter(Equipment.DESCRIPTION);
			String available=request.getParameter(Equipment.AVAILABLE);
			
			if(!MyServlet.isEmpty(title)){
				equipment.setTitle(title);
			}
			
			if(!MyServlet.isEmpty(masterRoom)){
				MultipurposeRoom room=manager.getMultipurposeRoomDao().queryForId(
						Integer.parseInt(masterRoom));
				
				if(room==null){
					ServletResult.sendResult(response, ServletResult.NOT_FOUND);
					return;
				}
				
				equipment.setRoom(room);
			}
			
			if(!MyServlet.isEmpty(description)){
				equipment.setDescription(description);
			}
			
			if(!MyServlet.isEmpty(available)){
				equipment.setAvailable(Boolean.parseBoolean(available));
			}
			
			ServletResult.sendResult(response, 
					manager.getEquipmentDao().update(equipment)==1 ?
							ServletResult.SUCCESS
							: ServletResult.ERROR);
			
		} catch (NumberFormatException e) {
			e.printStackTrace();
			ServletResult.sendResult(response, ServletResult.BAD_NUMBER_FORMAT);
		} catch (SQLException e) {
			e.printStackTrace();
			ServletResult.sendResult(response, ServletResult.ERROR);
		}
	}