📄 ejbcawebbean.java
字号:
public AuthorizationDataHandler getAuthorizationDataHandler(){ return authorizedatahandler; } /* Returns the global configuration */ public GlobalConfiguration getGlobalConfiguration() { return this.informationmemory.getGlobalConfiguration(); } /** A functions that returns wanted helpfile in prefered language. * The parameter helpfilename should the wanted filename without language infix. * For example: given helpfilename 'cahelp.html' would return 'cahelp.en.html' * if english was the users prefered language. */ public String getHelpfileInfix(String helpfilename) { String returnedurl=null; String prefered = WebLanguages.getAvailableLanguages()[currentadminpreference.getPreferedLanguage()] .toLowerCase(); String secondary = WebLanguages.getAvailableLanguages()[currentadminpreference.getSecondaryLanguage()] .toLowerCase(); String helpfile = helpfilename.substring(0,helpfilename.lastIndexOf('.')); String postfix = helpfilename.substring(helpfilename.lastIndexOf('.')+1); String preferedfilename = "/" + globalconfiguration.getHelpPath()+"/" + helpfile + "." + prefered + "." + postfix; String secondaryfilename = "/" + globalconfiguration .getHelpPath()+"/" + helpfile + "." + secondary + "." + postfix; String preferedurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getHelpPath()+"/" + helpfile + "." + prefered + "." + postfix; String secondaryurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getHelpPath()+"/" + helpfile + "." + secondary + "." + postfix; if(this.getClass().getResourceAsStream(preferedfilename) != null) returnedurl = preferedurl; else returnedurl = secondaryurl; return returnedurl; } /** A functions that returns wanted imagefile in prefered language and theme. If none of the language * specific images are found the original imagefilename will be returned. * * The priority of filenames are int the following order * 1. imagename.theme.preferedlanguage.jpg/gif * 2. imagename.theme.secondarylanguage.jpg/gif * 3. imagename.theme.jpg/gif * 4. imagename.preferedlanguage.jpg/gif * 5. imagename.secondarylanguage.jpg/gif * 6. imagename.jpg/gif * * The parameter imagefilename should the wanted filename without language infix. * For example: given imagefilename 'caimg.gif' would return 'caimg.en.gif' * if english was the users prefered language. It's important that all letters i imagefilename is lowercase.*/ public String getImagefileInfix(String imagefilename) { String returnedurl=null; String prefered = WebLanguages.getAvailableLanguages()[currentadminpreference.getPreferedLanguage()] .toLowerCase(); String secondary = WebLanguages.getAvailableLanguages()[currentadminpreference.getSecondaryLanguage()] .toLowerCase(); String imagefile = imagefilename.substring(0,imagefilename.lastIndexOf('.')); String theme = currentadminpreference.getTheme().toLowerCase(); String postfix = imagefilename.substring(imagefilename.lastIndexOf('.')+1); String preferedthemefilename = "/" + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + prefered + "." + postfix; String secondarythemefilename = "/" + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + secondary + "." + postfix; String themefilename = "/" + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + postfix; String preferedfilename = "/" + globalconfiguration .getImagesPath()+"/" + imagefile + "." + prefered + "." + postfix; String secondaryfilename = "/" + globalconfiguration .getImagesPath()+"/" + imagefile + "." + secondary + "." + postfix; String preferedthemeurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + prefered + "." + postfix; String secondarythemeurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + secondary + "." + postfix; String imagethemeurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + theme + "." + postfix; String preferedurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + prefered + "." + postfix; String secondaryurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + secondary + "." + postfix; String imageurl = globalconfiguration .getBaseUrl() + globalconfiguration .getAdminWebPath() + globalconfiguration .getImagesPath()+"/" + imagefile + "." + postfix; if(this.getClass().getResourceAsStream(preferedthemefilename) != null) returnedurl = preferedthemeurl; else{ if(this.getClass().getResourceAsStream(secondarythemefilename) != null) returnedurl = secondarythemeurl; else{ if(this.getClass().getResourceAsStream(themefilename) != null) returnedurl = imagethemeurl; else{ if(this.getClass().getResourceAsStream(preferedfilename) != null) returnedurl = preferedurl; else{ if(this.getClass().getResourceAsStream(secondaryfilename) != null) returnedurl = secondaryurl; else returnedurl = imageurl; } } } } return returnedurl; } public String getText(String template){ return adminsweblanguage.getText(template); } public String printDate(Date date){ return DateFormat.getDateInstance(DateFormat.SHORT).format(date); } public String printDateTime(Date date){ return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date); } public void reloadGlobalConfiguration() throws Exception { globalconfiguration = globaldataconfigurationdatahandler.loadGlobalConfiguration(); informationmemory.systemConfigurationEdited(globalconfiguration); } public void saveGlobalConfiguration() throws Exception{ globaldataconfigurationdatahandler.saveGlobalConfiguration(globalconfiguration); informationmemory.systemConfigurationEdited(globalconfiguration); } public boolean existsAdminPreference() throws Exception{ return adminspreferences.existsAdminPreference(certificatefingerprint); } public void addAdminPreference(AdminPreference ap) throws Exception{ currentadminpreference = ap; adminspreferences.addAdminPreference(certificatefingerprint,ap); adminsweblanguage = new WebLanguages( currentadminpreference.getPreferedLanguage() ,currentadminpreference.getSecondaryLanguage()); } public Collection getAuthorizedCAIds(){; return this.informationmemory.getAuthorizedCAIds(); } public void changeAdminPreference(AdminPreference ap) throws Exception{ currentadminpreference = ap; adminspreferences.changeAdminPreference(certificatefingerprint,ap); adminsweblanguage = new WebLanguages(currentadminpreference.getPreferedLanguage() ,currentadminpreference.getSecondaryLanguage()); } public AdminPreference getDefaultAdminPreference() throws Exception{ return adminspreferences.getDefaultAdminPreference(); } // getDefaultAdminPreference() public void saveDefaultAdminPreference(AdminPreference dap) throws Exception{ adminspreferences.saveDefaultAdminPreference(dap); // Reload preferences currentadminpreference = adminspreferences.getAdminPreference(certificatefingerprint); if(currentadminpreference == null){ currentadminpreference = adminspreferences.getDefaultAdminPreference(); } adminsweblanguage = new WebLanguages( currentadminpreference.getPreferedLanguage() ,currentadminpreference.getSecondaryLanguage()); } // saveDefaultAdminPreference public InformationMemory getInformationMemory(){ return this.informationmemory; } public Admin getAdminObject(){ return this.administrator; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -