/******************************************************************************* * 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.oa; import java.io.File; 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.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 useMandates = false; 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 Map transformations; private List bkuSelectionFileUpload = null; private List bkuSelectionFileUploadContentType = null; private List bkuSelectionFileUploadFileName = new ArrayList(); private List sendAssertionFileUpload = null; private List sendAssertionFileUploadContentType = null; private List sendAssertionFileUploadFileName = new ArrayList();; private boolean deleteBKUTemplate = false; private boolean deleteSendAssertionTemplate = false; 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) { if (MiscUtil.isNotEmpty(mandates.getProfiles())) { mandateProfiles = mandates.getProfiles(); useMandates = true; } else { mandateProfiles = new String(); useMandates = false; } } 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()); } } TransformsInfoType bkuSelectTemplate = templates.getBKUSelectionTemplate(); if (bkuSelectTemplate != null && MiscUtil.isNotEmpty(bkuSelectTemplate.getFilename())) { bkuSelectionFileUploadFileName.add(bkuSelectTemplate.getFilename()); } TransformsInfoType sendAssertionTemplate = templates.getSendAssertionTemplate(); if (sendAssertionTemplate != null && MiscUtil.isNotEmpty(sendAssertionTemplate.getFilename())) { sendAssertionFileUploadFileName.add(sendAssertionTemplate.getFilename()); } } 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 useMandates */ public boolean isUseMandates() { return useMandates; } /** * @param useMandates the useMandates to set */ public void setUseMandates(boolean useMandates) { this.useMandates = useMandates; } /** * @return the bkuSelectionFileUpload */ public List getBkuSelectionFileUpload() { return bkuSelectionFileUpload; } /** * @param bkuSelectionFileUpload the bkuSelectionFileUpload to set */ public void setBkuSelectionFileUpload(List bkuSelectionFileUpload) { this.bkuSelectionFileUpload = bkuSelectionFileUpload; } /** * @return the bkuSelectionFileUploadContentType */ public List getBkuSelectionFileUploadContentType() { return bkuSelectionFileUploadContentType; } /** * @param bkuSelectionFileUploadContentType the bkuSelectionFileUploadContentType to set */ public void setBkuSelectionFileUploadContentType( List bkuSelectionFileUploadContentType) { this.bkuSelectionFileUploadContentType = bkuSelectionFileUploadContentType; } /** * @return the bkuSelectionFileUploadFileName */ public List getBkuSelectionFileUploadFileName() { return bkuSelectionFileUploadFileName; } /** * @param bkuSelectionFileUploadFileName the bkuSelectionFileUploadFileName to set */ public void setBkuSelectionFileUploadFileName( List bkuSelectionFileUploadFileName) { this.bkuSelectionFileUploadFileName = bkuSelectionFileUploadFileName; } /** * @return the sendAssertionFileUpload */ public List getSendAssertionFileUpload() { return sendAssertionFileUpload; } /** * @param sendAssertionFileUpload the sendAssertionFileUpload to set */ public void setSendAssertionFileUpload(List sendAssertionFileUpload) { this.sendAssertionFileUpload = sendAssertionFileUpload; } /** * @return the sendAssertionFileUploadContentType */ public List getSendAssertionFileUploadContentType() { return sendAssertionFileUploadContentType; } /** * @param sendAssertionFileUploadContentType the sendAssertionFileUploadContentType to set */ public void setSendAssertionFileUploadContentType( List sendAssertionFileUploadContentType) { this.sendAssertionFileUploadContentType = sendAssertionFileUploadContentType; } /** * @return the sendAssertionFileUploadFileName */ public List getSendAssertionFileUploadFileName() { return sendAssertionFileUploadFileName; } /** * @param sendAssertionFileUploadFileName the sendAssertionFileUploadFileName to set */ public void setSendAssertionFileUploadFileName( List sendAssertionFileUploadFileName) { this.sendAssertionFileUploadFileName = sendAssertionFileUploadFileName; } /** * @return the deleteBKUTemplate */ public boolean isDeleteBKUTemplate() { return deleteBKUTemplate; } /** * @param deleteBKUTemplate the deleteBKUTemplate to set */ public void setDeleteBKUTemplate(boolean deleteBKUTemplate) { this.deleteBKUTemplate = deleteBKUTemplate; } /** * @return the deleteSendAssertionTemplate */ public boolean isDeleteSendAssertionTemplate() { return deleteSendAssertionTemplate; } /** * @param deleteSendAssertionTemplate the deleteSendAssertionTemplate to set */ public void setDeleteSendAssertionTemplate(boolean deleteSendAssertionTemplate) { this.deleteSendAssertionTemplate = deleteSendAssertionTemplate; } }