JDBCLimitedServiceManager.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.commons.search.dao.jdbc;

  21. import org.openspcoop2.generic_project.exception.NotImplementedException;
  22. import org.openspcoop2.generic_project.exception.ServiceException;

  23. import java.sql.Connection;

  24. import javax.sql.DataSource;

  25. import org.openspcoop2.core.commons.search.dao.ISoggettoServiceSearch;
  26. import org.openspcoop2.core.commons.search.dao.ISoggettoRuoloServiceSearch;
  27. import org.openspcoop2.core.commons.search.dao.IRuoloServiceSearch;
  28. import org.openspcoop2.core.commons.search.dao.IPortaDominioServiceSearch;
  29. import org.openspcoop2.core.commons.search.dao.IGruppoServiceSearch;
  30. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneServiceSearch;
  31. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneGruppoServiceSearch;
  32. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneAzioneServiceSearch;
  33. import org.openspcoop2.core.commons.search.dao.IPortTypeServiceSearch;
  34. import org.openspcoop2.core.commons.search.dao.IOperationServiceSearch;
  35. import org.openspcoop2.core.commons.search.dao.IResourceServiceSearch;
  36. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteSpecificaServiceSearch;
  37. import org.openspcoop2.core.commons.search.dao.IFruitoreServiceSearch;
  38. import org.openspcoop2.core.commons.search.dao.IServizioApplicativoServiceSearch;
  39. import org.openspcoop2.core.commons.search.dao.IPortaDelegataServiceSearch;
  40. import org.openspcoop2.core.commons.search.dao.IPortaApplicativaServiceSearch;

  41. /**    
  42.  * Manager that allows you to obtain the services of research and management of objects
  43.  *
  44.  * @author Poli Andrea (poli@link.it)
  45.  * @author $Author$
  46.  * @version $Rev$, $Date$
  47.  */

  48. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  49.     private JDBCServiceManager unlimitedJdbcServiceManager;

  50.     public JDBCLimitedServiceManager(JDBCServiceManager jdbcServiceManager) {
  51.         this.datasource = jdbcServiceManager.getDatasourceInternalResource();
  52.         this.connection = jdbcServiceManager.getConnectionInternalResource();
  53.         this.log = jdbcServiceManager.getLoggerInternalResource();
  54.         this.jdbcProperties = jdbcServiceManager.getJdbcPropertiesInternalResource();
  55.         this.unlimitedJdbcServiceManager = jdbcServiceManager;
  56.     }
  57.    
  58.     private static final String CONNNECTION_MANAGED = "Connection managed from framework";
  59.    
  60.     @Override
  61.     public Connection getConnection() throws ServiceException {
  62.         throw new ServiceException(CONNNECTION_MANAGED);
  63.     }
  64.     @Override
  65.     public void closeConnection(Connection connection) throws ServiceException {
  66.         throw new ServiceException(CONNNECTION_MANAGED);
  67.     }
  68.     @Override
  69.     protected Connection getConnectionInternalResource() {
  70.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  71.     }
  72.     @Override
  73.     protected DataSource getDatasourceInternalResource() {
  74.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  75.     }
  76.    
  77.    
  78.    
  79.     /*
  80.      =====================================================================================================================
  81.      Services relating to the object with name:soggetto type:soggetto
  82.      =====================================================================================================================
  83.     */
  84.    
  85.     /**
  86.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Soggetto}
  87.      *
  88.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Soggetto}  
  89.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  90.      * @throws NotImplementedException Exception thrown when the method is not implemented
  91.      */
  92.     @Override
  93.     public ISoggettoServiceSearch getSoggettoServiceSearch() throws ServiceException,NotImplementedException{
  94.         return new JDBCSoggettoServiceSearch(this.unlimitedJdbcServiceManager);
  95.     }
  96.    
  97.    
  98.    
  99.    
  100.     /*
  101.      =====================================================================================================================
  102.      Services relating to the object with name:soggetto-ruolo type:soggetto-ruolo
  103.      =====================================================================================================================
  104.     */
  105.    
  106.     /**
  107.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.SoggettoRuolo}
  108.      *
  109.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.SoggettoRuolo}
  110.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  111.      * @throws NotImplementedException Exception thrown when the method is not implemented
  112.      */
  113.     @Override
  114.     public ISoggettoRuoloServiceSearch getSoggettoRuoloServiceSearch() throws ServiceException,NotImplementedException{
  115.         return new JDBCSoggettoRuoloServiceSearch(this.unlimitedJdbcServiceManager);
  116.     }
  117.    
  118.    
  119.    
  120.    
  121.     /*
  122.      =====================================================================================================================
  123.      Services relating to the object with name:ruolo type:ruolo
  124.      =====================================================================================================================
  125.     */
  126.    
  127.     /**
  128.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Ruolo}
  129.      *
  130.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Ruolo}
  131.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  132.      * @throws NotImplementedException Exception thrown when the method is not implemented
  133.      */
  134.     @Override
  135.     public IRuoloServiceSearch getRuoloServiceSearch() throws ServiceException,NotImplementedException{
  136.         return new JDBCRuoloServiceSearch(this.unlimitedJdbcServiceManager);
  137.     }
  138.    
  139.    
  140.    
  141.    
  142.     /*
  143.      =====================================================================================================================
  144.      Services relating to the object with name:porta-dominio type:porta-dominio
  145.      =====================================================================================================================
  146.     */
  147.    
  148.     /**
  149.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDominio}
  150.      *
  151.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDominio}  
  152.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  153.      * @throws NotImplementedException Exception thrown when the method is not implemented
  154.      */
  155.     @Override
  156.     public IPortaDominioServiceSearch getPortaDominioServiceSearch() throws ServiceException,NotImplementedException{
  157.         return new JDBCPortaDominioServiceSearch(this.unlimitedJdbcServiceManager);
  158.     }
  159.    
  160.    
  161.    
  162.    
  163.     /*
  164.      =====================================================================================================================
  165.      Services relating to the object with name:gruppo type:gruppo
  166.      =====================================================================================================================
  167.     */
  168.    
  169.     /**
  170.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Gruppo}
  171.      *
  172.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Gruppo}    
  173.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  174.      * @throws NotImplementedException Exception thrown when the method is not implemented
  175.      */
  176.     @Override
  177.     public IGruppoServiceSearch getGruppoServiceSearch() throws ServiceException,NotImplementedException{
  178.         return new JDBCGruppoServiceSearch(this.unlimitedJdbcServiceManager);
  179.     }
  180.    
  181.    
  182.    
  183.    
  184.     /*
  185.      =====================================================================================================================
  186.      Services relating to the object with name:accordo-servizio-parte-comune type:accordo-servizio-parte-comune
  187.      =====================================================================================================================
  188.     */
  189.    
  190.     /**
  191.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComune}
  192.      *
  193.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComune}    
  194.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  195.      * @throws NotImplementedException Exception thrown when the method is not implemented
  196.      */
  197.     @Override
  198.     public IAccordoServizioParteComuneServiceSearch getAccordoServizioParteComuneServiceSearch() throws ServiceException,NotImplementedException{
  199.         return new JDBCAccordoServizioParteComuneServiceSearch(this.unlimitedJdbcServiceManager);
  200.     }
  201.    
  202.    
  203.    
  204.    
  205.     /*
  206.      =====================================================================================================================
  207.      Services relating to the object with name:accordo-servizio-parte-comune-gruppo type:accordo-servizio-parte-comune-gruppo
  208.      =====================================================================================================================
  209.     */
  210.    
  211.     /**
  212.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneGruppo}
  213.      *
  214.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneGruppo}  
  215.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  216.      * @throws NotImplementedException Exception thrown when the method is not implemented
  217.      */
  218.     @Override
  219.     public IAccordoServizioParteComuneGruppoServiceSearch getAccordoServizioParteComuneGruppoServiceSearch() throws ServiceException,NotImplementedException{
  220.         return new JDBCAccordoServizioParteComuneGruppoServiceSearch(this.unlimitedJdbcServiceManager);
  221.     }
  222.    
  223.    
  224.    
  225.    
  226.     /*
  227.      =====================================================================================================================
  228.      Services relating to the object with name:accordo-servizio-parte-comune-azione type:accordo-servizio-parte-comune-azione
  229.      =====================================================================================================================
  230.     */
  231.    
  232.     /**
  233.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneAzione}
  234.      *
  235.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneAzione}  
  236.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  237.      * @throws NotImplementedException Exception thrown when the method is not implemented
  238.      */
  239.     @Override
  240.     public IAccordoServizioParteComuneAzioneServiceSearch getAccordoServizioParteComuneAzioneServiceSearch() throws ServiceException,NotImplementedException{
  241.         return new JDBCAccordoServizioParteComuneAzioneServiceSearch(this.unlimitedJdbcServiceManager);
  242.     }
  243.    
  244.    
  245.    
  246.    
  247.     /*
  248.      =====================================================================================================================
  249.      Services relating to the object with name:port-type type:port-type
  250.      =====================================================================================================================
  251.     */
  252.    
  253.     /**
  254.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortType}
  255.      *
  256.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortType}  
  257.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  258.      * @throws NotImplementedException Exception thrown when the method is not implemented
  259.      */
  260.     @Override
  261.     public IPortTypeServiceSearch getPortTypeServiceSearch() throws ServiceException,NotImplementedException{
  262.         return new JDBCPortTypeServiceSearch(this.unlimitedJdbcServiceManager);
  263.     }
  264.    
  265.    
  266.    
  267.    
  268.     /*
  269.      =====================================================================================================================
  270.      Services relating to the object with name:operation type:operation
  271.      =====================================================================================================================
  272.     */
  273.    
  274.     /**
  275.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Operation}
  276.      *
  277.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Operation}
  278.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  279.      * @throws NotImplementedException Exception thrown when the method is not implemented
  280.      */
  281.     @Override
  282.     public IOperationServiceSearch getOperationServiceSearch() throws ServiceException,NotImplementedException{
  283.         return new JDBCOperationServiceSearch(this.unlimitedJdbcServiceManager);
  284.     }
  285.    
  286.    
  287.    
  288.    
  289.     /*
  290.      =====================================================================================================================
  291.      Services relating to the object with name:resource type:resource
  292.      =====================================================================================================================
  293.     */
  294.    
  295.     /**
  296.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Resource}
  297.      *
  298.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Resource}  
  299.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  300.      * @throws NotImplementedException Exception thrown when the method is not implemented
  301.      */
  302.     @Override
  303.     public IResourceServiceSearch getResourceServiceSearch() throws ServiceException,NotImplementedException{
  304.         return new JDBCResourceServiceSearch(this.unlimitedJdbcServiceManager);
  305.     }
  306.    
  307.    
  308.    
  309.    
  310.     /*
  311.      =====================================================================================================================
  312.      Services relating to the object with name:accordo-servizio-parte-specifica type:accordo-servizio-parte-specifica
  313.      =====================================================================================================================
  314.     */
  315.    
  316.     /**
  317.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteSpecifica}
  318.      *
  319.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteSpecifica}
  320.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  321.      * @throws NotImplementedException Exception thrown when the method is not implemented
  322.      */
  323.     @Override
  324.     public IAccordoServizioParteSpecificaServiceSearch getAccordoServizioParteSpecificaServiceSearch() throws ServiceException,NotImplementedException{
  325.         return new JDBCAccordoServizioParteSpecificaServiceSearch(this.unlimitedJdbcServiceManager);
  326.     }
  327.    
  328.    
  329.    
  330.    
  331.     /*
  332.      =====================================================================================================================
  333.      Services relating to the object with name:fruitore type:fruitore
  334.      =====================================================================================================================
  335.     */
  336.    
  337.     /**
  338.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Fruitore}
  339.      *
  340.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Fruitore}  
  341.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  342.      * @throws NotImplementedException Exception thrown when the method is not implemented
  343.      */
  344.     @Override
  345.     public IFruitoreServiceSearch getFruitoreServiceSearch() throws ServiceException,NotImplementedException{
  346.         return new JDBCFruitoreServiceSearch(this.unlimitedJdbcServiceManager);
  347.     }
  348.    
  349.    
  350.    
  351.    
  352.     /*
  353.      =====================================================================================================================
  354.      Services relating to the object with name:servizio-applicativo type:servizio-applicativo
  355.      =====================================================================================================================
  356.     */
  357.    
  358.     /**
  359.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.ServizioApplicativo}
  360.      *
  361.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.ServizioApplicativo}  
  362.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  363.      * @throws NotImplementedException Exception thrown when the method is not implemented
  364.      */
  365.     @Override
  366.     public IServizioApplicativoServiceSearch getServizioApplicativoServiceSearch() throws ServiceException,NotImplementedException{
  367.         return new JDBCServizioApplicativoServiceSearch(this.unlimitedJdbcServiceManager);
  368.     }
  369.    
  370.    
  371.    
  372.    
  373.     /*
  374.      =====================================================================================================================
  375.      Services relating to the object with name:porta-delegata type:porta-delegata
  376.      =====================================================================================================================
  377.     */
  378.    
  379.     /**
  380.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDelegata}
  381.      *
  382.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDelegata}
  383.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  384.      * @throws NotImplementedException Exception thrown when the method is not implemented
  385.      */
  386.     @Override
  387.     public IPortaDelegataServiceSearch getPortaDelegataServiceSearch() throws ServiceException,NotImplementedException{
  388.         return new JDBCPortaDelegataServiceSearch(this.unlimitedJdbcServiceManager);
  389.     }
  390.    
  391.    
  392.    
  393.    
  394.     /*
  395.      =====================================================================================================================
  396.      Services relating to the object with name:porta-applicativa type:porta-applicativa
  397.      =====================================================================================================================
  398.     */
  399.    
  400.     /**
  401.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaApplicativa}
  402.      *
  403.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaApplicativa}  
  404.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  405.      * @throws NotImplementedException Exception thrown when the method is not implemented
  406.      */
  407.     @Override
  408.     public IPortaApplicativaServiceSearch getPortaApplicativaServiceSearch() throws ServiceException,NotImplementedException{
  409.         return new JDBCPortaApplicativaServiceSearch(this.unlimitedJdbcServiceManager);
  410.     }
  411.    
  412.    
  413.    
  414.    
  415. }