package at.gv.egovernment.moa.id.configuration.data.oa; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; 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.BKUURLS; import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector; import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.validation.TargetValidator; import at.gv.egovernment.moa.util.MiscUtil; public class OAGeneralConfig { private String dbID = null; private String bkuOnlineURL = null; private String bkuHandyURL = null; private String bkuLocalURL = null; private String identifier = null; private String friendlyName = null; private boolean businessService = false; private String target = null; private String target_subsector = null; private String target_admin = null; private static List targetList = null; private String targetFriendlyName = null; private boolean isAdminTarget = false; private String identificationNumber = null; private String identificationType = null; private static List identificationTypeList = null; private String aditionalAuthBlockText = null; private String mandateProfiles = null; private boolean isActive = false; private boolean calculateHPI = false; private String keyBoxIdentifier = null; private static Map keyBoxIdentifierList; private boolean legacy = false; List SLTemplates = null; private boolean isHideBPKAuthBlock = false; private boolean showMandateLoginButton = true; private boolean onlyMandateAllowed = false; private String bkuSelectionBackGroundColor = null; private Map transformations; public OAGeneralConfig() { keyBoxIdentifierList = new HashMap(); MOAKeyBoxSelector[] values = MOAKeyBoxSelector.values(); for (int i=0; i 1) target_subsector = target_split[1]; } else { target = ""; target_subsector = null; target_admin = target_full; isAdminTarget = true; } } targetFriendlyName = dbOAConfig.getTargetFriendlyName(); } if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE)) businessService = true; else businessService = false; AuthComponentOA oaauth = dbOAConfig.getAuthComponentOA(); if (oaauth != null) { BKUURLS bkuurls = oaauth.getBKUURLS(); String defaulthandy = ""; String defaultlocal = ""; String defaultonline = ""; MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); if (dbconfig != null) { DefaultBKUs defaultbkus = dbconfig.getDefaultBKUs(); if (defaultbkus != null) { defaulthandy = defaultbkus.getHandyBKU(); defaultlocal = defaultbkus.getLocalBKU(); defaultonline = defaultbkus.getOnlineBKU(); } } if (bkuurls != null) { if (MiscUtil.isEmpty(bkuurls.getHandyBKU())) bkuHandyURL = defaulthandy; else bkuHandyURL = bkuurls.getHandyBKU(); if (MiscUtil.isEmpty(bkuurls.getLocalBKU())) bkuLocalURL = defaultlocal; else bkuLocalURL = bkuurls.getLocalBKU(); if (MiscUtil.isEmpty(bkuurls.getOnlineBKU())) bkuOnlineURL = defaultonline; else bkuOnlineURL = bkuurls.getOnlineBKU(); } IdentificationNumber idnumber = oaauth.getIdentificationNumber(); if (idnumber != null) { String number = idnumber.getValue(); if (MiscUtil.isNotEmpty(number)) { String[] split = number.split("\\+"); if (Constants.PREFIX_WPBK.startsWith(split[0]) && split.length >= 2) { identificationType = split[1]; identificationNumber = split[2]; } } } Mandates mandates = oaauth.getMandates(); if (mandates != null) { mandateProfiles = mandates.getProfiles(); } TemplatesType templates = oaauth.getTemplates(); if (templates != null) { aditionalAuthBlockText = templates.getAditionalAuthBlockText(); List templatetype = templates.getTemplate(); if (templatetype != null) { if (SLTemplates == null) { SLTemplates = new ArrayList(); } for (TemplateType el : templatetype) { SLTemplates.add(el.getURL()); } } BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization(); if (bkuselectioncustom != null) { if (MiscUtil.isNotEmpty(bkuselectioncustom.getBackGroundColor())) bkuSelectionBackGroundColor = bkuselectioncustom.getBackGroundColor(); if (bkuselectioncustom.isMandateLoginButton() != null) showMandateLoginButton = bkuselectioncustom.isMandateLoginButton(); if (bkuselectioncustom.isOnlyMandateLoginAllowed() != null) onlyMandateAllowed = bkuselectioncustom.isOnlyMandateLoginAllowed(); } } if (SLTemplates != null && SLTemplates.size() > 0) legacy = true; List transforminfos = oaauth.getTransformsInfo(); transformations = new HashMap(); for (TransformsInfoType el : transforminfos) { transformations.put(el.getFilename(), el.getTransformation()); } } isHideBPKAuthBlock = dbOAConfig.isRemoveBPKFromAuthBlock(); } public String getIdentifier() { return identifier; } public void setIdentifier(String identifier) { this.identifier = identifier; } public String getFriendlyName() { return friendlyName; } public void setFriendlyName(String friendlyName) { this.friendlyName = friendlyName; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getTargetFriendlyName() { return targetFriendlyName; } public void setTargetFriendlyName(String targetFriendlyName) { this.targetFriendlyName = targetFriendlyName; } public String getIdentificationNumber() { return identificationNumber; } public void setIdentificationNumber(String identificationNumber) { this.identificationNumber = identificationNumber; } public String getIdentificationType() { return identificationType; } public void setIdentificationType(String identificationType) { this.identificationType = identificationType; } public String getAditionalAuthBlockText() { return aditionalAuthBlockText; } public void setAditionalAuthBlockText(String aditionalAuthBlockText) { this.aditionalAuthBlockText = aditionalAuthBlockText; } public String getMandateProfiles() { return mandateProfiles; } public void setMandateProfiles(String mandateProfiles) { this.mandateProfiles = mandateProfiles; } public boolean isActive() { return isActive; } public void setActive(boolean isActive) { this.isActive = isActive; } public boolean isBusinessService() { return businessService; } public void setBusinessService(boolean businessService) { this.businessService = businessService; } public String getBkuOnlineURL() { return bkuOnlineURL; } public void setBkuOnlineURL(String bkuOnlineURL) { this.bkuOnlineURL = bkuOnlineURL; } public String getBkuHandyURL() { return bkuHandyURL; } public void setBkuHandyURL(String bkuHandyURL) { this.bkuHandyURL = bkuHandyURL; } public String getBkuLocalURL() { return bkuLocalURL; } public void setBkuLocalURL(String bkuLocalURL) { this.bkuLocalURL = bkuLocalURL; } /** * @return the keyBoxIdentifier */ public String getKeyBoxIdentifier() { return keyBoxIdentifier; } /** * @param keyBoxIdentifier the keyBoxIdentifier to set */ public void setKeyBoxIdentifier(String keyBoxIdentifier) { this.keyBoxIdentifier = keyBoxIdentifier; } /** * @return the transformations */ public Map getTransformations() { return transformations; } /** * @param transformations the transformations to set */ public void setTransformations(Map transformations) { this.transformations = transformations; } /** * @return the dbID */ public String getDbID() { return dbID; } /** * @param dbID the dbID to set */ public void setDbID(long dbID) { this.dbID = String.valueOf(dbID); } /** * @param dbID the dbID to set */ public void setDbID(String dbID) { this.dbID = dbID; } /** * @return the calculateHPI */ public boolean isCalculateHPI() { return calculateHPI; } /** * @param calculateHPI the calculateHPI to set */ public void setCalculateHPI(boolean calculateHPI) { this.calculateHPI = calculateHPI; } /** * @return the keyBoxIdentifierList */ public Map getKeyBoxIdentifierList() { return keyBoxIdentifierList; } /** * @param keyBoxIdentifierList the keyBoxIdentifierList to set */ public void setKeyBoxIdentifierList(Map list) { keyBoxIdentifierList = list; } /** * @return the legacy */ public boolean isLegacy() { return legacy; } /** * @param legacy the legacy to set */ public void setLegacy(boolean legacy) { this.legacy = legacy; } /** * @return the sLTemplateURL1 */ public String getSLTemplateURL1() { if (SLTemplates != null && SLTemplates.size() > 0) return SLTemplates.get(0); else return null; } /** * @param sLTemplateURL1 the sLTemplateURL1 to set */ public void setSLTemplateURL1(String sLTemplateURL1) { if (SLTemplates == null) SLTemplates = new ArrayList(); SLTemplates.add(sLTemplateURL1); } /** * @return the sLTemplateURL2 */ public String getSLTemplateURL2() { if (SLTemplates != null && SLTemplates.size() > 1) return SLTemplates.get(1); else return null; } /** * @param sLTemplateURL2 the sLTemplateURL2 to set */ public void setSLTemplateURL2(String sLTemplateURL2) { if (SLTemplates == null) SLTemplates = new ArrayList(); SLTemplates.add(sLTemplateURL2); } /** * @return the sLTemplateURL3 */ public String getSLTemplateURL3() { if (SLTemplates != null && SLTemplates.size() > 2) return SLTemplates.get(2); else return null; } /** * @param sLTemplateURL3 the sLTemplateURL3 to set */ public void setSLTemplateURL3(String sLTemplateURL3) { if (SLTemplates == null) SLTemplates = new ArrayList(); SLTemplates.add(sLTemplateURL3); } /** * @return the target_subsector */ public String getTarget_subsector() { return target_subsector; } /** * @param target_subsector the target_subsector to set */ public void setTarget_subsector(String target_subsector) { this.target_subsector = target_subsector; } /** * @return the target_admin */ public String getTarget_admin() { return target_admin; } /** * @param target_admin the target_admin to set */ public void setTarget_admin(String target_admin) { this.target_admin = target_admin; } /** * @return the targetList */ public List getTargetList() { return targetList; } /** * @return the identificationTypeList */ public List getIdentificationTypeList() { return identificationTypeList; } /** * @return the isAdminTarget */ public boolean isAdminTarget() { return isAdminTarget; } /** * @param isAdminTarget the isAdminTarget to set */ public void setAdminTarget(boolean isAdminTarget) { this.isAdminTarget = isAdminTarget; } /** * @return the isHideBPKAuthBlock */ public boolean isHideBPKAuthBlock() { return isHideBPKAuthBlock; } /** * @param isHideBPKAuthBlock the isHideBPKAuthBlock to set */ public void setHideBPKAuthBlock(boolean isHideBPKAuthBlock) { this.isHideBPKAuthBlock = isHideBPKAuthBlock; } /** * @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 bkuSelectionBackGroundColor */ public String getBkuSelectionBackGroundColor() { return bkuSelectionBackGroundColor; } /** * @param bkuSelectionBackGroundColor the bkuSelectionBackGroundColor to set */ public void setBkuSelectionBackGroundColor(String bkuSelectionBackGroundColor) { this.bkuSelectionBackGroundColor = bkuSelectionBackGroundColor; } }