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.autenticazione;

  21. import org.openspcoop2.pdd.core.connettori.InfoConnettoreIngresso;
  22. import org.openspcoop2.protocol.sdk.state.IState;
  23. import org.openspcoop2.protocol.sdk.state.RequestInfo;

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

  32.     private InfoConnettoreIngresso infoConnettoreIngresso;
  33.    
  34.     private IState state;
  35.    
  36.     private RequestInfo requestInfo;
  37.    
  38.     public InfoConnettoreIngresso getInfoConnettoreIngresso() {
  39.         return this.infoConnettoreIngresso;
  40.     }
  41.     public void setInfoConnettoreIngresso(
  42.             InfoConnettoreIngresso infoConnettoreIngresso) {
  43.         this.infoConnettoreIngresso = infoConnettoreIngresso;
  44.     }

  45.     public IState getState() {
  46.         return this.state;
  47.     }
  48.     public void setState(IState state) {
  49.         this.state = state;
  50.     }
  51.    
  52.     public RequestInfo getRequestInfo() {
  53.         return this.requestInfo;
  54.     }
  55.     public void setRequestInfo(RequestInfo requestInfo) {
  56.         this.requestInfo = requestInfo;
  57.     }
  58.    
  59.     public String getKeyCache(){
  60.         return this._toString(true);
  61.     }
  62.    
  63.     @Override
  64.     public String toString(){
  65.         return this._toString(false);
  66.     }
  67.     public String _toString(boolean keyCache){
  68.         StringBuilder bf = new StringBuilder();
  69.        
  70.         if(this.infoConnettoreIngresso!=null){
  71.             if(this.infoConnettoreIngresso.getSoapAction()!=null){
  72.                 bf.append(" SOAPAction:").append(this.infoConnettoreIngresso.getSoapAction());
  73.             }
  74.             if(keyCache==false){
  75.                 if(this.infoConnettoreIngresso.getFromLocation()!=null){
  76.                     bf.append(" FromLocation:").append(this.infoConnettoreIngresso.getFromLocation());
  77.                 }
  78.             }
  79.             if(this.infoConnettoreIngresso.getCredenziali()!=null){
  80.                 if(this.infoConnettoreIngresso.getCredenziali()!=null){
  81.                     boolean showPassword = false;
  82.                     boolean showIssuer = false;
  83.                     boolean showDigestClientCert = false;
  84.                     boolean showSerialNumberClientCert = false;
  85.                     if(keyCache) {
  86.                         showPassword = true;
  87.                         showIssuer = true;
  88.                         showDigestClientCert = true;
  89.                         showSerialNumberClientCert = true;
  90.                     }
  91.                     bf.append(" Credenziali(").append(this.infoConnettoreIngresso.getCredenziali().toString(showPassword, showIssuer, showDigestClientCert, showSerialNumberClientCert));
  92.                     bf.append(")");
  93.                 }
  94.                 if(keyCache==false){
  95.                     if(this.infoConnettoreIngresso.getUrlProtocolContext()!=null){
  96.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getFunction()!=null){
  97.                             bf.append(" UrlProtocolContext_Function:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getFunction());
  98.                         }
  99.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getFunctionParameters()!=null){
  100.                             bf.append(" UrlProtocolContext_FunctionParameters:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getFunctionParameters());
  101.                         }
  102.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolName()!=null){
  103.                             bf.append(" UrlProtocolContext_ProtocolName:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolName());
  104.                         }
  105.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolWebContext()!=null){
  106.                             bf.append(" UrlProtocolContext_ProtocolWebContext:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getProtocolWebContext());
  107.                         }
  108.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getRequestURI()!=null){
  109.                             bf.append(" UrlProtocolContext_RequestURI:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getRequestURI());
  110.                         }
  111.                         if(this.infoConnettoreIngresso.getUrlProtocolContext().getWebContext()!=null){
  112.                             bf.append(" UrlProtocolContext_WebContext:").append(this.infoConnettoreIngresso.getUrlProtocolContext().getWebContext());
  113.                         }
  114.                     }
  115.                 }
  116.             }
  117.         }
  118.        
  119.         if(keyCache==false){
  120.             if(this.state!=null){
  121.                 bf.append(" State:defined");
  122.             }
  123.         }
  124.        
  125.         return bf.toString();
  126.     }
  127. }