Example usage for org.json.simple JSONArray clone

List of usage examples for org.json.simple JSONArray clone

Introduction

In this page you can find the example usage for org.json.simple JSONArray clone.

Prototype

public Object clone() 

Source Link

Document

Returns a shallow copy of this ArrayList instance.

Usage

From source file:modelo.ProcesoVertimientosManagers.VerificacionInfoCaracterizacion.java

public JSONArray getVerificacionInfoCaracterizacion(Integer codigoProceso, Integer tipoInforme)
        throws SQLException {

    ResultSet rset = null;//  www. jav a 2 s  . c o  m
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    JSONArray jsonArrayPreguntas = new JSONArray();

    //Se crea el objeto
    SeleccionarVerificacionInfoCaracterizacion select = new SeleccionarVerificacionInfoCaracterizacion(
            codigoProceso, tipoInforme);

    //Seleccionamos los "Hijos" y  "Nietos" del requisito "Padre"
    rset = select.getVerificaciones();

    while (rset.next()) {

        jsonObject.put("codigo", rset.getString("CODIGO"));
        jsonObject.put("reguisito", rset.getString("DESCRIPCION"));
        jsonObject.put("fk_informe", rset.getString("FK_TIPO_INFORME"));
        jsonObject.put("checkeado", rset.getString("TIENE"));

        jsonArray.add(jsonObject.clone());

    }

    jsonArrayPreguntas.add(jsonArray.clone());

    //Se cierra el ResultSet
    rset.close();
    select.desconectar();

    return jsonArrayPreguntas;
}

From source file:modelo.AutenticacionManager.PermisosAcceso.java

public JSONArray SeleccionarPermisos(String rol) throws SQLException {

    JSONArray permisos = new JSONArray();
    JSONArray ArrayPantallas = new JSONArray();
    JSONObject modulos = new JSONObject();
    JSONObject pantallas = new JSONObject();
    Boolean flag = true;//  ww w .  ja  v  a2s.  c  o  m
    String modulo = "";
    String codigo_modulo = "";
    SeleccionarPermisos select = new SeleccionarPermisos();

    ResultSet result = select.getModulos();

    while (result.next()) {

        modulo = result.getString("VAR_MODULO");
        codigo_modulo = result.getString("PK_CODIGO");
        modulos.put("modulo", modulo);

        ResultSet rstPantallas = select.getPantallas(rol, codigo_modulo);

        while (rstPantallas.next()) {

            pantallas.put("codigo", rstPantallas.getString("PK_CODIGO"));
            pantallas.put("jsp", rstPantallas.getString("VAR_PANTALLA"));
            pantallas.put("pantalla", rstPantallas.getString("VAR_DESCRIPCION"));
            pantallas.put("existe", rstPantallas.getString("EXISTE"));

            ArrayPantallas.add(pantallas.clone());
            pantallas.clear();
        }

        modulos.put("pantallas", ArrayPantallas.clone());
        ArrayPantallas.clear();
        permisos.add(modulos.clone());
    }

    select.desconectar();
    return permisos;
}