summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java90
1 files changed, 90 insertions, 0 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
new file mode 100644
index 00000000..0ab13a9b
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ *******************************************************************************/
+package at.gv.egiz.eaaf.core.impl.gui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration;
+
+/**
+ * @author tlenz
+ *
+ */
+public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilderConfiguration {
+
+ public static final String PARAM_AUTHCONTEXT = "contextPath";
+ public static final String PARAM_FORMSUBMITENDPOINT = "submitEndpoint";
+ public static final String PARAM_PENDINGREQUESTID = "pendingReqID";
+
+ private String authURL = null;
+ private String viewName = null;
+ private String formSubmitEndpoint = null;
+
+ /**
+ * @param authURL IDP PublicURL-Prefix which should be used, but never null
+ * @param viewName Name of the template (with suffix) but never null
+ * @param formSubmitEndpoint EndPoint on which the form should be submitted,
+ * or null if the form must not submitted
+ *
+ */
+ public AbstractGUIFormBuilderConfiguration(String authURL, String viewName, String formSubmitEndpoint) {
+ if (viewName.startsWith("/"))
+ this.viewName = viewName.substring(1);
+ else
+ this.viewName = viewName;
+
+ if (authURL.endsWith("/"))
+ this.authURL = authURL.substring(0, authURL.length() - 1);
+ else
+ this.authURL = authURL;
+
+ if (StringUtils.isNotEmpty(formSubmitEndpoint)) {
+ if (formSubmitEndpoint.startsWith("/"))
+ this.formSubmitEndpoint = formSubmitEndpoint;
+ else
+ this.formSubmitEndpoint = "/" + formSubmitEndpoint;
+ }
+ }
+
+
+ /**
+ * Define the parameters, which should be evaluated in the template <br>
+ * <b>IMPORTANT:</b> external HTML escapetion is required, because it is NOT done internally during the building process
+ *
+ * @return Map of parameters, which should be added to template
+ */
+ abstract protected Map<String, Object> getSpecificViewParameters();
+
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewName()
+ */
+ @Override
+ public final String getViewName() {
+ return this.viewName;
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters()
+ */
+ @Override
+ public final Map<String, Object> getViewParameters() {
+ //get parameters from detail implementation
+ Map<String, Object> specParams = getSpecificViewParameters();
+ if (specParams == null)
+ specParams = new HashMap<String, Object>();
+
+ //add generic parameters
+ specParams.put(PARAM_AUTHCONTEXT, this.authURL);
+ if (this.formSubmitEndpoint != null)
+ specParams.put(PARAM_FORMSUBMITENDPOINT, this.formSubmitEndpoint);
+
+ return specParams;
+
+ }
+
+}