public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Parameter param; try { String paramName = request.getParameter(PARAM_NAME); param = paramDao.getParemeter(paramName); response.getWriter().append(param.toString()); } catch (SQLException e) { e.printStackTrace(); response.getWriter().append("Error while serving at: ").append(request.getContextPath()); } }
private Parameter getParameterWithoutValue(String name) throws SQLException { String getParameterQuery = parser.getParameterQuery(name); ResultSet result = executeQuery(getParameterQuery); String type = result.getString("type").trim(); String description = result.getString("description").trim(); String category = result.getString("category").trim(); statement.close(); Parameter param = ParameterFactory.createParameter(type); param.setName(name); param.setDescription(description); param.setCategory(category); return param; }
private Object getParameterValue(Parameter param) throws SQLException { String getParamValueQuery = parser.getParameterValueQuery(param); String type = param.getType(); ResultSet result = executeQuery(getParamValueQuery); return parseResultValue(type, result); }
public Parameter getParemeter(String name) throws SQLException { Parameter param = getParameterWithoutValue(name); Object paramValue = getParameterValue(param); param.setValue(paramValue); return param; }