Example usage for org.json.simple JSONObject clone

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

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
protected native Object clone() throws CloneNotSupportedException;

Source Link

Document

Creates and returns a copy of this object.

Usage

From source file:modelo.ParametrizacionManagers.TiposContactos.java

/**
* SELECT// w w  w  .  j a va  2s. com
* Obtiene la informacion de una unidad de medida y
* guarda todo en un JSONArray para entregarselo a la vista.
* 
* @return JSONArray
* @throws SQLException 
*/

public JSONArray getTiposContactos(String descripcion) throws Exception {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarTiposContactos seleccionar = new SeleccionarTiposContactos();
    ResultSet rst = seleccionar.getTiposContactos(descripcion);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    JSONArray jsonArreglo = new JSONArray();

    while (rst.next()) {
        //Creamos el objecto JSON
        jsonObject.put("descripcion", rst.getString("DESCRIPCION"));
        jsonObject.put("codigo", rst.getString("CODIGO"));

        //Creamos el Array JSON
        jsonArray.add(jsonObject.clone());

    }

    jsonArreglo.add(jsonArray);
    seleccionar.desconectar();
    return jsonArreglo;

}

From source file:modelo.ParametrizacionManagers.MotivosVisitas.java

/**
* SELECT// w ww . j  a va  2s .  c  o  m
* Obtiene la informacion de una unidad de medida y
* guarda todo en un JSONArray para entregarselo a la vista.
* 
* @return JSONArray
* @throws SQLException 
*/

public JSONArray getMotivosVisitas(String descripcion) throws Exception {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarMotivosVisitas seleccionar = new SeleccionarMotivosVisitas();
    ResultSet rst = seleccionar.getMotivosVisitas(descripcion);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    JSONArray jsonArreglo = new JSONArray();

    while (rst.next()) {
        //Creamos el objecto JSON
        jsonObject.put("descripcion", rst.getString("DESCRIPCION"));
        jsonObject.put("codigo", rst.getString("CODIGO"));

        //Creamos el Array JSON
        jsonArray.add(jsonObject.clone());

    }

    seleccionar.desconectar();
    jsonArreglo.add(jsonArray);

    return jsonArreglo;

}

From source file:modelo.UsuariosManagers.Usuarios.java

public JSONArray seleccionarUsuarios(String usuario, String rol, String codigo) throws SQLException {

    SeleccionarUsuarios select = new SeleccionarUsuarios();

    ResultSet rset = select.getUsuarios(usuario, rol, codigo);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONArray jsonArreglo = new JSONArray();
    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos en el JSONArray.
    while (rset.next()) {
        //Armamos el objeto JSON con la informacion del registro
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("codigo", rset.getInt("PK_CODIGO"));
        jsonObject.put("descripcion", rset.getString("VAR_USUARIO"));
        jsonObject.put("rol", rset.getString("VAR_ROL"));
        jsonObject.put("idRol", rset.getInt("FK_ROL"));
        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());
    }//w  w w  .j a  v  a 2 s . c  o  m

    select.desconectar();
    jsonArreglo.add(jsonArray);
    return jsonArreglo;

}

From source file:modelo.ParametrizacionManagers.Tarifas.java

/**
 * //from w ww  .j a  va2  s . c o m
 * Obtiene la informacion de las unidades de medida y
 * guarda todo en un JSONArray para entregarselo a la vista.
 * 
 * @return JSONArray
 * @throws SQLException 
 */
public JSONArray getTarifas() throws SQLException {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarTarifas select = new SeleccionarTarifas();
    ResultSet rset = select.getTarifas();

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONArray jsonArreglo = new JSONArray();
    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    while (rset.next()) {

        //Armamos el objeto JSON con la informacion del registro
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("codigo", rset.getString("CODIGO"));
        jsonObject.put("valor", rset.getString("VALOR"));
        jsonObject.put("codParm", rset.getString("FK_PARAMFISICOQUIMICO"));
        jsonObject.put("descpParm", rset.getString("DESPARM"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());

    }
    select.desconectar();
    jsonArreglo.add(jsonArray);

    return jsonArreglo;

}

From source file:modelo.ParametrizacionManagers.TiposInformeVertimientos.java

/**
* SELECT/* www. j  a  va 2  s.  c  o  m*/
* Obtiene la informacion de una unidad de medida y
* guarda todo en un JSONArray para entregarselo a la vista.
* 
* @return JSONArray
* @throws SQLException 
*/

public JSONArray getTiposInformes(String descripcion) throws Exception {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarTiposInformesVertimiento seleccionar = new SeleccionarTiposInformesVertimiento();
    ResultSet rst = seleccionar.getTiposInformes(descripcion);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONObject jsonObject = new JSONObject();
    JSONArray jsonArreglo = new JSONArray();

    while (rst.next()) {
        //Creamos el objecto JSON
        jsonObject.put("descripcion", rst.getString("DESCRIPCION"));
        jsonObject.put("codigo", rst.getString("CODIGO"));

        //Creamos el Array JSON
        jsonArray.add(jsonObject.clone());

    }

    jsonArreglo.add(jsonArray);
    seleccionar.desconectar();
    return jsonArreglo;

}

From source file:modelo.ParametrizacionManagers.Tarifas.java

/**
  * //from w w  w. j  av  a  2 s . c o m
  * Obtiene la informacion de una unidad de medida y
  * guarda todo en un JSONArray para entregarselo a la vista.
  * 
  * @return JSONArray
  * @throws SQLException 
  */
public JSONArray getTarifa(int codigo) throws SQLException {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarTarifas select = new SeleccionarTarifas();
    ResultSet rset = select.getTarifa(codigo);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();

    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    while (rset.next()) {
        JSONObject jsonObject = new JSONObject();
        //Armamos el objeto JSON con la informacion del registro
        jsonObject.put("codigo", rset.getString("CODIGO"));
        jsonObject.put("valor", rset.getString("VALOR"));
        jsonObject.put("codParm", rset.getString("FK_PARAMFISICOQUIMICO"));
        jsonObject.put("descpParm", rset.getString("DESPARM"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());

    }

    select.desconectar();
    return jsonArray;

}

From source file:modelo.ParametrizacionManagers.DocumentacionRequerida.java

/**
  * //from  www.j  a v  a2 s .co m
  * Obtiene la informacion de un documento requerido y
  * guarda todo en un JSONArray para entregarselo a la vista.
  * 
  * @param codigo
  * @param tipoInforme
  * @return JSONArray
  * @throws SQLException 
  */
public JSONArray getDocumentacionRequerida(Integer codigo, Integer tipoInforme) throws SQLException {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarDocumentacionRequerida select = new SeleccionarDocumentacionRequerida();
    ResultSet rset = select.getDocumentacionRequerida(codigo, tipoInforme);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();

    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    while (rset.next()) {

        //Armamos el objeto JSON con la informacion del registro
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("codigo", rset.getString("CODIGO"));
        jsonObject.put("descripcion", rset.getString("DESCRIPCION"));
        jsonObject.put("tipoInforme", rset.getString("TIPO_INFORME"));
        jsonObject.put("codTipoInforme", rset.getString("COD_TIPO_INFORME"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());

    }

    select.desconectar();
    return jsonArray;

}

From source file:modelo.ParametrizacionManagers.DocumentacionRequerida.java

/**
 * /*from  w ww .  j  a va  2s .  com*/
 * Obtiene la informacion de la documentacion requerida y
 * guarda todo en un JSONArray para entregarselo a la vista.
 * 
 * @return JSONArray
 * @throws SQLException 
 */
public JSONArray getDocumentacionRequerida(String descripcion, String tipoInforme) throws SQLException {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarDocumentacionRequerida select = new SeleccionarDocumentacionRequerida();
    ResultSet rset = select.getDocumentacionRequeridas(descripcion, tipoInforme);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONArray jsonArreglo = new JSONArray();
    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    while (rset.next()) {

        //Armamos el objeto JSON con la informacion del registro
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("codigo", rset.getString("CODIGO"));
        jsonObject.put("descripcion", rset.getString("DESCRIPCION"));
        jsonObject.put("tipoInforme", rset.getString("TIPO_INFORME"));
        jsonObject.put("codTipoInforme", rset.getString("COD_TIPO_INFORME"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());

    }

    jsonArreglo.add(jsonArray);
    select.desconectar();
    return jsonArreglo;

}

From source file:modelo.ProcesoVertimientosManagers.ProgramarMonitoreo.java

public JSONArray obtenerPuntosMonitoreo(String puntoMonitoreo) throws Exception {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarMonitoreos select = new SeleccionarMonitoreos();
    ResultSet rset = select.obtenerPuntosMonitoreo(puntoMonitoreo);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();
    JSONArray jsonArreglo = new JSONArray();

    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    while (rset.next()) {

        //Armamos el objeto JSON con la informacion del registro
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("actividadEconomica", rset.getString("FK_ACTIVIDAD_ECONOMICA"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.
        jsonArray.add(jsonObject.clone());

    }// w  ww .ja  va2 s  .  co  m

    jsonArreglo.add(jsonArray);
    select.desconectar();

    return jsonArreglo;

}

From source file:modelo.PDFManagers.PDFManager.java

public JSONArray contarParamIncumplidos(String codigoProceso) throws Exception {

    //Ejecutamos la consulta y obtenemos el ResultSet
    SeleccionarPDF select = new SeleccionarPDF();
    ResultSet rset = select.contarParamIncumplidos(codigoProceso);

    //Creamos los JSONArray para guardar los objetos JSON
    JSONArray jsonArray = new JSONArray();

    //Recorremos el ResultSet, armamos el objeto JSON con la info y guardamos
    //en el JSONArray.
    JSONObject jsonObject = new JSONObject();
    while (rset.next()) {

        //Armamos el objeto JSON con la informacion del registro

        jsonObject.put("cantidad", rset.getString("CANTIDAD"));

        //Guardamos el JSONObject en el JSONArray y lo enviamos a la vista.

    }/*from   w  ww. j  av  a  2s  .c  om*/

    jsonArray.add(jsonObject.clone());

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

    return jsonArray;

}