AccordoServizioParteComuneSinteticoCore.java
- /*
- * GovWay - A customizable API Gateway
- * https://govway.org
- *
- * Copyright (c) 2005-2025 Link.it srl (https://link.it).
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3, as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
- package org.openspcoop2.web.ctrlstat.servlet.apc;
- import java.sql.Connection;
- import java.util.List;
- import org.openspcoop2.core.commons.ISearch;
- import org.openspcoop2.core.id.IDAccordo;
- import org.openspcoop2.core.registry.AccordoServizioParteComune;
- import org.openspcoop2.core.registry.beans.AccordoServizioParteComuneSintetico;
- import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
- import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
- import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
- import org.openspcoop2.web.ctrlstat.driver.DriverControlStationDB;
- import org.openspcoop2.web.ctrlstat.driver.DriverControlStationException;
- import org.openspcoop2.web.ctrlstat.registro.GestoreRegistroServiziRemoto;
- /**
- * AccordoServizioParteComuneSinteticoCore
- *
- * @author Poli Andrea (apoli@link.it)
- * @author $Author$
- * @version $Rev$, $Date$
- */
- public class AccordoServizioParteComuneSinteticoCore extends ControlStationCore {
- protected AccordoServizioParteComuneSinteticoCore(ControlStationCore core) throws DriverControlStationException {
- super(core);
- }
-
- public AccordoServizioParteComuneSintetico getAccordoServizioSintetico(IDAccordo idAccordo) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "getAccordoServizioSintetico";
- DriverControlStationDB driver = null;
- try {
- if(this.isRegistroServiziLocale()){
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().getAccordoServizioParteComuneSintetico(idAccordo);
- }
- else{
- AccordoServizioParteComune aspc = GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAccordoServizioParteComune(idAccordo);
- return new AccordoServizioParteComuneSintetico(aspc);
- }
- } catch (DriverRegistroServiziNotFound de) {
- ControlStationCore.logDebug(getPrefixError(nomeMetodo, de),de);
- throw de;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public List<AccordoServizioParteComuneSintetico> accordiServizioParteComuneList(String superuser, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiServizioParteComuneList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiServizioParteComuneList(superuser, ricerca);
- } catch (DriverRegistroServiziException e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw e;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e), e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<AccordoServizioParteComuneSintetico> accordiServizioCompostiList(String superuser, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiServizioCompostiList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiServizioCompostiList(superuser, ricerca);
- } catch (DriverRegistroServiziException e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw e;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e), e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public AccordoServizioParteComuneSintetico getAccordoServizioSintetico(long id) throws DriverRegistroServiziNotFound, DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "getAccordoServizioSintetico";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().getAccordoServizioParteComuneSintetico(id);
- } catch (DriverRegistroServiziNotFound de) {
- ControlStationCore.logDebug(getPrefixError(nomeMetodo, de),de);
- throw de;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- }