Ejemplo n.º 1
0
 @Override
 public String getcount() throws Exception {
   if (this.checkpermission("getcount")) {
     String data = null;
     ArrayList<FilterBeanHelper> alFilter = ParameterCook.prepareFilter(oRequest);
     Connection oConnection = null;
     ConnectionInterface oDataConnectionSource = null;
     try {
       oDataConnectionSource = getSourceConnection();
       oConnection = oDataConnectionSource.newConnection();
       EstadoDao oEstadoDao = new EstadoDao(oConnection);
       data = JsonMessage.getJson("200", Integer.toString(oEstadoDao.getCount(alFilter)));
     } catch (Exception ex) {
       ExceptionBooster.boost(
           new Exception(this.getClass().getName() + ":getCount ERROR: " + ex.getMessage()));
     } finally {
       if (oConnection != null) {
         oConnection.close();
       }
       if (oDataConnectionSource != null) {
         oDataConnectionSource.disposeConnection();
       }
     }
     return data;
   } else {
     return JsonMessage.getJsonMsg("401", "Unauthorized");
   }
 }
Ejemplo n.º 2
0
 @Override
 public String getpage() throws Exception {
   if (this.checkpermission("getpage")) {
     int intRegsPerPag = ParameterCook.prepareRpp(oRequest);
     int intPage = ParameterCook.preparePage(oRequest);
     ArrayList<FilterBeanHelper> alFilter = ParameterCook.prepareFilter(oRequest);
     HashMap<String, String> hmOrder = ParameterCook.prepareOrder(oRequest);
     String data = null;
     Connection oConnection = null;
     ConnectionInterface oDataConnectionSource = null;
     try {
       oDataConnectionSource = getSourceConnection();
       oConnection = oDataConnectionSource.newConnection();
       EstadoDao oEstadoDao = new EstadoDao(oConnection);
       List<EstadoBean> arrBeans =
           oEstadoDao.getPage(
               intRegsPerPag, intPage, alFilter, hmOrder, AppConfigurationHelper.getJsonDepth());
       data = JsonMessage.getJson("200", AppConfigurationHelper.getGson().toJson(arrBeans));
     } catch (Exception ex) {
       ExceptionBooster.boost(
           new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
     } finally {
       if (oConnection != null) {
         oConnection.close();
       }
       if (oDataConnectionSource != null) {
         oDataConnectionSource.disposeConnection();
       }
     }
     return data;
   } else {
     return JsonMessage.getJsonMsg("401", "Unauthorized");
   }
 }