AbstractDatiInvocazione.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.pdd.core.autorizzazione;

  21. import org.openspcoop2.core.id.IDServizio;
  22. import org.openspcoop2.pdd.core.PdDContext;
  23. import org.openspcoop2.pdd.core.connettori.InfoConnettoreIngresso;
  24. import org.openspcoop2.protocol.sdk.Busta;
  25. import org.openspcoop2.protocol.sdk.state.IState;
  26. import org.openspcoop2.protocol.sdk.state.RequestInfo;

  27. /**
  28.  * AbstractDatiInvocazione
  29.  *
  30.  * @author Andrea Poli (apoli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */
  34. public abstract class AbstractDatiInvocazione {

  35.     private PdDContext pddContext;
  36.    
  37.     private InfoConnettoreIngresso infoConnettoreIngresso;
  38.    
  39.     private RequestInfo requestInfo;
  40.    
  41.     private IDServizio idServizio;
  42.    
  43.     private IState state;
  44.    
  45.     private String token;
  46.    
  47.     private Busta busta;
  48.    
  49.     public Busta getBusta() {
  50.         return this.busta;
  51.     }
  52.     public void setBusta(Busta busta) {
  53.         this.busta = busta;
  54.     }
  55.    
  56.     public String getToken() {
  57.         return this.token;
  58.     }
  59.     public void setToken(String token) {
  60.         this.token = token;
  61.     }
  62.    
  63.     public PdDContext getPddContext() {
  64.         return this.pddContext;
  65.     }
  66.     public void setPddContext(PdDContext pddContext) {
  67.         this.pddContext = pddContext;
  68.     }
  69.    
  70.     public InfoConnettoreIngresso getInfoConnettoreIngresso() {
  71.         return this.infoConnettoreIngresso;
  72.     }
  73.     public void setInfoConnettoreIngresso(
  74.             InfoConnettoreIngresso infoConnettoreIngresso) {
  75.         this.infoConnettoreIngresso = infoConnettoreIngresso;
  76.     }

  77.     public IDServizio getIdServizio() {
  78.         return this.idServizio;
  79.     }
  80.     public void setIdServizio(IDServizio idServizio) {
  81.         this.idServizio = idServizio;
  82.     }

  83.     public IState getState() {
  84.         return this.state;
  85.     }
  86.     public void setState(IState state) {
  87.         this.state = state;
  88.     }
  89.    
  90.     public RequestInfo getRequestInfo() {
  91.         return this.requestInfo;
  92.     }
  93.     public void setRequestInfo(RequestInfo requestInfo) {
  94.         this.requestInfo = requestInfo;
  95.     }
  96.    
  97.     public String getKeyCache(){
  98.         return this._toString(true);
  99.     }
  100.    
  101.     @Override
  102.     public String toString(){
  103.         return this._toString(false);
  104.     }
  105.     public String _toString(boolean keyCache){
  106.         StringBuilder bf = new StringBuilder();
  107.        
  108.         if(this.idServizio!=null){
  109.             bf.append("IDServizio(");
  110.             bf.append(this.idServizio.toString());
  111.             bf.append(")");
  112.         }
  113.        
  114.         if(this.infoConnettoreIngresso!=null){
  115.             if(this.infoConnettoreIngresso.getSoapAction()!=null){
  116.                 bf.append(" SOAPAction:").append(this.infoConnettoreIngresso.getSoapAction());
  117.             }
  118.             if(keyCache==false){
  119.                 if(this.infoConnettoreIngresso.getFromLocation()!=null){
  120.                     bf.append(" FromLocation:").append(this.infoConnettoreIngresso.getFromLocation());
  121.                 }
  122.             }
  123.             if(this.infoConnettoreIngresso.getCredenziali()!=null){
  124.                 if(this.infoConnettoreIngresso.getCredenziali()!=null){
  125.                     bf.append(" Credenziali(").append(this.infoConnettoreIngresso.getCredenziali().toString());
  126.                     bf.append(")");
  127.                 }
  128.                 if(keyCache==false){
  129.                     if(this.infoConnettoreIngresso.getUrlProtocolContext()!=null){
  130.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getFunction()!=null){
  131.                             bf.append(" UrlProtocolContext_Function:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getFunction());
  132.                         }
  133.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getFunctionParameters()!=null){
  134.                             bf.append(" UrlProtocolContext_FunctionParameters:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getFunctionParameters());
  135.                         }
  136.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolName()!=null){
  137.                             bf.append(" UrlProtocolContext_ProtocolName:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolName());
  138.                         }
  139.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolWebContext()!=null){
  140.                             bf.append(" UrlProtocolContext_ProtocolWebContext:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolWebContext());
  141.                         }
  142.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getRequestURI()!=null){
  143.                             bf.append(" UrlProtocolContext_RequestURI:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getRequestURI());
  144.                         }
  145.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getWebContext()!=null){
  146.                             bf.append(" UrlProtocolContext_WebContext:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getWebContext());
  147.                         }
  148.                     }
  149.                 }
  150.             }
  151.         }
  152.                
  153.         if(keyCache==false){
  154.             if(this.state!=null){
  155.                 bf.append(" State:defined");
  156.             }
  157.         }
  158.        
  159.         if(this.token!=null) {
  160.             bf.append(" Token:").append(this.token);
  161.         }
  162.        
  163.         return bf.toString();
  164.     }
  165. }