AccordoServizioWrapper.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.registry.wsdl;

  21. import java.util.ArrayList;

  22. import javax.xml.validation.Schema;

  23. import org.openspcoop2.core.id.IDAccordo;
  24. import org.openspcoop2.core.registry.AccordoServizioParteComune;
  25. import org.openspcoop2.core.registry.PortType;
  26. import org.openspcoop2.core.registry.constants.TipologiaServizio;

  27. /**
  28.  * Classe utilizzata per rappresentare i wsdl che formano un accordo di un servizio
  29.  *
  30.  *
  31.  * @author Poli Andrea (apoli@link.it)
  32.  * @author $Author$
  33.  * @version $Rev$, $Date$
  34.  */
  35. public class AccordoServizioWrapper implements java.io.Serializable, Cloneable{

  36.     /**
  37.      *
  38.      */
  39.     private static final long serialVersionUID = 1L;

  40.     /** Schema XSD */
  41.     private transient Schema schema = null;

  42.     public Schema getSchema() {
  43.         return this.schema;
  44.     }

  45.     public void setSchema(Schema schema) {
  46.         this.schema = schema;
  47.     }




  48.     /** PortTypes */
  49.     protected ArrayList<PortType> portTypeList = new ArrayList<PortType>();
  50.     private boolean portTypesLoadedFromWSDL = false;
  51.     public boolean isPortTypesLoadedFromWSDL() {
  52.         return this.portTypesLoadedFromWSDL;
  53.     }
  54.     public void setPortTypesLoadedFromWSDL(boolean portTypesLoadedFromWSDL) {
  55.         this.portTypesLoadedFromWSDL = portTypesLoadedFromWSDL;
  56.     }
  57.    
  58.     public void addPortType(PortType portTypeList) {
  59.         this.portTypeList.add(portTypeList);
  60.     }

  61.     public PortType getPortType(String nome) {
  62.         for(int i=0; i<this.portTypeList.size();i++){
  63.             PortType pt = this.portTypeList.get(i);
  64.             if(nome.equals(pt.getNome()) )
  65.                 return pt;
  66.         }
  67.         return null;
  68.     }
  69.    
  70.     public PortType getPortType(int index) {
  71.         return this.portTypeList.get( index );
  72.     }

  73.     public PortType removePortType(String nome) {
  74.         for(int i=0; i<this.portTypeList.size();i++){
  75.             PortType pt = this.portTypeList.get(i);
  76.             if(nome.equals(pt.getNome()) ){
  77.                 this.portTypeList.remove(i);
  78.                 return pt;
  79.             }
  80.         }
  81.         return null;
  82.     }
  83.    
  84.     public PortType removePortType(int index) {
  85.         return this.portTypeList.remove( index );
  86.     }

  87.     public PortType[] getPortTypeList() {
  88.         PortType[] array = new PortType[1];
  89.         if(this.portTypeList.size()>0){
  90.             return this.portTypeList.toArray(array);
  91.         }else{
  92.             return null;
  93.         }
  94.     }

  95.     public void setPortTypeList(PortType[] array) {
  96.         if(array!=null){
  97.             for(int i=0; i<array.length; i++){
  98.                 this.portTypeList.add(array[i]);
  99.             }
  100.         }
  101.     }

  102.     public int sizePortTypeList() {
  103.         return this.portTypeList.size();
  104.     }
  105.    
  106.    
  107.    
  108.    
  109.     /** Nome accordo di servizio */
  110.     private IDAccordo idAccordoServizio;
  111.     public IDAccordo getIdAccordoServizio() {
  112.         return this.idAccordoServizio;
  113.     }
  114.     public void setIdAccordoServizio(IDAccordo idAccordoServizio) {
  115.         this.idAccordoServizio = idAccordoServizio;
  116.     }
  117.    
  118.    
  119.     /** Nome PortType */
  120.     private String nomePortType;
  121.     public String getNomePortType() {
  122.         return this.nomePortType;
  123.     }
  124.     public void setNomePortType(String nomePortType) {
  125.         this.nomePortType = nomePortType;
  126.     }
  127.    
  128.    
  129.     /** Indicazione se il servizio e' correlato */
  130.     private TipologiaServizio tipologiaServizio;
  131.     public TipologiaServizio getTipologiaServizio() {
  132.         return this.tipologiaServizio;
  133.     }
  134.     public void setTipologiaServizio(TipologiaServizio tipologiaServizio) {
  135.         this.tipologiaServizio = tipologiaServizio;
  136.     }
  137.    
  138.    
  139.     /** Accordo di Servizio OpenSPCoop */
  140.     private org.openspcoop2.core.registry.AccordoServizioParteComune accordoServizio;
  141.     public org.openspcoop2.core.registry.AccordoServizioParteComune getAccordoServizio() {
  142.         return this.accordoServizio;
  143.     }
  144.     public void setAccordoServizio(
  145.             org.openspcoop2.core.registry.AccordoServizioParteComune accordoServizio) {
  146.         this.accordoServizio = accordoServizio;
  147.     }

  148.    
  149.     /** wsdl implementativi */
  150.     private String locationWsdlImplementativoErogatore;
  151.     private String locationWsdlImplementativoFruitore;
  152.     private byte[] bytesWsdlImplementativoErogatore;
  153.     private byte[] bytesWsdlImplementativoFruitore;
  154.     public String getLocationWsdlImplementativoErogatore() {
  155.         return this.locationWsdlImplementativoErogatore;
  156.     }
  157.     public void setLocationWsdlImplementativoErogatore(
  158.             String locationWsdlImplementativoErogatore) {
  159.         this.locationWsdlImplementativoErogatore = locationWsdlImplementativoErogatore;
  160.     }
  161.     public String getLocationWsdlImplementativoFruitore() {
  162.         return this.locationWsdlImplementativoFruitore;
  163.     }
  164.     public void setLocationWsdlImplementativoFruitore(
  165.             String locationWsdlImplementativoFruitore) {
  166.         this.locationWsdlImplementativoFruitore = locationWsdlImplementativoFruitore;
  167.     }
  168.     public byte[] getBytesWsdlImplementativoErogatore() {
  169.         return this.bytesWsdlImplementativoErogatore;
  170.     }
  171.     public void setBytesWsdlImplementativoErogatore(
  172.             byte[] bytesWsdlImplementativoErogatore) {
  173.         this.bytesWsdlImplementativoErogatore = bytesWsdlImplementativoErogatore;
  174.     }
  175.     public byte[] getBytesWsdlImplementativoFruitore() {
  176.         return this.bytesWsdlImplementativoFruitore;
  177.     }
  178.     public void setBytesWsdlImplementativoFruitore(
  179.             byte[] bytesWsdlImplementativoFruitore) {
  180.         this.bytesWsdlImplementativoFruitore = bytesWsdlImplementativoFruitore;
  181.     }


  182.    
  183.     @Override
  184.     public AccordoServizioWrapper clone(){
  185.         return this.clone(true);
  186.     }
  187.     public AccordoServizioWrapper clone(boolean clonePortTypeList){
  188.         AccordoServizioWrapper as = new AccordoServizioWrapper();
  189.        
  190.         if(this.accordoServizio!=null)
  191.             as.accordoServizio = (AccordoServizioParteComune) this.accordoServizio.clone();
  192.        
  193.         as.bytesWsdlImplementativoErogatore = this.bytesWsdlImplementativoErogatore;
  194.         as.bytesWsdlImplementativoFruitore = this.bytesWsdlImplementativoFruitore;
  195.        
  196.         if(this.idAccordoServizio!=null)
  197.             as.idAccordoServizio = this.idAccordoServizio.clone();
  198.        
  199.         as.locationWsdlImplementativoErogatore = this.locationWsdlImplementativoErogatore;
  200.         as.locationWsdlImplementativoFruitore = this.locationWsdlImplementativoFruitore;
  201.        
  202.         if(this.nomePortType!=null)
  203.             as.nomePortType = new String(this.nomePortType);
  204.        
  205.         if(clonePortTypeList && this.portTypeList!=null){
  206.             as.portTypeList = new ArrayList<PortType>();
  207.             for (PortType pt : this.portTypeList) {
  208.                 as.addPortType((PortType) pt.clone());
  209.             }
  210.         }
  211.            
  212.         as.portTypesLoadedFromWSDL = this.portTypesLoadedFromWSDL;
  213.        
  214.         as.schema = this.schema;
  215.        
  216.         as.tipologiaServizio = this.tipologiaServizio;
  217.        
  218.         return as;
  219.     }

  220. }