package at.gv.egiz.eaaf.modules.auth.sl20.exceptions; import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; public class SL20VdaResponseException extends SL20Exception { private static final long serialVersionUID = 6834803380740916320L; private String vdaSessionId = null; /** * ErrorCode that was provided by VDA. */ @Getter @Setter private String sl20ErrorCode = null; /** * In case of an error from VDA. * * @param messageId internal errorId * @param parameters error parameters */ public SL20VdaResponseException(String messageId, Object[] parameters) { super(messageId, parameters); } /** * In case of an error from VDA. * * @param messageId internal errorId * @param parameters error parameters * @param sl20ErrorCode ErrorCode that was provided by VDA */ public SL20VdaResponseException(String messageId, Object[] parameters, String sl20ErrorCode) { super(messageId, parameters); this.sl20ErrorCode = sl20ErrorCode; } /** * In case of an error from VDA. * * @param messageId internal errorId * @param parameters error parameters * @param wrapped Exception that was original thrown */ public SL20VdaResponseException(String messageId, Object[] parameters, Throwable wrapped) { super(messageId, parameters, wrapped); } /** * Get a SessionId that was provided by VDA in SL2.0 error-response. * * @return SessionId for an additional VDA request, or null * if no SessionId was provided. */ @Nullable public String getVdaSessionId() { return vdaSessionId; } /** * Set SessionId from VDA that can be used for an further request to VDA for the same user. * * @param vdaSessionId SessionId provided by VDA */ public void setVdaSessionId(@Nullable String vdaSessionId) { this.vdaSessionId = vdaSessionId; } /** * Create a clone of this exception, but set a new messageId. * * @param messageId internal error-code as messageId * @return Exception with new error-code */ public SL20VdaResponseException cloneWith(String messageId) { SL20VdaResponseException error = new SL20VdaResponseException(messageId, this.getParams(), this.getCause()); error.setSl20ErrorCode(this.sl20ErrorCode); error.setVdaSessionId(this.vdaSessionId); return error; } }