List of usage examples for org.json.simple JSONObject put
V put(K key, V value);
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerTotalConvocatorias(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerTotalConvocatorias(); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("total", numC); out.print(obj);//from www. ja v a2 s. c om }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerTotalTalleres(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerTotalTalleres(); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("total", numC); out.print(obj);//w w w. j ava 2s .c om }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerInscritosConv(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerInscritosConv(Integer.parseInt(request.getParameter("1"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("inscritos", numC); out.print(obj);//from w w w . j ava 2 s . co m }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerInscritosTaller(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerInscritosTaller(Integer.parseInt(request.getParameter("1"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("inscritos", numC); out.print(obj);/* w ww. j a v a2 s .co m*/ }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void isInscritoTaller(HttpServletRequest request, HttpServletResponse response) throws IOException { boolean b = CtrlUsuario.isInscritoTaller(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("is", b); out.print(obj);/*from w w w.ja v a2 s . c om*/ }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void isInscritoconvocatoria(HttpServletRequest request, HttpServletResponse response) throws IOException { boolean b = CtrlUsuario.isInscritoconvocatoria(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("is", b); out.print(obj);/* w ww .ja v a2 s . c o m*/ }
From source file:cat.tv3.eng.rec.recomana.lupa.visualization.ClustersToJson.java
public static JSONArray hashToJSONArrayRepresentationBinaryTree(String id, String hash, Jedis jedis, String id2, String hash2) {//from w w w . j a v a 2 s .c o m JSONArray result = new JSONArray(); JSONObject info; Map<String, String> attr_cluster = jedis.hgetAll(hash); String cluster_name = attr_cluster.get("cluster_ids_name"); if (!cluster_name.equals("cluster_splited")) { info = new JSONObject(); info.put("name", "Centroid " + id); String[] instance_group_keys = jedis.keys("Instances_centroid_ID_" + id).toArray(new String[0]); info.put("children", fullestoArray(instance_group_keys, jedis)); } else { String id_left_centroid = attr_cluster.get("id_left_centroid"); String id_right_centroid = attr_cluster.get("id_right_centroid"); String hash_left = attr_cluster.get("hash_left"); String hash_right = attr_cluster.get("hash_right"); info = new JSONObject(); info.put("name", "Centroid " + id); info.put("children", hashToJSONArrayRepresentationBinaryTree(id_left_centroid, hash_left, jedis, id_right_centroid, hash_right)); } result.add(info); attr_cluster = jedis.hgetAll(hash2); cluster_name = attr_cluster.get("cluster_ids_name"); if (!cluster_name.equals("cluster_splited")) { info = new JSONObject(); info.put("name", "Centroid " + id2); String[] instance_group_keys = jedis.keys("Instances_centroid_ID_" + id2).toArray(new String[0]); info.put("children", fullestoArray(instance_group_keys, jedis)); } else { String id_left_centroid = attr_cluster.get("id_left_centroid"); String id_right_centroid = attr_cluster.get("id_right_centroid"); String hash_left = attr_cluster.get("hash_left"); String hash_right = attr_cluster.get("hash_right"); info = new JSONObject(); info.put("name", "Centroid " + id2); info.put("children", hashToJSONArrayRepresentationBinaryTree(id_left_centroid, hash_left, jedis, id_right_centroid, hash_right)); } result.add(info); return result; }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void leerMultiplesConvocatorias(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<ConvocatoriaEntity> convocatorias = new ArrayList<>(); convocatorias = CtrlUsuario.leerMultiplesConvocatorias(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); // tamao y posicin response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONArray list1 = new JSONArray(); for (ConvocatoriaEntity convocatoria : convocatorias) { JSONObject obj = new JSONObject(); obj.put("id", convocatoria.getIdConvocatoria()); obj.put("titulo", convocatoria.getNombre()); list1.add(obj);/*from ww w. ja v a 2 s .c o m*/ } out.print(list1); }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void leerMultiplesTalleres(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<TallerEntity> talleres = new ArrayList<>(); talleres = CtrlUsuario.leerMultiplesTalleres(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); // posicin y tamao response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); System.out.println("Talleres: " + talleres.size()); JSONArray list1 = new JSONArray(); for (TallerEntity taller : talleres) { JSONObject obj = new JSONObject(); obj.put("id", taller.getIdTaller()); obj.put("titulo", taller.getNombre()); list1.add(obj);/* w w w .j a v a 2 s.co m*/ } out.print(list1); }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void registrarUsuarioTaller(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList r = CtrlUsuario.registrarATallerUsuario(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); // parameter 1: idUsuario param2: idTaller response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); if (r.get(0) == "error") { JSONObject obj = new JSONObject(); obj.put("isError", true); obj.put("errorDescrip", r.get(1)); out.print(obj);//from w w w. j a v a 2s.co m } else if (r.get(0) == "isExitoso") { JSONObject obj = new JSONObject(); obj.put("Exitoso", true); out.print(obj); } else { Util.errordeRespuesta(r, out); } }