public String getBrowserPageTitle() throws ALNTApplicationException, ALNTSystemException {
   String title = null;
   try {
     title = getConfigParamValue(BROWSER_PAGE_TITLE);
     ALNTLogger.debug(
         this.getClass().getName(),
         "getBrowserPageTitle()",
         "Browser page title configured as : " + title);
   } catch (Exception ex) {
     ALNTLogger.error(this.getClass().getName(), "getBrowserPageTitle()", ex);
     handleException(ex);
   }
   return StringUtils.isEmpty(title) ? I18NUtil.getI18NValue("browser.title.default") : title;
 }
Exemplo n.º 2
0
  @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());
    }
  }