From a83cb260d07d54aba1ea354f76f0eb8943cc8c6f Mon Sep 17 00:00:00 2001 From: lalber Date: Thu, 8 Apr 2021 12:41:01 +0200 Subject: Rename interface --- .../core/impl/idp/auth/services/IErrorService.java | 92 ++++++++++++++++++++++ .../idp/auth/services/IErrorTicketService.java | 92 ---------------------- .../services/ProtocolAuthenticationService.java | 22 +++--- 3 files changed, 103 insertions(+), 103 deletions(-) create mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java delete mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorTicketService.java (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java new file mode 100644 index 00000000..7c9c34c9 --- /dev/null +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorService.java @@ -0,0 +1,92 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth.services; + +import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration; +import at.gv.egiz.eaaf.core.exceptions.EaafException; + +import javax.servlet.http.HttpServletRequest; + +public interface IErrorService { + /** + * Describes the kind of action that should be taken. + */ + enum ActionType { + TICKET_REDIRECT("ticket_redirect"), TICKET_NOREDIRECT("ticket_noredirect"), NOTICKET_REDIRECT( + "noticket_redirect"), NOTICKET_NOREDIRECT("noticket_noredirect"), NOTICKET_AUTOREDIRECT( + "noticket_autoredirect"); + + private final String name; + + ActionType(final String text) { + this.name = text; + } + + @Override + public String toString() { + return name; + } + } + + String PARAM_GUI_TICKET = "supportTicket"; + String PARAM_GUI_REDIRECT = "redirectLink"; + + /** + * creates error handling data. + * + * @param throwable error + * @param req http request + * @return eror handle Data + * @throws EaafException In case of an internal error + */ + IHandleData createHandleData(Throwable throwable, HttpServletRequest req) throws EaafException; + + /** + * Displays the error using suitable errordata. + * + * @param c guibuilder + * @param errorData Data to handle + * @throws EaafException In case of an internal error + */ + void displayErrorData(ModifyableGuiBuilderConfiguration c, IErrorService.IHandleData errorData) + throws EaafException; + + /** + * Contains all the Model data for Error Handling. + */ + interface IHandleData { + /** + * Describes the kind of action that should be taken. + * + * @return The appropriate action + */ + ActionType getActionType(); + + /** + * Get internal errorCode describing the problem. + * + * @return internal error Code. + */ + String getInternalErrorCode(); + + /** + * Get the original throwable of the error. + * + * @return causing throwable + */ + Throwable getThrowable(); + + /** + * Logs error to technical log. + */ + void log_error(); + + /** + * Logs info to technical log. + */ + void log_info(); + + /** + * Logs warn to technical log. + */ + void log_warn(); + } +} diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorTicketService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorTicketService.java deleted file mode 100644 index 15a4c7b1..00000000 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/IErrorTicketService.java +++ /dev/null @@ -1,92 +0,0 @@ -package at.gv.egiz.eaaf.core.impl.idp.auth.services; - -import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration; -import at.gv.egiz.eaaf.core.exceptions.EaafException; - -import javax.servlet.http.HttpServletRequest; - -public interface IErrorTicketService { - /** - * Describes the kind of action that should be taken. - */ - enum ActionType { - TICKET_REDIRECT("ticket_redirect"), TICKET_NOREDIRECT("ticket_noredirect"), NOTICKET_REDIRECT( - "noticket_redirect"), NOTICKET_NOREDIRECT("noticket_noredirect"), NOTICKET_AUTOREDIRECT( - "noticket_autoredirect"); - - private final String name; - - ActionType(final String text) { - this.name = text; - } - - @Override - public String toString() { - return name; - } - } - - String PARAM_GUI_TICKET = "supportTicket"; - String PARAM_GUI_REDIRECT = "redirectLink"; - - /** - * creates error handling data. - * - * @param throwable error - * @param req http request - * @return eror handle Data - * @throws EaafException In case of an internal error - */ - IHandleData createHandleData(Throwable throwable, HttpServletRequest req) throws EaafException; - - /** - * Displays the error using suitable errordata. - * - * @param c guibuilder - * @param errorData Data to handle - * @throws EaafException In case of an internal error - */ - void displayErrorData(ModifyableGuiBuilderConfiguration c, IErrorTicketService.IHandleData errorData) - throws EaafException; - - /** - * Contains all the Model data for Error Handling. - */ - interface IHandleData { - /** - * Describes the kind of action that should be taken. - * - * @return The appropriate action - */ - ActionType getActionType(); - - /** - * Get internal errorCode describing the problem. - * - * @return internal error Code. - */ - String getInternalErrorCode(); - - /** - * Get the original throwable of the error. - * - * @return causing throwable - */ - Throwable getThrowable(); - - /** - * Logs error to technical log. - */ - void log_error(); - - /** - * Logs info to technical log. - */ - void log_info(); - - /** - * Logs warn to technical log. - */ - void log_warn(); - } -} diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java index c1c2ab00..be24d586 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java @@ -103,7 +103,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer private IConfiguration basicConfig; @Autowired(required = true) - private IErrorTicketService errorTicketService; + private IErrorService errorTicketService; @Autowired(required = false) private ISsoManager ssoManager; @@ -232,10 +232,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer public void buildProtocolSpecificErrorResponse(final Throwable throwable, final HttpServletRequest req, final HttpServletResponse resp, final IRequest protocolRequest) throws EaafException, IOException { try { - IErrorTicketService.IHandleData errorData = errorTicketService.createHandleData(throwable, req); + IErrorService.IHandleData errorData = errorTicketService.createHandleData(throwable, req); - if (errorData.getActionType().equals(IErrorTicketService.ActionType.TICKET_REDIRECT) || errorData.getActionType() - .equals(IErrorTicketService.ActionType.NOTICKET_REDIRECT)) { + if (errorData.getActionType().equals(IErrorService.ActionType.TICKET_REDIRECT) || errorData.getActionType() + .equals(IErrorService.ActionType.NOTICKET_REDIRECT)) { // Put pending request ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); @@ -254,7 +254,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer displayException(req, resp, errorData); - } else if (errorData.getActionType().equals(IErrorTicketService.ActionType.NOTICKET_AUTOREDIRECT)) { + } else if (errorData.getActionType().equals(IErrorService.ActionType.NOTICKET_AUTOREDIRECT)) { IModulInfo handlingModule = extractShibbolethHandling(protocolRequest, applicationContext); if (handlingModule.generateErrorMessage(throwable, req, resp, protocolRequest)) { @@ -312,7 +312,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req, final HttpServletResponse resp, final boolean writeExceptionToStatisticLog) throws EaafException, IOException { - IErrorTicketService.IHandleData errorData = null; + IErrorService.IHandleData errorData = null; errorData = errorTicketService.createHandleData(throwable, req); // log Exception into statistic database @@ -323,8 +323,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer // write errror to console logExceptionToTechnicalLog(errorData); - if (errorData.getActionType().equals(IErrorTicketService.ActionType.NOTICKET_NOREDIRECT) || errorData - .getActionType().equals(IErrorTicketService.ActionType.TICKET_NOREDIRECT)) { + if (errorData.getActionType().equals(IErrorService.ActionType.NOTICKET_NOREDIRECT) || errorData + .getActionType().equals(IErrorService.ActionType.TICKET_NOREDIRECT)) { // return error to Web browser displayException(req, resp, errorData); } else { @@ -418,7 +418,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer * * @param data errordata structure */ - protected void logExceptionToTechnicalLog(IErrorTicketService.IHandleData data) { + protected void logExceptionToTechnicalLog(IErrorService.IHandleData data) { // In case of a TaskExecutionException, which is only a container for process-errors, // extract internal exception @@ -492,7 +492,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer private void writeHtmlErrorResponse(@NonNull final HttpServletRequest httpReq, @NonNull final HttpServletResponse httpResp, @NonNull final String msg, @NonNull final String errorCode, - @Nullable final Object[] params, String externalErrorCode, IErrorTicketService.IHandleData errorData) + @Nullable final Object[] params, String externalErrorCode, IErrorService.IHandleData errorData) throws EaafException { try { @@ -541,7 +541,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } private void displayException(final HttpServletRequest req, final HttpServletResponse resp, - final IErrorTicketService.IHandleData errorData) throws IOException, EaafException { + final IErrorService.IHandleData errorData) throws IOException, EaafException { final Throwable e = errorData.getThrowable(); final String internalErrorCode = errorData.getInternalErrorCode(); -- cgit v1.2.3