Package com.iqbon.jcms.service

Examples of com.iqbon.jcms.service.ModelService


  private static final Logger logger = Logger.getLogger(ParseModelJob.class);

  @Override
  public void execute(JobExecutionContext context) throws JobExecutionException {
    QuartzService quartzService = (QuartzService) BeanFactory.getBean("quartzService");
    ModelService modelService = (ModelService) BeanFactory.getBean("modelService");
    JobDetail jobDetail = context.getJobDetail();
    String jobName = jobDetail.getKey().getName();
    if (String.valueOf(Quartz.runningStatus.running.ordinal()).equals(
        quartzService.getQuartzStatus(jobName))) {//如果是正在运行状态
      logger.warn("上一个调度任务" + jobName + "正在运行,本次调度运行跳过。");
      return;
    } else {
      quartzService.setQuartzStatus(jobName, Quartz.runningStatus.running.ordinal());
      long start = System.currentTimeMillis();
      logger.info("开始刷新文章");
      quartzService.setQuartzStatus(jobName, Quartz.runningStatus.stop.ordinal());
      String refresh = jobDetail.getJobDataMap().getString(Quartz.JOB_FRESH_MINUTE);
      List<String> modelIdList = modelService.getNeedPublishModelByRefresh(refresh);
      for (String modelName : modelIdList) {
        try {
          logger.info("刷新模板" + modelName);
          Model model = modelService.getModelInfoByModelName(modelName);
          modelService.publishModelContent(model);
        } catch (IOException e) {
          logger.error(modelName + "模板刷新失败", e);
          logEnd(start, jobName);
          quartzService.setQuartzStatus(jobName, Quartz.runningStatus.stop.ordinal());
        } catch (NotFoundException ne) {
View Full Code Here

TOP

Related Classes of com.iqbon.jcms.service.ModelService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.