public String getConfigParamValue(String configParamName, boolean getConfigParamLabel) throws ALNTApplicationException, ALNTSystemException { String configParamValue = null; String configParamLabel = null; try { if (getConfigParamLabel) { ApplicationConfig applicationConfig = applicationConfigDAO.load(configParamName); if (null != applicationConfig) { configParamValue = applicationConfig.getConfigParamValue(); configParamLabel = applicationConfig.getConfigParamLabel(); } } else { configParamValue = CacheManager.getApplicationConfig(configParamName); } } catch (Exception ex) { ALNTLogger.error( this.getClass().getName(), "getConfigParamValue", "Error in loading Application config ::" + configParamName); handleException(ex); } if (getConfigParamLabel && StringUtils.isNotNullOrNotEmpty(configParamLabel)) return configParamLabel + " : " + configParamValue; return configParamValue; }
// ABHISHEK chnages for document search start. public void saveDocumentSearchConfig(String roleName, int numOfDays) throws ALNTApplicationException, ALNTSystemException { try { ALNTLogger.debug( this.getClass().getName(), "setDocumentSearchConfig()", "Saving the role and number of days details : "); ApplicationConfig roleConfig = new ApplicationConfig(); ApplicationConfig dayConfig = new ApplicationConfig(); roleConfig = applicationConfigDAO.load("DOCUMENT_CHANGE_ROLE"); dayConfig = applicationConfigDAO.load("DOCUMENT_CHANGE_DAYS"); roleConfig.setConfigParamValue(roleName); dayConfig.setConfigParamValue(String.valueOf(numOfDays)); applicationConfigDAO.saveDocumentSearchConfig(roleConfig); applicationConfigDAO.saveDocumentSearchConfig(dayConfig); try { ApplicationConfigCache.getInstance().reloadAll(); } catch (CacheEventException e) { ALNTLogger.debug(this.getClass().getName(), "setDocumentSearchConfig()", e); } } catch (Exception ex) { ALNTLogger.error(this.getClass().getName(), "setDocumentSearchConfig()", ex); handleException(ex); } }
private String getConfigParamValue(List applicationConfigList, String configParam) { if (null == applicationConfigList || applicationConfigList.size() <= 0 || null == configParam || configParam.equals("")) { return null; } Iterator applConfigIter = applicationConfigList.iterator(); while (applConfigIter.hasNext()) { ApplicationConfig applConfig = (ApplicationConfig) applConfigIter.next(); if (configParam.equalsIgnoreCase(applConfig.getConfigParamName())) { return applConfig.getConfigParamValue(); } } return null; }
public ApplicationConfig saveUserIDDataSourceType(String dataSourceType) throws ALNTApplicationException, ALNTSystemException { ApplicationConfig retApplConfig = null; try { ApplicationConfig exApplConfig = getConfigParam(CommonConstants.APPL_USERID_DATASOURCE_TYPE); if (null == exApplConfig) throw new ALNTApplicationException( ErrorCode.OBJECT_NOT_AVAILABLE, "Application cofig not exists: " + CommonConstants.APPL_USERID_DATASOURCE_TYPE); exApplConfig.setConfigParamValue(dataSourceType); retApplConfig = (ApplicationConfig) applicationConfigDAO.save(exApplConfig); ApplicationConfigCache.getInstance().reloadAll(); } catch (Exception ex) { ALNTLogger.error(this.getClass().getName(), "saveApplicationConfig()", ex); handleException(ex); } return retApplConfig; }
public List saveApplicationConfigList(List applicationConfigList) throws ALNTApplicationException, ALNTSystemException { List oldAppConfigList = applicationConfigDAO.load(); List savedList = applicationConfigDAO.save(applicationConfigList); String df = null; String param = null; if (null != savedList && null != applicationConfigList) { Iterator saveIter = savedList.iterator(); while (saveIter.hasNext()) { ApplicationConfig applConfig = (ApplicationConfig) saveIter.next(); if (CONFIG_LOG_DIR.equalsIgnoreCase(applConfig.getConfigParamName()) || LOG_LEVEL.equalsIgnoreCase(applConfig.getConfigParamName()) || NEW_AUDIABLE_SOUND_PATH.equalsIgnoreCase(applConfig.getConfigParamName())) { String oldParamValue = getConfigParamValue(oldAppConfigList, applConfig.getConfigParamName()); if (null != oldParamValue) { if (!oldParamValue.equalsIgnoreCase(applConfig.getConfigParamValue())) { if (CONFIG_LOG_DIR.equalsIgnoreCase(applConfig.getConfigParamName())) { ALNTLogger.info( this.getClass().getName(), "saveApplicationConfigList", "reload the LoggerConfig"); System.setProperty( CommonConstants.LOG_DIR_KEY, applConfig.getConfigParamValue() + "/"); LoggerConfigUtil.resetLogDir(applConfig.getConfigParamValue()); // ALNTLogger.reloadConfiguration(ALNTLogger.class.getResource("LoggerConf.xml")); } /*else if(LOG_LEVEL.equalsIgnoreCase(applConfig.getConfigParamName())) { String logLevel = CommonConstants.DEFAULT_LOG_LEVEL; if(null != applConfig.getConfigParamValue()) logLevel = applConfig.getConfigParamValue().toUpperCase(); CommonUtil.resetLogLevel(logLevel); }*/ else if (NEW_AUDIABLE_SOUND_PATH.equalsIgnoreCase( applConfig.getConfigParamName())) { ALNTLogger.info( this.getClass().getName(), "saveApplicationConfigList", "InboxMessage Alert Sound modified"); try { fileUploadUtil.writeFileIntoServerLoc(applConfig.getConfigParamValue()); } catch (Exception e) { ALNTLogger.error( this.getClass().getName(), "saveApplicationConfigList", "Issue on File upload "); } } } } } /*else if (CommonConstants.Application_Date_Format.equalsIgnoreCase(applConfig.getConfigParamName()) || CommonConstants.APPL_TIME_FORMAT.equalsIgnoreCase(applConfig.getConfigParamName()) || CommonConstants.APPL_FLEX_TIME_FORMAT.equalsIgnoreCase(applConfig.getConfigParamName())){ df = applConfig.getConfigParamValue(); param = applConfig.getConfigParamName(); }*/ else if (APPL_BANNER_IMAGE.equalsIgnoreCase( applConfig.getConfigParamName())) { CacheManager.updateBannerImageName(applConfig.getConfigParamValue()); } } } /*if(StringUtils.isNotNullOrNotEmpty(df) && StringUtils.isNotNullOrNotEmpty(param)){ LookUp lkup= (LookUp) CommonBusinessDeligate.getInstance().loadLookupById(new Long(df)); String dateformatStr = (lkup!=null)?lkup.getMeaning():null; GlobalizationBD globalizationBD = new GlobalizationBD(); if(CommonConstants.Application_Date_Format.equalsIgnoreCase(param)) { I18NUtil.updateResBundle(CommonConstants.Application_Date_Format, dateformatStr); } else if(CommonConstants.APPL_TIME_FORMAT.equalsIgnoreCase(param)) { I18NUtil.updateResBundle(CommonConstants.APPL_TIME_FORMAT, dateformatStr); } }*/ try { ApplicationConfigCache.getInstance().reloadAll(); } catch (CacheEventException e) { ALNTLogger.error(this.getClass().getName(), "saveApplicationConfigList()", e); } return savedList; }