public void setReportParameterValues(Map parameterValues) { ALNTLogger.info( ActionItemAuditTrailDataSourceService.class.getName(), "setReportParameterValues()", (new StringBuilder("Parameter Value")).append(parameterValues).toString()); if (parameterValues.get("assessId") != null) { p_assessIdStr = parameterValues.get("assessId").toString(); p_assessId = Long.parseLong(p_assessIdStr); ALNTLogger.info( ActionItemAuditTrailDataSourceService.class.getName(), "setReportParameterValues()", (new StringBuilder("assessId ")).append(p_assessId).toString()); } this.parameterTest = parameterValues; try { ds = new ActionItemAuditTrailDataSource(parameterTest); } catch (Exception e) { ALNTLogger.error( ActionItemAuditTrailDataSourceService.class.getName(), "setReportParameterValues(): Error in initializing data source", e); } parameterValues.put("REPORT_DATA_SOURCE", ds); }
public void setReportParameterValues(Map parameterValues) { ALNTLogger.info( this.getClass().getName(), "setReportParameterValues()", (new StringBuilder("Parameter Value")).append(parameterValues).toString()); Object accMapParams = parameterValues.get("REPORT_PARAMETERS_MAP"); p_Id = (String) parameterValues.get("p_Id"); ALNTLogger.info( this.getClass().getName(), "setReportParameterValues()", (new StringBuilder("p_Id")).append(p_Id).toString()); Object reportObjLocal = parameterValues.get("REPORT_LOCALE"); this.parameterTest = parameterValues; try { ds = new CertifyActionByApproverDataSource(parameterTest); } catch (Exception e) { ALNTLogger.error( this.getClass().getName(), "setReportParameterValues(): Error in initializing data source", e); } parameterValues.put("REPORT_DATA_SOURCE", ds); }
public String fetchUser(HttpServletRequest request) { ALNTLogger.info( "ALNTHttpHeaderValidator".getClass().getName(), "fetchUser", "fetching user using HTTP header"); String headerName = ""; String encodedHeaderValue = ""; String userId = ""; Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { headerName = (String) headerNames.nextElement(); if (headerName.equalsIgnoreCase(CommonConstants.CALLING_APP_LOGGEDIN_USER)) { encodedHeaderValue = request.getHeader(headerName); break; } } if (encodedHeaderValue != null && !encodedHeaderValue.equals("")) { try { userId = EncodeDecodeUtil.decodeBase64(encodedHeaderValue); } catch (Exception e) { ALNTLogger.error("ALNTHttpHeaderValidator".getClass().getName(), "fetchUser", e, true); userId = ""; } } return userId; }
public RemediationLookup getRemediatedLookup(final String objType, final String objId) { if (jdbcTemplate == null) { ALNTLogger.info( RiskAnalyticsDAO.class.getName(), "getRemediatedLookup():", new StringBuilder( "*** RiskAnalyticsDAO not initiated. Return empty RemediationLookup object")); // System.out.println("*** RiskAnalyticsDAO not initiated. Return empty RemediationLookup // object"); return new RemediationLookup(); } return (RemediationLookup) jdbcTemplate.query( GET_REMED_OBJS_SQL, new PreparedStatementSetter() { public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, objType); ps.setString(2, objId); } }, new ResultSetExtractor() { public Object extractData(ResultSet rs) throws SQLException { RemediationLookup remedMap = new RemediationLookup(); while (rs.next()) { String sysId = rs.getString(1); String attrValue = rs.getString(2); String attrName = rs.getString(3); String element = null; if ("Action".equals(attrName)) { element = attrName; attrName = "id"; } else { element = "AuthBy"; attrName = attrName.substring(0, 1).toLowerCase() + attrName.substring(1); } ALNTLogger.info( RiskAnalyticsDAO.class.getName(), "extractData():", new StringBuilder( "add remed obj " + sysId + " " + element + " " + attrName + " " + attrValue)); // System.out.println("add remed obj " + sysId + " " + element + " " + attrName + // " " + attrValue); remedMap.add(sysId, element, attrName, attrValue); } return remedMap; } }); }
public void jobExecutionVetoed(JobExecutionContext context) { ALNTLogger.info(this.getClass().getName(), "jobExecutionVetoed()", "Begin"); try { ISchedulerConfigService schedulerConfigService = (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService"); Object jobId = context.getJobDetail().getJobDataMap().get("JOB_ID"); Object id = context.getJobDetail().getJobDataMap().get("JobStatus_ID"); JobStatus jobStatus = schedulerConfigService.loadJobStatus(new Long(jobId.toString()), new Long(id.toString())); String jobPgmName = (String) context.getJobDetail().getJobDataMap().get("JOB_NAME"); jobStatus.setJobStatus(CommonConstants.JOB_STATUS_WAITING); jobStatus.setJobName(jobPgmName); schedulerConfigService.saveJobStatus(jobStatus); ALNTLogger.info(this.getClass().getName(), "jobExecutionVetoed()", "End"); } catch (ALNTSystemException e) { ALNTLogger.error( this.getClass().getName(), "jobExecutionVetoed()", "Error ::" + e.getMessage()); } catch (ALNTApplicationException e) { ALNTLogger.error( this.getClass().getName(), "jobExecutionVetoed()", "Error ::" + e.getMessage()); } }
public String fetchUser(HttpServletRequest request) { ALNTLogger.info( "ALNTEncodedURLValidator".getClass().getName(), "fetchUser", "fetching user using Encoded URL"); String userId = ""; String encodedUserId = request.getQueryString().contains(CommonConstants.CALLING_APP_LOGGEDIN_USER) ? request.getParameter(CommonConstants.CALLING_APP_LOGGEDIN_USER) : null; if (StringUtils.isNotNullOrNotEmpty(encodedUserId)) { try { userId = EncodeDecodeUtil.decodeBase64(encodedUserId); } catch (Exception e) { ALNTLogger.error("ALNTEncodedURLValidator".getClass().getName(), "fetchUser", e, true); userId = ""; } } return userId; }
@SuppressWarnings("unchecked") public void jobToBeExecuted(JobExecutionContext context) { ALNTLogger.info(this.getClass().getName(), "jobToBeExecuted()", "Begin"); try { ISchedulerConfigService schedulerConfigService = (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService"); JobDetail jobDetails = context.getJobDetail(); Long id = (Long) jobDetails.getJobDataMap().get("JOB_ID"); String jobPgmName = (String) jobDetails.getJobDataMap().get("JOB_NAME"); String triggerGroup = context.getTrigger().getGroup(); boolean recoveringJob = false; JobStatus jobStatus = null; if (!StringUtils.isEmpty(triggerGroup) && triggerGroup.equals("RECOVERING_JOBS")) { recoveringJob = true; jobDetails.getJobDataMap().put(SchedulerUtil.RECOVERING_JOB, Boolean.TRUE); List<JobStatus> jobStatusList = null; try { jobStatusList = schedulerConfigService.loadJobStatus( jobDetails.getJobDataMap().getLongValue("JOB_ID")); if (null != jobStatusList && jobStatusList.size() > 0) { jobStatus = jobStatusList.get(jobStatusList.size() - 1); jobDetails .getJobDataMap() .put(SchedulerUtil.RECOVERING_JOB_STATUS_ID, jobStatus.getId()); jobStatus.setJobStatus(CommonConstants.JOB_STATUS_RUNNING); } } catch (Exception ex) { ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted", ex); } } if (jobStatus == null) { jobStatus = new JobStatus(); jobStatus.setJobId(id); Date nextFireTime = context.getNextFireTime(); jobStatus.setNextFireTime(nextFireTime); jobStatus.setJobName(jobPgmName); jobStatus.setCreationDate(new Date()); jobStatus.setJobStatus(CommonConstants.JOB_STATUS_RUNNING); } Job job = context.getJobInstance(); if (job instanceof IJobsWithResult) { IJobsWithResult jobWithResult = (IJobsWithResult) job; JobResultWriter writer = new JobResultWriter(); writer.setCreateDate(jobStatus.getCreationDate()); writer.setJobId(id); writer.init(); jobWithResult.setResultWriter(writer); } if (jobDetails.getJobDataMap().containsKey(SchedulerUtil.RETRYING_JOB) && jobDetails.getJobDataMap().containsKey(SchedulerUtil.FAILED_JOB_STATUS_ID) && jobDetails.getJobDataMap().containsKey(SchedulerUtil.RETRYING_JOB_STATUS_ID)) { if (jobDetails.getJobDataMap().getBoolean(SchedulerUtil.RETRYING_JOB)) { jobStatus.setOriginalFailedId( jobDetails.getJobDataMap().getLong(SchedulerUtil.FAILED_JOB_STATUS_ID)); jobStatus.setRetryForId( jobDetails.getJobDataMap().getLong(SchedulerUtil.RETRYING_JOB_STATUS_ID)); } } jobStatus = schedulerConfigService.saveJobStatus(jobStatus); jobDetails.getJobDataMap().put("JobStatus_ID", jobStatus.getId()); if (recoveringJob) { } else if (jobStatus.getRetryForId() != null) { JobStatus retryingForJobStatus = schedulerConfigService.loadJobStatusByStatusId(jobStatus.getRetryForId()); if (retryingForJobStatus != null) { // get the job status object that simply says retrying and append it with new job status // id retryingForJobStatus.setJobStatus( CommonConstants.JOB_STATUS_RETRIED + " - " + jobStatus.getId()); schedulerConfigService.saveJobStatus(retryingForJobStatus); } } ALNTLogger.info(this.getClass().getName(), "jobToBeExecuted()", "End"); } catch (ALNTSystemException e) { ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted()", "Error ::" + e.getMessage()); } catch (ALNTApplicationException e) { ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted", "Error ::" + e.getMessage()); } }
public void jobWasExecuted(JobExecutionContext context, JobExecutionException arg1) { SchedulerMailUtil mailUtil = new SchedulerMailUtil(); ALNTLogger.info(this.getClass().getName(), "jobWasExecuted()", "Begin"); try { ISchedulerConfigService schedulerConfigService = (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService"); Job job = context.getJobInstance(); if (job instanceof IJobsWithResult) { IJobsWithResult jobWithResult = (IJobsWithResult) job; JobResultWriter writer = jobWithResult.getResultWriter(); if (writer != null) { writer.getLogWriter().flush(); writer.getLogWriter().close(); writer.getResultWriter().flush(); writer.getResultWriter().close(); } } Object jobId = context.getJobDetail().getJobDataMap().get("JOB_ID"); Object id = context.getJobDetail().getJobDataMap().get("JobStatus_ID"); String jobPgmName = (String) context.getJobDetail().getJobDataMap().get("JOB_NAME"); ScheduledJobs scheduledJobs = schedulerConfigService.loadScheduledJob(new Long(jobId.toString())); ALNTLogger.info(getName(), "Got NotificationDetail object from ScheduledJobs"); // Getting notification object to send the notification email to user scheduledNotificationDetail = scheduledJobs.getScheduledNotificationDetail(); JobStatus jobStatus = schedulerConfigService.loadJobStatus(new Long(jobId.toString()), new Long(id.toString())); if (CommonConstants.SCHEDULE_IMMEDIATE.equalsIgnoreCase(scheduledJobs.getInterval())) { scheduledJobs.setActiveStatus(false); } else if (CommonConstants.SCHEDULE_ONCE.equalsIgnoreCase(scheduledJobs.getInterval())) { scheduledJobs.setActiveStatus(false); } else if (scheduledJobs.getInterval().startsWith(CommonConstants.SCHEDULE_PERIODICALLY)) { if (null == context.getNextFireTime()) { scheduledJobs.setActiveStatus(false); } } if (CommonConstants.JOB_STATUS_CANCELING.equalsIgnoreCase(jobStatus.getJobStatus())) { scheduledJobs.setActiveStatus(false); jobStatus.setJobStatus(CommonConstants.JOB_STATUS_CANCELED); } else { jobStatus.setJobStatus(CommonConstants.JOB_STATUS_COMPLETED); if (arg1 != null) { jobStatus.setJobStatus(CommonConstants.JOB_STATUS_FAILED); } else if (context .getJobDetail() .getJobDataMap() .containsKey(CommonConstants.JOB_STATUS_SKIPPED)) { jobStatus.setJobStatus(CommonConstants.JOB_STATUS_SKIPPED); context.getJobDetail().getJobDataMap().remove(CommonConstants.JOB_STATUS_SKIPPED); } if (context.getJobDetail() != null && context.getJobDetail().getJobDataMap() != null && context .getJobDetail() .getJobDataMap() .containsKey(CommonConstants.NO_VALID_FEED_FILE_EXISTS)) { jobStatus.setJobStatus( CommonConstants.JOB_STATUS_FAILED + "- " + CommonConstants.NO_VALID_FEED_FILE_EXISTS); context.getJobDetail().getJobDataMap().remove(CommonConstants.NO_VALID_FEED_FILE_EXISTS); } // completionTime=context.getFireTime(); JobStage jobStage = schedulerConfigService.loadJobStage( jobStatus.getOriginalFailedId() == null ? jobStatus.getId() : jobStatus.getOriginalFailedId()); if (jobStage != null) { jobStatus.setLastKnowStage(jobStage.getJobStage()); } } // Sending notification email to user with status of current job with defined parameters or // with standard parameters // If the notification has not been configured for current running job then // scheduledNotificationDetail object will be null // so we are checking for that the notification has been configured for this or not if (scheduledNotificationDetail != null) { if (job instanceof IJobWithExtendedMailSubstVar) { Map<String, String> mapParams = ((IJobWithExtendedMailSubstVar) job).getMailSubstVarValues(); mapParams.putAll(this.getStandardJobParams(scheduledJobs)); mailUtil.sendMail(scheduledNotificationDetail, jobStatus.getJobStatus(), mapParams); } else { mailUtil.sendMail( scheduledNotificationDetail, jobStatus.getJobStatus(), this.getStandardJobParams(scheduledJobs)); } } jobStatus.setCompleteTime(new Date()); jobStatus.setJobName(jobPgmName); schedulerConfigService.saveScheduledJobWithoutScheduleJob(scheduledJobs); schedulerConfigService.saveJobStatus(jobStatus); ALNTLogger.info(this.getClass().getName(), "jobWasExecuted()", "End"); } catch (ALNTSystemException e) { ALNTLogger.error(this.getClass().getName(), "jobWasExecuted()", "Error ::" + e.getMessage()); } catch (ALNTApplicationException e) { ALNTLogger.error(this.getClass().getName(), "jobWasExecuted()", ":Error ::" + e.getMessage()); } }
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; }