Example usage for com.google.gson GsonBuilder setDateFormat

List of usage examples for com.google.gson GsonBuilder setDateFormat

Introduction

In this page you can find the example usage for com.google.gson GsonBuilder setDateFormat.

Prototype

public GsonBuilder setDateFormat(int style) 

Source Link

Document

Configures Gson to to serialize Date objects according to the style value provided.

Usage

From source file:net.daw.service.specific.implementation.EntregaServiceSpImpl.java

License:Open Source License

@Override
public String get(Integer id) throws Exception {
    String data = null;/* w  w w .  ja v a 2 s  . c om*/
    try {
        oConnection.setAutoCommit(false);
        EntregaDaoSpcImpl oEntregaDAO = new EntregaDaoSpcImpl(strObjectName, oConnection);
        EntregaBeanGenSpImpl oEntrega = new EntregaBeanGenSpImpl(id);
        oEntrega = oEntregaDAO.get(oEntrega, 1);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oEntrega);
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.EntregaServiceSpImpl.java

License:Open Source License

@Override
public String getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> alFilter,
        HashMap<String, String> hmOrder) throws Exception {
    String data = null;/*  w ww.ja v a 2s  .  com*/
    try {
        oConnection.setAutoCommit(false);
        EntregaDaoSpcImpl oEntregaDAO = new EntregaDaoSpcImpl(strObjectName, oConnection);
        List<EntregaBeanGenSpImpl> oEntregas = oEntregaDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oEntregas);
        data = "{\"list\":" + data + "}";
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.EstudioServiceSpImpl.java

License:Open Source License

@Override
public String get(Integer id) throws Exception {
    String data = null;//from  ww w  .j  a  v a  2s  .c o m
    try {
        oConnection.setAutoCommit(false);
        EstudioDaoSpcImpl oEstudioDAO = new EstudioDaoSpcImpl(strObjectName, oConnection);
        EstudioBeanGenSpImpl oEstudio = new EstudioBeanGenSpImpl(id);
        oEstudio = oEstudioDAO.get(oEstudio, 1);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oEstudio);
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.EstudioServiceSpImpl.java

License:Open Source License

@Override
public String getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> alFilter,
        HashMap<String, String> hmOrder) throws Exception {
    String data = null;//from   ww  w .  ja  v a  2s .  c o  m
    try {
        oConnection.setAutoCommit(false);
        EstudioDaoSpcImpl oEstudioDAO = new EstudioDaoSpcImpl(strObjectName, oConnection);
        List<EstudioBeanGenSpImpl> oEstudios = oEstudioDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oEstudios);
        data = "{\"list\":" + data + "}";
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.GeneroServiceSpImpl.java

License:Open Source License

@Override
public String get(Integer id) throws Exception {
    String data = null;//from  w w  w .jav a 2  s . co  m
    try {
        oConnection.setAutoCommit(false);
        GeneroDaoSpcImpl oGeneroDAO = new GeneroDaoSpcImpl(strObjectName, oConnection);
        GeneroBeanGenSpImpl oGenero = new GeneroBeanGenSpImpl(id);
        oGenero = oGeneroDAO.get(oGenero, 1);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oGenero);
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.GeneroServiceSpImpl.java

License:Open Source License

@Override
public String getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> alFilter,
        HashMap<String, String> hmOrder) throws Exception {
    String data = null;// www .ja v  a2s .  c  om
    try {
        oConnection.setAutoCommit(false);
        GeneroDaoSpcImpl oGeneroDAO = new GeneroDaoSpcImpl(strObjectName, oConnection);
        List<GeneroBeanGenSpImpl> oGeneros = oGeneroDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oGeneros);
        data = "{\"list\":" + data + "}";
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.ImpuestoServiceSpImpl.java

License:Open Source License

@Override
public String get(Integer id) throws Exception {
    String data = null;//from   w w w  . j  av  a 2  s.c om
    try {
        oConnection.setAutoCommit(false);
        ImpuestoDaoSpcImpl oImpuestoDAO = new ImpuestoDaoSpcImpl(strObjectName, oConnection);
        ImpuestoBeanGenSpImpl oImpuesto = new ImpuestoBeanGenSpImpl(id);
        oImpuesto = oImpuestoDAO.get(oImpuesto, AppConfigurationHelper.getJsonDepth());
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oImpuesto);
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.ImpuestoServiceSpImpl.java

License:Open Source License

@Override
public String getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> alFilter,
        HashMap<String, String> hmOrder) throws Exception {
    String data = null;//from   w w w  .  ja  v a2 s.c  om
    try {
        oConnection.setAutoCommit(false);
        ImpuestoDaoSpcImpl oImpuestoDAO = new ImpuestoDaoSpcImpl(strObjectName, oConnection);
        List<ImpuestoBeanGenSpImpl> oImpuestos = oImpuestoDAO.getPage(intRegsPerPag, intPage, alFilter,
                hmOrder);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        data = gson.toJson(oImpuestos);
        data = "{\"list\":" + data + "}";
        oConnection.commit();
    } catch (Exception ex) {
        oConnection.rollback();
        ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return data;
}

From source file:net.daw.service.specific.implementation.LenguajeServiceSpImpl.java

License:Open Source License

@Override
public String get(Integer id) throws Exception {
    try {/*from w ww. ja v  a 2 s.co  m*/
        oConnection.setAutoCommit(false);
        LenguajeDaoSpcImpl oLenguajeDAO = new LenguajeDaoSpcImpl("Lenguaje", oConnection);
        LenguajeBeanGenSpImpl oLenguaje = new LenguajeBeanGenSpImpl(id);
        oLenguaje = oLenguajeDAO.get(oLenguaje);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        String data = gson.toJson(oLenguaje);
        oConnection.commit();
        return data;
    } catch (Exception e) {
        oConnection.rollback();
        throw new ServletException("get: LenguajeServiceSpcImpl Error: " + e.getMessage());
    }
}

From source file:net.daw.service.specific.implementation.LenguajeServiceSpImpl.java

License:Open Source License

@Override
public String getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> alFilter,
        HashMap<String, String> hmOrder) throws Exception {
    try {//from  www .j  a v  a2  s  .c o  m
        oConnection.setAutoCommit(false);
        LenguajeDaoSpcImpl oLenguajeDAO = new LenguajeDaoSpcImpl("Lenguaje", oConnection);
        List<LenguajeBeanGenSpImpl> oLenguajes = oLenguajeDAO.getPage(intRegsPerPag, intPage, alFilter,
                hmOrder);
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setDateFormat("dd/MM/yyyy");
        Gson gson = gsonBuilder.create();
        String data = gson.toJson(oLenguajes);
        data = "{\"list\":" + data + "}";
        oConnection.commit();
        return data;
    } catch (Exception e) {
        oConnection.rollback();
        throw new ServletException("getPage: LenguajeServiceSpcImpl Error: " + e.getMessage());
    }
}