List of usage examples for com.google.gson GsonBuilder setDateFormat
public GsonBuilder setDateFormat(int style)
From source file:net.daw.service.specific.implementation.RepartoServiceSpImpl.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;// ww w . jav a 2 s .c om try { oConnection.setAutoCommit(false); RepartoDaoSpcImpl oRepartoDAO = new RepartoDaoSpcImpl(strObjectName, oConnection); List<RepartoBeanGenSpImpl> oRepartos = oRepartoDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy"); Gson gson = gsonBuilder.create(); data = gson.toJson(oRepartos); 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.RespuestaService.java
License:MIT License
@Override public String get() throws Exception { int id = ParameterCook.prepareId(oRequest); Connection oConnection = new BoneConnectionPoolImpl().newConnection(); RespuestaDao oRespuestaDao = new RespuestaDao(oConnection); RespuestaBean oRespuestaBean = new RespuestaBean(); oRespuestaBean.setId(id);/* w w w . j av a 2s . c o m*/ oRespuestaBean = oRespuestaDao.get(oRespuestaBean, 1); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy HH:mm:ss"); Gson gson = gsonBuilder.create(); String data = gson.toJson(oRespuestaBean); return "{\"status\":200,\"message\":" + data + "}"; }
From source file:net.daw.service.specific.implementation.RespuestaService.java
License:MIT License
@Override public String getall() throws Exception { Connection oConnection = new BoneConnectionPoolImpl().newConnection(); RespuestaDao oRespuestaDao = new RespuestaDao(oConnection); ArrayList<RespuestaBean> alRespuestaBean = new ArrayList<RespuestaBean>(); ArrayList<FilterBeanHelper> alFilterBeanHelper = ParameterCook.prepareFilter(oRequest); HashMap<String, String> hmOrder = ParameterCook.prepareOrder(oRequest); alRespuestaBean = oRespuestaDao.getAll(alFilterBeanHelper, hmOrder); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy HH:mm:ss"); Gson gson = gsonBuilder.create();//from w w w . j a va 2s .co m String data = "{\"status\":200,\"message\":" + gson.toJson(alRespuestaBean) + "}"; return data; }
From source file:net.daw.service.specific.implementation.TemaServiceSpImpl.java
License:Open Source License
@Override public String get(Integer id) throws Exception { String data = null;// w ww. java2 s . c o m try { oConnection.setAutoCommit(false); TemaDaoSpcImpl oTemaDAO = new TemaDaoSpcImpl(strObjectName, oConnection); TemaBeanGenSpImpl oTema = new TemaBeanGenSpImpl(id); oTema = oTemaDAO.get(oTema, AppConfigurationHelper.getJsonDepth()); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy HH:mm:ss"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTema); 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.TemaServiceSpImpl.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 . j a v a2s .c om*/ try { oConnection.setAutoCommit(false); TemaDaoSpcImpl oTemaDAO = new TemaDaoSpcImpl(strObjectName, oConnection); List<TemaBeanGenSpImpl> oTemas = oTemaDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy HH:mm:ss"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTemas); 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.TipoproductoServiceSpImpl.java
License:Open Source License
@Override public String get(Integer id) throws Exception { String data = null;// ww w . j a v a 2 s . co m try { oConnection.setAutoCommit(false); TipoproductoDaoSpcImpl oTipoproductoDAO = new TipoproductoDaoSpcImpl(strObjectName, oConnection); TipoproductoBeanGenSpImpl oTipoproducto = new TipoproductoBeanGenSpImpl(id); oTipoproducto = oTipoproductoDAO.get(oTipoproducto, AppConfigurationHelper.getJsonDepth()); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTipoproducto); 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.TipoproductoServiceSpImpl.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 ww . j a va 2 s .com*/ try { oConnection.setAutoCommit(false); TipoproductoDaoSpcImpl oTipoproductoDAO = new TipoproductoDaoSpcImpl(strObjectName, oConnection); List<TipoproductoBeanGenSpImpl> oTipoproductos = oTipoproductoDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTipoproductos); 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.TipopropuestaServiceSpImpl.java
License:Open Source License
@Override public String get(Integer id) throws Exception { String data = null;//from w ww. j a va2 s . c om try { oConnection.setAutoCommit(false); TipopropuestaDaoSpcImpl oTipopropuestaDAO = new TipopropuestaDaoSpcImpl(strObjectName, "tipopropuesta", oConnection); TipopropuestaBeanGenSpImpl oTipopropuesta = new TipopropuestaBeanGenSpImpl(id); oTipopropuesta = oTipopropuestaDAO.get(oTipopropuesta, 1); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTipopropuesta); 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.TipopropuestaServiceSpImpl.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 a2s . co m*/ try { oConnection.setAutoCommit(false); TipopropuestaDaoSpcImpl oTipopropuestaDAO = new TipopropuestaDaoSpcImpl(strObjectName, "tipopropuesta", oConnection); List<TipopropuestaBeanGenSpImpl> oTipopropuestas = oTipopropuestaDAO.getPage(intRegsPerPag, intPage, alFilter, hmOrder); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat("dd/MM/yyyy"); Gson gson = gsonBuilder.create(); data = gson.toJson(oTipopropuestas); 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:nl.tue.iot.reservation.ReservationServlet.java
License:Open Source License
public ReservationServlet(LwM2mServer server, int securePort) { this.server = server; GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeHierarchyAdapter(Client.class, new ClientSerializer()); gsonBuilder.registerTypeHierarchyAdapter(LwM2mResponse.class, new ResponseSerializer()); gsonBuilder.registerTypeHierarchyAdapter(LwM2mNode.class, new LwM2mNodeSerializer()); gsonBuilder.registerTypeHierarchyAdapter(LwM2mNode.class, new LwM2mNodeDeserializer()); gsonBuilder.setDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); this.gson = gsonBuilder.create(); }