From 552497957fe6509087fc9a1a33fae5812a615094 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 7 Mar 2022 18:20:34 +0100 Subject: refactor(core): move 'connector_lib' to 'core_common_lib' --- .../gui/StaticGuiBuilderConfiguration.java | 148 --------------------- 1 file changed, 148 deletions(-) delete mode 100644 connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java (limited to 'connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java') diff --git a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java deleted file mode 100644 index 9701ddda..00000000 --- a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2018 A-SIT Plus GmbH - * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, - * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "License"); - * You may not use this work except in compliance with the License. - * You may obtain a copy of the License at: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. -*/ - -package at.asitplus.eidas.specific.connector.gui; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.text.StringEscapeUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; - -import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.gui.GroupDefinition; -import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiBuilderConfiguration; -import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration; -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration; -import at.gv.egiz.eaaf.core.impl.utils.FileUtils; - -public class StaticGuiBuilderConfiguration extends AbstractGuiFormBuilderConfiguration implements - IVelocityGuiBuilderConfiguration, ModifyableGuiBuilderConfiguration { - private static final Logger log = LoggerFactory.getLogger(StaticGuiBuilderConfiguration.class); - - private IRequest pendingReq = null; - private IConfiguration basicConfig = null; - private ResourceLoader resourceLoader; - - /** - * Static resource configuration for GUI Builder implementations. - * - * @param basicConfig basicConfig - * @param authUrl Public URL of the application - * @param viewName Name of the template - * @param formSubmitEndpoint Form Submit end-point, if template contains a form. - * @param resourceLoader Spring ResourceLoader implementation - */ - public StaticGuiBuilderConfiguration(IConfiguration basicConfig, String authUrl, String viewName, - String formSubmitEndpoint, ResourceLoader resourceLoader) { - super(authUrl, viewName, formSubmitEndpoint); - this.basicConfig = basicConfig; - this.resourceLoader = resourceLoader; - - } - - /** - * Static resource configuration for GUI Builder implementations. - * - * @param basicConfig Application configuration - * @param pendingReq Current pending request - * @param viewName Name of the template - * @param formSubmitEndpoint Form Submit end-point, if template contains a form. - * @param resourceLoader Spring ResourceLoader implementation - */ - public StaticGuiBuilderConfiguration(IConfiguration basicConfig, IRequest pendingReq, String viewName, - String formSubmitEndpoint, ResourceLoader resourceLoader) { - super(pendingReq.getAuthUrl(), viewName, formSubmitEndpoint); - this.pendingReq = pendingReq; - this.basicConfig = basicConfig; - this.resourceLoader = resourceLoader; - - } - - @Override - public String getClasspathTemplateDir() { - return MsEidasNodeConstants.CLASSPATH_TEMPLATE_DIR; - - } - - @Override - public String getDefaultContentType() { - return null; - - } - - @Override - public InputStream getTemplate(String viewName) { - final String templateUrl = MsEidasNodeConstants.FILESYSTEM_TEMPLATE_DIR + viewName; - try { - final String absUrl = FileUtils.makeAbsoluteUrl(templateUrl, this.basicConfig - .getConfigurationRootDirectory()); - log.debug("Load template URL for view: " + viewName + " from: " + absUrl); - Resource resource = resourceLoader.getResource(absUrl); - return resource.getInputStream(); - - } catch (IOException e) { - log.info("Can can build filesytem path to template: " + templateUrl - + " Reason: " + e.getMessage()); - - } - - return null; - } - - @Override - public void putCustomParameterWithOutEscaption(GroupDefinition group, String key, Object value) { - setViewParameter(getFromGroup(), key, value); - - } - - @Override - public void putCustomParameter(GroupDefinition group, String key, String value) { - setViewParameter(getFromGroup(), key, StringEscapeUtils.escapeHtml4(value)); - - } - - @Override - protected void putSpecificViewParameters() { - if (pendingReq != null) { - setViewParameter(getFromGroup(), PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml4(pendingReq - .getPendingRequestId())); - setViewParameter(getFromGroup(), PARAM_PENDINGREQUESTID_DEPRECATED, StringEscapeUtils.escapeHtml4( - pendingReq.getPendingRequestId())); - - } - - } - - @Override - protected GroupDefinition getFromGroup() { - return null; - - } - -} -- cgit v1.2.3