PluginsDriverUtils.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.core.plugins.utils;

  21. import java.sql.Connection;
  22. import java.util.ArrayList;
  23. import java.util.List;

  24. import org.openspcoop2.core.commons.Filtri;
  25. import org.openspcoop2.core.commons.ISearch;
  26. import org.openspcoop2.core.commons.Liste;
  27. import org.openspcoop2.core.commons.SearchUtils;
  28. import org.openspcoop2.core.config.constants.PluginCostanti;
  29. import org.openspcoop2.core.plugins.IdPlugin;
  30. import org.openspcoop2.core.plugins.Plugin;
  31. import org.openspcoop2.core.plugins.constants.TipoPlugin;
  32. import org.openspcoop2.core.plugins.dao.IPluginService;
  33. import org.openspcoop2.core.plugins.dao.IPluginServiceSearch;
  34. import org.openspcoop2.core.plugins.dao.jdbc.JDBCServiceManager;
  35. import org.openspcoop2.core.plugins.dao.jdbc.converter.PluginFieldConverter;
  36. import org.openspcoop2.generic_project.beans.AliasTableComplexField;
  37. import org.openspcoop2.generic_project.beans.ComplexField;
  38. import org.openspcoop2.generic_project.beans.CustomField;
  39. import org.openspcoop2.generic_project.beans.IAliasTableField;
  40. import org.openspcoop2.generic_project.beans.NonNegativeNumber;
  41. import org.openspcoop2.generic_project.exception.NotFoundException;
  42. import org.openspcoop2.generic_project.exception.ServiceException;
  43. import org.openspcoop2.generic_project.expression.IExpression;
  44. import org.openspcoop2.generic_project.expression.IPaginatedExpression;
  45. import org.openspcoop2.generic_project.expression.LikeMode;
  46. import org.openspcoop2.generic_project.expression.SortOrder;
  47. import org.openspcoop2.generic_project.utils.ServiceManagerProperties;
  48. import org.openspcoop2.utils.sql.ISQLQueryObject;
  49. import org.slf4j.Logger;

  50. /**
  51.  * PluginsDriverUtils
  52.  *
  53.  * @author Poli Andrea (apoli@link.it)
  54.  * @author $Author$
  55.  * @version $Rev$, $Date$
  56.  */
  57. public class PluginsDriverUtils {

  58.     public static int numeroPluginsClassiList(Connection con, Logger log, String tipoDB) throws ServiceException {
  59.         String nomeMetodo = "numeroPluginsClassiList";
  60.         int val = 0;

  61.         try {
  62.             ServiceManagerProperties properties = new ServiceManagerProperties();
  63.             properties.setDatabaseType(tipoDB);
  64.             properties.setShowSql(true);
  65.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  66.            
  67.             IPluginServiceSearch pluginServiceSearch = jdbcServiceManagerMonitorEngineConfig.getPluginServiceSearch();
  68.            
  69.             IExpression expr = pluginServiceSearch.newExpression();
  70.            
  71.             NonNegativeNumber count = pluginServiceSearch.count(expr);
  72.             if(count!= null)
  73.                 val = (int) count.longValue();
  74.            
  75.             return val;

  76.         } catch (Exception qe) {
  77.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  78.         }
  79.     }
  80.    
  81.     public static List<Plugin> pluginsClassiList(ISearch ricerca, Connection con, Logger log, String tipoDB) throws ServiceException {
  82.         String nomeMetodo = "pluginsClassiList";
  83.         int idLista = Liste.CONFIGURAZIONE_PLUGINS_CLASSI;
  84.         int offset;
  85.         int limit;
  86.         String search;

  87.         limit = ricerca.getPageSize(idLista);
  88.         offset = ricerca.getIndexIniziale(idLista);
  89.         search = (org.openspcoop2.core.constants.Costanti.SESSION_ATTRIBUTE_VALUE_RICERCA_UNDEFINED.equals(ricerca.getSearchString(idLista)) ? "" : ricerca.getSearchString(idLista));

  90.         String filterTipoPlugin = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_TIPO_PLUGIN_CLASSI);
  91.        
  92.         String filterStato = SearchUtils.getFilter(ricerca, idLista, Filtri.FILTRO_STATO);
  93.        
  94.         log.debug("search : " + search);
  95.         log.debug("filterTipoPlugin : " + filterTipoPlugin);
  96.         log.debug("filterStato : " + filterStato);
  97.        
  98.         List<Plugin> lista = new ArrayList<Plugin>();

  99.         try {
  100.             ServiceManagerProperties properties = new ServiceManagerProperties();
  101.             properties.setDatabaseType(tipoDB);
  102.             properties.setShowSql(true);
  103.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  104.            
  105.             IPluginServiceSearch pluginServiceSearch = jdbcServiceManagerMonitorEngineConfig.getPluginServiceSearch();
  106.            
  107.             IExpression expr = pluginServiceSearch.newExpression();
  108.            
  109.             boolean addAnd = false;
  110.            
  111.             if (!search.equals("")) {
  112.                
  113.                 IExpression exprLabel = pluginServiceSearch.newExpression();
  114.                 exprLabel.ilike(Plugin.model().LABEL, search, LikeMode.ANYWHERE);
  115.                
  116.                 IExpression exprTipo = pluginServiceSearch.newExpression();
  117.                 exprTipo.ilike(Plugin.model().TIPO, search, LikeMode.ANYWHERE);
  118.                
  119.                 expr.or(exprLabel, exprTipo);
  120.                
  121.                 addAnd = true;
  122.             }
  123.            
  124.             if(filterStato!=null && !filterStato.equals("")) {
  125.                 if(Filtri.FILTRO_STATO_VALORE_ABILITATO.equals(filterStato) || Filtri.FILTRO_STATO_VALORE_DISABILITATO.equals(filterStato)) {
  126.                    
  127.                     if(addAnd) {
  128.                         expr.and();
  129.                     }
  130.                     addAnd = true;
  131.                    
  132.                     expr.equals(Plugin.model().STATO, Filtri.FILTRO_STATO_VALORE_ABILITATO.equals(filterStato));
  133.                    
  134.                 }
  135.             }
  136.            
  137.             if(!filterTipoPlugin.equals("")) {
  138.                 if(addAnd) {
  139.                     expr.and();
  140.                 }
  141.                
  142.                 expr.equals(Plugin.model().TIPO_PLUGIN, filterTipoPlugin);
  143.                
  144.                 TipoPlugin tipoPlugin = TipoPlugin.toEnumConstant(filterTipoPlugin);
  145.                 switch (tipoPlugin) {
  146.                 case AUTENTICAZIONE:
  147.                 case AUTORIZZAZIONE:
  148.                 case AUTORIZZAZIONE_CONTENUTI:
  149.                 case INTEGRAZIONE:
  150.                     String filtroRuolo = SearchUtils.getFilter(ricerca, idLista, PluginCostanti.FILTRO_RUOLO_NOME);
  151.                     log.debug("filtroRuolo : " + filtroRuolo);
  152.                    
  153.                     if(!filtroRuolo.equals("")) {
  154.                        
  155.                         expr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, PluginCostanti.FILTRO_RUOLO_NOME);
  156.                         expr.and();
  157.                        
  158.                         IExpression exprOr = pluginServiceSearch.newExpression();
  159.                         exprOr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, filtroRuolo);
  160.                         exprOr.or();
  161.                         exprOr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, PluginCostanti.FILTRO_RUOLO_VALORE_ENTRAMBI);
  162.                         expr.and(exprOr);
  163.                        
  164.                     }
  165.                     break;
  166.                 case SERVICE_HANDLER:
  167.                     String filtroShTipo = SearchUtils.getFilter(ricerca, idLista, PluginCostanti.FILTRO_SERVICE_HANDLER_NOME);
  168.                     log.debug("filtroShTipo : " + filtroShTipo);
  169.                    
  170.                     if(!filtroShTipo.equals("")) {
  171.                         expr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, PluginCostanti.FILTRO_SERVICE_HANDLER_NOME)
  172.                             .and().equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, filtroShTipo);
  173.                     }
  174.                     break;
  175.                 case MESSAGE_HANDLER:
  176.                     // message handler e ruolo messa ge handler
  177.                     String filtroMhRuolo = SearchUtils.getFilter(ricerca, idLista, PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_NOME);
  178.                     log.debug("filtroMhRuolo : " + filtroMhRuolo);
  179.                     boolean ruoloDefined = !filtroMhRuolo.equals("");
  180.                    
  181.                     String filtroMhTipo = SearchUtils.getFilter(ricerca, idLista, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_NOME);
  182.                     log.debug("filtroMhTipo : " + filtroMhTipo);
  183.                     boolean tipoDefined = !filtroMhTipo.equals("");
  184.                                        
  185.                     if(tipoDefined && ruoloDefined) {
  186.                        
  187.                         IAliasTableField ruolo_name = new AliasTableComplexField((ComplexField)Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, FilterUtils.getNextAliasPluginsTable());
  188.                         IAliasTableField ruolo_valore = new AliasTableComplexField((ComplexField)Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, ruolo_name.getAliasTable());
  189.                        
  190.                         IAliasTableField tipo_name = new AliasTableComplexField((ComplexField)Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, FilterUtils.getNextAliasPluginsTable());
  191.                         IAliasTableField tipo_valore = new AliasTableComplexField((ComplexField)Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, tipo_name.getAliasTable());
  192.                        
  193.                         expr.
  194.                             and().
  195.                             equals(ruolo_name, PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_NOME).
  196.                             equals(ruolo_valore, filtroMhRuolo).
  197.                             equals(tipo_name, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_NOME).
  198.                             equals(tipo_valore, filtroMhTipo);
  199.                     }
  200.                     else if(tipoDefined) {
  201.                         expr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, PluginCostanti.FILTRO_FASE_MESSAGE_HANDLER_NOME)
  202.                         .and().equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, filtroMhTipo);
  203.                     }
  204.                     else if(ruoloDefined) {
  205.                         expr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, PluginCostanti.FILTRO_RUOLO_MESSAGE_HANDLER_NOME)
  206.                         .and().equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, filtroMhRuolo);
  207.                     }
  208.                                        
  209.                     break;
  210.                 case ALLARME:
  211.                     String filtroApplicabilita = SearchUtils.getFilter(ricerca, idLista, PluginCostanti.FILTRO_APPLICABILITA_NOME);
  212.                     log.debug("filtroApplicabilita : " + filtroApplicabilita);
  213.                    
  214.                     if(!filtroApplicabilita.equals("")) {
  215.                        
  216.                         expr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.NOME, PluginCostanti.FILTRO_APPLICABILITA_NOME);
  217.                         expr.and();
  218.                        
  219.                         IExpression exprOr = pluginServiceSearch.newExpression();
  220.                         exprOr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, filtroApplicabilita);
  221.                         exprOr.or();
  222.                         exprOr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, PluginCostanti.FILTRO_APPLICABILITA_VALORE_QUALSIASI);
  223.                         if(PluginCostanti.FILTRO_APPLICABILITA_VALORE_EROGAZIONE.equals(filtroApplicabilita) || PluginCostanti.FILTRO_APPLICABILITA_VALORE_FRUIZIONE.equals(filtroApplicabilita)) {
  224.                             exprOr.equals(Plugin.model().PLUGIN_PROPRIETA_COMPATIBILITA.VALORE, PluginCostanti.FILTRO_APPLICABILITA_VALORE_IMPLEMENTAZIONE_API);
  225.                         }
  226.                         expr.and(exprOr);
  227.                        
  228.                     }
  229.                     break;
  230.                 case BEHAVIOUR:
  231.                 case CONNETTORE:
  232.                 case RATE_LIMITING:
  233.                 case RICERCA:
  234.                 case STATISTICA:
  235.                 case TRANSAZIONE:
  236.                 case TOKEN_DYNAMIC_DISCOVERY:
  237.                 case TOKEN_VALIDAZIONE:
  238.                 case TOKEN_NEGOZIAZIONE:
  239.                 case ATTRIBUTE_AUTHORITY:
  240.                     break;
  241.                 }
  242.             }
  243.            
  244.             NonNegativeNumber count = pluginServiceSearch.count(expr);
  245.             ricerca.setNumEntries(idLista,(int) count.longValue());
  246.            
  247.             // ricavo le entries
  248.             if (limit == 0) // con limit
  249.                 limit = ISQLQueryObject.LIMIT_DEFAULT_VALUE;
  250.            
  251.             IPaginatedExpression pagExpr = pluginServiceSearch.toPaginatedExpression(expr);
  252.            
  253.             pagExpr.limit(limit).offset(offset);
  254.            
  255.             pagExpr.addOrder(Plugin.model().TIPO_PLUGIN, SortOrder.ASC);
  256.             pagExpr.addOrder(Plugin.model().LABEL, SortOrder.ASC);

  257.             lista = pluginServiceSearch.findAll(pagExpr);

  258.             return lista;

  259.         } catch (Exception qe) {
  260.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  261.         }
  262.     }
  263.    
  264.     public static void createPluginClassi(Plugin plugin, Connection con, Logger log, String tipoDB) throws ServiceException {
  265.         String nomeMetodo = "createPluginClassi";

  266.         try {
  267.             ServiceManagerProperties properties = new ServiceManagerProperties();
  268.             properties.setDatabaseType(tipoDB);
  269.             properties.setShowSql(true);
  270.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  271.            
  272.             IPluginService pluginService = jdbcServiceManagerMonitorEngineConfig.getPluginService();
  273.            
  274.             pluginService.create(plugin);
  275.            
  276.         } catch (Exception qe) {
  277.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  278.         }
  279.     }
  280.    
  281.     public static void updatePluginClassi(Plugin plugin, Connection con, Logger log, String tipoDB) throws ServiceException {
  282.         String nomeMetodo = "updatePluginClassi";

  283.         try {
  284.             ServiceManagerProperties properties = new ServiceManagerProperties();
  285.             properties.setDatabaseType(tipoDB);
  286.             properties.setShowSql(true);
  287.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  288.            
  289.             IPluginService pluginService = jdbcServiceManagerMonitorEngineConfig.getPluginService();
  290.            
  291.             pluginService.update(plugin.getOldIdPlugin(), plugin);
  292.            
  293.         } catch (Exception qe) {
  294.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  295.         }
  296.     }
  297.    
  298.     public static void deletePluginClassi(Plugin plugin, Connection con, Logger log, String tipoDB) throws ServiceException {
  299.         String nomeMetodo = "deletePluginClassi";

  300.         try {
  301.             ServiceManagerProperties properties = new ServiceManagerProperties();
  302.             properties.setDatabaseType(tipoDB);
  303.             properties.setShowSql(true);
  304.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  305.            
  306.             IPluginService pluginService = jdbcServiceManagerMonitorEngineConfig.getPluginService();
  307.            
  308.             pluginService.delete(plugin);
  309.            
  310.         } catch (Exception qe) {
  311.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  312.         }
  313.     }

  314.     public static boolean existsPlugin(TipoPlugin tipoPlugin, String tipo, String label, String className, Connection con, Logger log, String tipoDB) throws ServiceException {
  315.         return _existsPlugin(tipoPlugin, tipo, label, className, con, log, tipoDB);
  316.     }
  317.     public static boolean existsPluginConTipo(TipoPlugin tipoPlugin, String tipo, Connection con, Logger log, String tipoDB) throws ServiceException {
  318.         return _existsPlugin(tipoPlugin, tipo, null, null, con, log, tipoDB);
  319.     }
  320.     public static boolean existsPluginConLabel(TipoPlugin tipoPlugin, String label, Connection con, Logger log, String tipoDB) throws ServiceException {
  321.         return _existsPlugin(tipoPlugin, null, label, null, con, log, tipoDB);
  322.     }
  323.     public static boolean existsPluginConClassName(TipoPlugin tipoPlugin, String className, Connection con, Logger log, String tipoDB) throws ServiceException {
  324.         return _existsPlugin(tipoPlugin, null, null, className, con, log, tipoDB);
  325.     }
  326.    
  327.     private static boolean _existsPlugin(TipoPlugin tipoPlugin, String tipo, String label, String className, Connection con, Logger log, String tipoDB) throws ServiceException {
  328.         String nomeMetodo = "existsPlugin";
  329.        
  330.         try {
  331.             ServiceManagerProperties properties = new ServiceManagerProperties();
  332.             properties.setDatabaseType(tipoDB);
  333.             properties.setShowSql(true);
  334.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  335.            
  336.             IPluginServiceSearch pluginServiceSearch = jdbcServiceManagerMonitorEngineConfig.getPluginServiceSearch();
  337.            
  338.             IExpression expr = pluginServiceSearch.newExpression();
  339.            
  340.             List<IExpression> list = new ArrayList<IExpression>();
  341.            
  342.             if(tipo!=null) {
  343.                 IExpression tipoExp = pluginServiceSearch.newExpression();
  344.                 tipoExp.equals(Plugin.model().TIPO_PLUGIN, tipoPlugin.toString()).and().equals(Plugin.model().TIPO, tipo);
  345.                 list.add(tipoExp);
  346.             }
  347.             if(label!=null) {
  348.                 IExpression labelExp = pluginServiceSearch.newExpression();
  349.                 labelExp.equals(Plugin.model().TIPO_PLUGIN, tipoPlugin.toString()).and().equals(Plugin.model().LABEL, label);
  350.                 list.add(labelExp);
  351.             }
  352.             if(className!=null) {
  353.                 IExpression classExp = pluginServiceSearch.newExpression();
  354.                 classExp.equals(Plugin.model().TIPO_PLUGIN, tipoPlugin.toString()).and().equals(Plugin.model().CLASS_NAME, className);
  355.                 list.add(classExp);
  356.             }
  357.            
  358.             expr.or(list.toArray(new IExpression[list.size()]));
  359.            
  360.             NonNegativeNumber count = pluginServiceSearch.count(expr);
  361.            
  362.             return count.longValue() > 0;
  363.         } catch (Exception qe) {
  364.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  365.         }
  366.     }

  367.     public static Plugin getPlugin(long idPlugin, Connection con, Logger log, String tipoDB) throws ServiceException {
  368.         String nomeMetodo = "getPlugin";
  369.        
  370.         try {
  371.             ServiceManagerProperties properties = new ServiceManagerProperties();
  372.             properties.setDatabaseType(tipoDB);
  373.             properties.setShowSql(true);
  374.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  375.            
  376.             IPluginServiceSearch pluginServiceSearch = jdbcServiceManagerMonitorEngineConfig.getPluginServiceSearch();
  377.            
  378.             IExpression expr = pluginServiceSearch.newExpression();
  379.            
  380.             PluginFieldConverter converter = new PluginFieldConverter(tipoDB);
  381.             expr.equals(new CustomField("id", Long.class, "id", converter.toTable(Plugin.model())), idPlugin);

  382.             Plugin plugin = pluginServiceSearch.find(expr);
  383.            
  384.             IdPlugin idPluginObj = pluginServiceSearch.convertToId(plugin);
  385.             plugin.setOldIdPlugin(idPluginObj);
  386.            
  387.             return plugin;
  388.         } catch (Exception qe) {
  389.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  390.         }
  391.     }
  392.    
  393.     public static Plugin getPlugin(TipoPlugin tipoPlugin, String tipo, boolean throwNotFound, Connection con, Logger log, String tipoDB) throws ServiceException,NotFoundException {
  394.         return getPlugin(tipoPlugin.getValue(), tipo, throwNotFound, con, log, tipoDB);
  395.     }
  396.     public static Plugin getPlugin(String tipoPlugin, String tipo, boolean throwNotFound, Connection con, Logger log, String tipoDB) throws ServiceException,NotFoundException {
  397.         String nomeMetodo = "getPlugin";
  398.        
  399.         try {
  400.             ServiceManagerProperties properties = new ServiceManagerProperties();
  401.             properties.setDatabaseType(tipoDB);
  402.             properties.setShowSql(true);
  403.             JDBCServiceManager jdbcServiceManagerMonitorEngineConfig = new JDBCServiceManager(con, properties, log);
  404.            
  405.             IPluginServiceSearch pluginServiceSearch = jdbcServiceManagerMonitorEngineConfig.getPluginServiceSearch();
  406.            
  407.             IdPlugin idPlugin = new IdPlugin();
  408.             idPlugin.setTipoPlugin(tipoPlugin);
  409.             idPlugin.setTipo(tipo);
  410.            
  411.             Plugin plugin = pluginServiceSearch.get(idPlugin);
  412.             if(plugin==null) {
  413.                 throw new NotFoundException("NotFound");
  414.             }
  415.            
  416.             IdPlugin idPluginObj = pluginServiceSearch.convertToId(plugin);
  417.             plugin.setOldIdPlugin(idPluginObj);
  418.            
  419.             return plugin;
  420.         }
  421.         catch (NotFoundException notFound) {
  422.             if(throwNotFound) {
  423.                 throw new NotFoundException("[" + nomeMetodo + "] Errore : " + notFound.getMessage(),notFound);
  424.             }
  425.             return null;
  426.         }
  427.         catch (Exception qe) {
  428.             throw new ServiceException("[" + nomeMetodo + "] Errore : " + qe.getMessage(),qe);
  429.         }
  430.     }
  431.    
  432. }