GestoreTrasformazioniException.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.trasformazioni;

  21. import org.openspcoop2.message.OpenSPCoop2Message;
  22. import org.openspcoop2.message.OpenSPCoop2MessageFactory;
  23. import org.openspcoop2.message.constants.MessageRole;
  24. import org.openspcoop2.message.constants.MessageType;
  25. import org.openspcoop2.pdd.core.dynamic.ErrorMessage;
  26. import org.openspcoop2.protocol.sdk.constants.IntegrationFunctionError;

  27. /**
  28.  * Contiene la definizione di una eccezione lanciata dalla classe GestoreTrasformazioni
  29.  *
  30.  * @author Andrea Poli (apoli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */


  34. public class GestoreTrasformazioniException extends Exception  {
  35.    
  36.     /**
  37.      * SerialUID
  38.      */
  39.     private static final long serialVersionUID = 1L;

  40.     private ErrorMessage errorMessage = null;
  41.     private OpenSPCoop2Message errorOp2Message = null;
  42.     private IntegrationFunctionError op2IntegrationFunctionError;
  43.    
  44.     public GestoreTrasformazioniException(String message, Throwable cause)
  45.     {
  46.         super(message, cause);
  47.         // TODO Auto-generated constructor stub
  48.     }
  49.     public GestoreTrasformazioniException(Throwable cause)
  50.     {
  51.         super(cause);
  52.         // TODO Auto-generated constructor stub
  53.     }

  54.     public GestoreTrasformazioniException() {
  55.         super();
  56.     }
  57.     public GestoreTrasformazioniException(String msg) {
  58.         super(msg);
  59.     }
  60.    
  61.     public GestoreTrasformazioniException(String detail, ErrorMessage errorMessage) {
  62.         super(detail);
  63.         this.errorMessage = errorMessage;
  64.     }
  65.    
  66.     public GestoreTrasformazioniException(String detail, OpenSPCoop2Message errorOp2Message, IntegrationFunctionError op2IntegrationFunctionError) {
  67.         super(detail);
  68.         this.errorOp2Message = errorOp2Message;
  69.         this.op2IntegrationFunctionError = op2IntegrationFunctionError;
  70.     }
  71.    
  72.     public OpenSPCoop2Message getOpenSPCoop2ErrorMessage() {
  73.         if(this.errorOp2Message!=null) {
  74.             return this.errorOp2Message;
  75.         }
  76.         if(this.errorMessage==null) {
  77.             return null;
  78.         }
  79.         OpenSPCoop2Message op2ErrorMessage = OpenSPCoop2MessageFactory.getDefaultMessageFactory().createEmptyMessage(MessageType.BINARY, MessageRole.FAULT);
  80.         op2ErrorMessage.forceResponse(this.errorMessage);
  81.         return op2ErrorMessage;
  82.     }
  83.     public IntegrationFunctionError getOp2IntegrationFunctionError() {
  84.         return this.op2IntegrationFunctionError;
  85.     }

  86. }