/******************************************************************************* * Copyright 2014 Federal Chancellery Austria * MOA-ID has been developed in a cooperation between BRZ, the Federal * Chancellery Austria - ICT staff unit, and Graz University of Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * 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.gv.egovernment.moa.id.configuration.data; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; import at.gv.egovernment.moa.id.util.FormBuildUtils; import at.gv.egovernment.moa.util.MiscUtil; public class FormularCustomization { private boolean showMandateLoginButton = true; private boolean onlyMandateAllowed = false; private String fontType = null; private String frontColor = null; private String backGroundColor = null; private String header_FrontColor = null; private String header_BackGroundColor = null; private String header_text = null; private String button_BackGroundColor = null; private String button_BackGroundColorFocus = null; private String button_FrontColor = null; private String appletRedirectTarget = null; public static List appletRedirectTargetList = null; public static List fontTypeList = null; public String fontTypeListValue = null; public FormularCustomization() { appletRedirectTargetList = Arrays.asList("","_blank","_self","_parent","_top"); fontTypeList = Arrays.asList("","Verdana","Geneva","Arial","Helvetica","sans-serif","Times New Roman"); Collections.sort(fontTypeList); } public void parse(OnlineApplication dbOAConfig, Map map) { AuthComponentOA auth = dbOAConfig.getAuthComponentOA(); if (auth != null) { TemplatesType templates = auth.getTemplates(); if (templates != null) { BKUSelectionCustomizationType formcustom = templates.getBKUSelectionCustomization(); if (formcustom != null) { if (formcustom.isMandateLoginButton() != null) { showMandateLoginButton = formcustom.isMandateLoginButton(); } if (formcustom.isOnlyMandateLoginAllowed() != null) { onlyMandateAllowed = formcustom.isOnlyMandateLoginAllowed(); } if (MiscUtil.isNotEmpty(formcustom.getAppletRedirectTarget())) appletRedirectTarget = formcustom.getAppletRedirectTarget(); if (MiscUtil.isNotEmpty(formcustom.getBackGroundColor())) { backGroundColor = formcustom.getBackGroundColor(); map.put(FormBuildUtils.MAIN_BACKGROUNDCOLOR, formcustom.getBackGroundColor()); } if (MiscUtil.isNotEmpty(formcustom.getButtonBackGroundColor())) { button_BackGroundColor = formcustom.getButtonBackGroundColor(); map.put(FormBuildUtils.BUTTON_BACKGROUNDCOLOR, formcustom.getButtonBackGroundColor()); } if (MiscUtil.isNotEmpty(formcustom.getButtonBackGroundColorFocus())) { button_BackGroundColorFocus = formcustom.getButtonBackGroundColorFocus(); map.put(FormBuildUtils.BUTTON_BACKGROUNDCOLOR_FOCUS, formcustom.getButtonBackGroundColorFocus()); } if (MiscUtil.isNotEmpty(formcustom.getButtonFontColor())) { button_FrontColor = formcustom.getButtonFontColor(); map.put(FormBuildUtils.BUTTON_COLOR, formcustom.getButtonFontColor()); } if (MiscUtil.isNotEmpty(formcustom.getFontType())) { fontType = formcustom.getFontType(); map.put(FormBuildUtils.FONTFAMILY, formcustom.getFontType()); } if (MiscUtil.isNotEmpty(formcustom.getFrontColor())) { frontColor = formcustom.getFrontColor(); map.put(FormBuildUtils.MAIN_COLOR, formcustom.getFrontColor()); } if (MiscUtil.isNotEmpty(formcustom.getHeaderBackGroundColor())) { header_BackGroundColor = formcustom.getHeaderBackGroundColor(); map.put(FormBuildUtils.HEADER_BACKGROUNDCOLOR, formcustom.getHeaderBackGroundColor()); } if (MiscUtil.isNotEmpty(formcustom.getHeaderFrontColor())) { header_FrontColor = formcustom.getHeaderFrontColor(); map.put(FormBuildUtils.HEADER_COLOR, formcustom.getHeaderFrontColor()); } if (MiscUtil.isNotEmpty(formcustom.getHeaderText())) { header_text = formcustom.getHeaderText(); map.put(FormBuildUtils.HEADER_TEXT, formcustom.getHeaderText()); } } } } } /** * @return the showMandateLoginButton */ public boolean isShowMandateLoginButton() { return showMandateLoginButton; } /** * @param showMandateLoginButton the showMandateLoginButton to set */ public void setShowMandateLoginButton(boolean showMandateLoginButton) { this.showMandateLoginButton = showMandateLoginButton; } /** * @return the onlyMandateAllowed */ public boolean isOnlyMandateAllowed() { return onlyMandateAllowed; } /** * @param onlyMandateAllowed the onlyMandateAllowed to set */ public void setOnlyMandateAllowed(boolean onlyMandateAllowed) { this.onlyMandateAllowed = onlyMandateAllowed; } /** * @return the fontType */ public String getFontType() { return fontType; } /** * @param fontType the fontType to set */ public void setFontType(String fontType) { this.fontType = fontType; } /** * @return the frontColor */ public String getFrontColor() { return frontColor; } /** * @param frontColor the frontColor to set */ public void setFrontColor(String frontColor) { this.frontColor = frontColor; } /** * @return the backGroundColor */ public String getBackGroundColor() { return backGroundColor; } /** * @param backGroundColor the backGroundColor to set */ public void setBackGroundColor(String backGroundColor) { this.backGroundColor = backGroundColor; } /** * @return the header_FrontColor */ public String getHeader_FrontColor() { return header_FrontColor; } /** * @param header_FrontColor the header_FrontColor to set */ public void setHeader_FrontColor(String header_FrontColor) { this.header_FrontColor = header_FrontColor; } /** * @return the header_BackGroundColor */ public String getHeader_BackGroundColor() { return header_BackGroundColor; } /** * @param header_BackGroundColor the header_BackGroundColor to set */ public void setHeader_BackGroundColor(String header_BackGroundColor) { this.header_BackGroundColor = header_BackGroundColor; } /** * @return the header_text */ public String getHeader_text() { return header_text; } /** * @param header_text the header_text to set */ public void setHeader_text(String header_text) { this.header_text = header_text; } /** * @return the button_BackGroundColor */ public String getButton_BackGroundColor() { return button_BackGroundColor; } /** * @param button_BackGroundColor the button_BackGroundColor to set */ public void setButton_BackGroundColor(String button_BackGroundColor) { this.button_BackGroundColor = button_BackGroundColor; } /** * @return the button_BackGroundColorFocus */ public String getButton_BackGroundColorFocus() { return button_BackGroundColorFocus; } /** * @param button_BackGroundColorFocus the button_BackGroundColorFocus to set */ public void setButton_BackGroundColorFocus(String button_BackGroundColorFocus) { this.button_BackGroundColorFocus = button_BackGroundColorFocus; } /** * @return the button_FrontColor */ public String getButton_FrontColor() { return button_FrontColor; } /** * @param button_FrontColor the button_FrontColor to set */ public void setButton_FrontColor(String button_FrontColor) { this.button_FrontColor = button_FrontColor; } /** * @return the appletRedirectTarget */ public String getAppletRedirectTarget() { return appletRedirectTarget; } /** * @param appletRedirectTarget the appletRedirectTarget to set */ public void setAppletRedirectTarget(String appletRedirectTarget) { this.appletRedirectTarget = appletRedirectTarget; } /** * @return the appletredirecttargetlist */ public List getAppletRedirectTargetList() { return appletRedirectTargetList; } /** * @return the fontTypeList */ public List getFontTypeList() { return fontTypeList; } /** * @return the fontTypeListValue */ public String getFontTypeListValue() { return fontTypeListValue; } /** * @param fontTypeListValue the fontTypeListValue to set */ public void setFontTypeListValue(String fontTypeListValue) { this.fontTypeListValue = fontTypeListValue; } }