AccordoServizioParteComuneSoapCore.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.ArrayList;
- import java.util.List;
- import org.openspcoop2.core.commons.ISearch;
- import org.openspcoop2.core.id.IDAccordo;
- import org.openspcoop2.core.id.IDPortType;
- import org.openspcoop2.core.id.IDPortTypeAzione;
- import org.openspcoop2.core.registry.AccordoServizioParteComune;
- import org.openspcoop2.core.registry.Azione;
- import org.openspcoop2.core.registry.MessagePart;
- import org.openspcoop2.core.registry.Operation;
- import org.openspcoop2.core.registry.PortType;
- import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
- import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
- import org.openspcoop2.core.registry.driver.FiltroRicercaOperations;
- import org.openspcoop2.core.registry.driver.FiltroRicercaPortTypes;
- 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;
- /**
- * AccordoServizioParteComuneSoapCore
- *
- * @author Poli Andrea (apoli@link.it)
- * @author $Author$
- * @version $Rev$, $Date$
- */
- public class AccordoServizioParteComuneSoapCore extends ControlStationCore {
- protected AccordoServizioParteComuneSoapCore(ControlStationCore core) throws DriverControlStationException {
- super(core);
- }
-
- public void deleteAzione(long idAccordo, String nomeAzione) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "deleteAzione";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- driver.getDriverRegistroServiziDB().deleteAzione(idAccordo, nomeAzione);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public List<Azione> accordiAzioniList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiAzioniList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiAzioniList(idAccordo, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<Azione> accordiAzioniList(long idAccordo, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiAzioniList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiAzioniList(idAccordo, profiloCollaborazione, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public List<org.openspcoop2.core.registry.PortType> accordiPorttypeList(long idAccordo, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiPorttypeList(idAccordo, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<org.openspcoop2.core.registry.PortType> accordiPorttypeList(long idAccordo, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiPorttypeList(idAccordo, profiloCollaborazione, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<Operation> accordiPorttypeOperationList(long idPortType, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeOperationList(idPT,ricerca)";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiPorttypeOperationList(idPortType, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<Operation> accordiPorttypeOperationList(IDAccordo idAccordo,String nomePortType) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeOperationList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- List<Operation> list = new ArrayList<>();
- AccordoServizioParteComune as = driver.getDriverRegistroServiziDB().getAccordoServizioParteComune(idAccordo);
- for(int i=0; i<as.sizePortTypeList();i++){
- PortType pt = as.getPortType(i);
- if(pt.getNome().equals(nomePortType)){
- for(int j=0; j<pt.sizeAzioneList(); j++){
- list.add(pt.getAzione(j));
- }
- break;
- }
- }
- return list;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public List<Operation> accordiPorttypeOperationList(long idPortType, String profiloCollaborazione, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeOperationList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiPorttypeOperationList(idPortType, profiloCollaborazione, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public List<MessagePart> accordiPorttypeOperationMessagePartList(long idOperation, boolean isInput, ISearch ricerca) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "accordiPorttypeOperationMessagePartList";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().accordiPorttypeOperationMessagePartList(idOperation,isInput, ricerca);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public boolean existsAccordoServizioPorttype(String nome, long idAccordo) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioPorttype";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComunePorttype(nome, idAccordo);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean existsAccordoServizioPorttypeOperation(String nome, long idPortType) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioPorttypeOperation";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComunePorttypeOperation(nome, idPortType);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean existsAccordoServizioPorttypeOperation(String nome, IDAccordo idAccordo, String nomePortType) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioPorttypeOperation";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- AccordoServizioParteComune as = driver.getDriverRegistroServiziDB().getAccordoServizioParteComune(idAccordo);
- for(int i=0; i<as.sizePortTypeList(); i++){
- PortType pt = as.getPortType(i);
- if(pt.getNome().equals(nomePortType)){
- for(int j=0; j<pt.sizeAzioneList(); j++){
- if(pt.getAzione(j).getNome().equals(nome))
- return true;
- }
- }
- }
- return false;
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public boolean isUnicaAzioneInAccordi(String azione) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "isUnicaAzioneInAccordi";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().isUnicaAzioneInAccordi(azione);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- /**
- * Controlla se l'azione e' usata come Azione correlata in qualche azione,
- * dell'accordo con id <i>idAccordo</i>, diversa da <i>owner</i>
- *
- * @param idAccordo
- * L'id dell'Accordo
- * @param nomeAzione
- * Il nome dell'azione correlata da cercare
- * @param owner
- * Il nome dell'azione che contiene <i>nomeAzione</i> come
- * correlata
- * @return true se l'azione e' usata come correlata, false altrimenti
- * @throws DriverRegistroServiziException
- */
- public boolean isAzioneCorrelata(long idAccordo, String nomeAzione, String owner) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "isAzioneCorrelata";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().isCorrelata(idAccordo, nomeAzione, owner);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- /**
- * Controlla se l'operation e' usata come Operation correlata in qualche
- * Operation del port-type con id <i>idPortType</i> diversa da <i>owner</i>
- *
- * @param idPortType
- * L'id del port-type a cui appartengono le operation
- * @param nomeCorrelata
- * Il nome dell'operation correlata da cercare
- * @param owner
- * Il nome dell'operation che contiene come correlata
- * <i>nomeCorrelata</i>
- * @return true se l'operazione e' usata come correlata, false altrimenti
- * @throws DriverRegistroServiziException
- */
- public boolean isOperationCorrelata(long idPortType, String nomeCorrelata, String owner) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "isOperationCorrelata";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().isOperationCorrelata(idPortType, nomeCorrelata, owner);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean isOperationCorrelata(String nomePortType,long idPortType,String azioneDaVerificare,long idAzioneDaVerificare) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "isOperationCorrelata(nomePortType,idPortType,azioneDaVerificare,idAzioneDaVerificare)";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().isOperationCorrelata(nomePortType, idPortType, azioneDaVerificare, idAzioneDaVerificare);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean isOperationCorrelataRichiesta(String nomePortType,long idPortType,String azioneDaVerificare,long idAzioneDaVerificare) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "isOperationCorrelata(nomePortType,idPortType,azioneDaVerificare,idAzioneDaVerificare)";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().isOperationCorrelataRichiesta(nomePortType, idPortType, azioneDaVerificare, idAzioneDaVerificare);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public boolean existsAccordoServizioAzione(long idAzione) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioAzione";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComuneAzione(idAzione);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean existsAccordoServizioOperation(long idAzione) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioOperation";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComuneOperation(idAzione);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
- public boolean existsAccordoServizioAzione(String nome, long idAccordo) throws DriverRegistroServiziException {
- Connection con = null;
- String nomeMetodo = "existsAccordoServizioAzione";
- DriverControlStationDB driver = null;
- try {
- // prendo una connessione
- con = ControlStationCore.dbM.getConnection();
- // istanzio il driver
- driver = new DriverControlStationDB(con, null, this.tipoDB);
- return driver.getDriverRegistroServiziDB().existsAccordoServizioParteComuneAzione(nome, idAccordo);
- } catch (Exception e) {
- ControlStationCore.logError(getPrefixError(nomeMetodo, e), e);
- throw new DriverRegistroServiziException(getPrefixError(nomeMetodo, e),e);
- } finally {
- ControlStationCore.dbM.releaseConnection(con);
- }
- }
-
- public List<IDPortType> getAllIdPortType(FiltroRicercaPortTypes filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
- Connection con = null;
- String nomeMetodo = "getAllIdPortType";
- 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().getAllIdPortType(filtroRicerca);
- }
- else{
- return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAllIdPortType(filtroRicerca);
- }
- } 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<IDPortTypeAzione> getAllIdOperation(FiltroRicercaOperations filtroRicerca) throws DriverRegistroServiziException, DriverRegistroServiziNotFound {
- Connection con = null;
- String nomeMetodo = "getAllIdOperation";
- 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().getAllIdAzionePortType(filtroRicerca);
- }
- else{
- return GestoreRegistroServiziRemoto.getDriverRegistroServizi(ControlStationCore.log).getAllIdAzionePortType(filtroRicerca);
- }
- } 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);
- }
- }
- }