Example #1
0
  @Override
  public void updateJobStatus(JobStatus jobStatus) {
    JobPersistence persistence = getJobPersistence(jobStatus.getJobId());
    persistence.setGmtModified(new Date());

    // 只修改状态 和 依赖 2个字段
    JobPersistence temp = PersistenceAndBeanConvert.convert(jobStatus);
    persistence.setStatus(temp.getStatus());
    persistence.setReadyDependency(temp.getReadyDependency());
    persistence.setHistoryId(temp.getHistoryId());

    getHibernateTemplate().update(persistence);
  }
Example #2
0
  public void updateJob(String user, JobDescriptor job, String owner, String groupId)
      throws ZeusException {
    JobPersistence orgPersist =
        (JobPersistence)
            getHibernateTemplate().get(JobPersistence.class, Long.valueOf(job.getId()));
    if (job.getScheduleType() == JobScheduleType.Independent) {
      job.setDependencies(new ArrayList<String>());
    } else if (job.getScheduleType() == JobScheduleType.Dependent) {
      job.setCronExpression("");
    }
    job.setOwner(owner);
    job.setGroupId(groupId);
    // 以下属性不允许修改,强制采用老的数据
    JobPersistence persist = PersistenceAndBeanConvert.convert(job);
    persist.setGmtCreate(orgPersist.getGmtCreate());
    persist.setGmtModified(new Date());
    persist.setRunType(orgPersist.getRunType());
    persist.setStatus(orgPersist.getStatus());
    persist.setReadyDependency(orgPersist.getReadyDependency());
    persist.setHost(job.getHost());
    // 如果是用户从界面上更新,开始时间、统计周期等均为空,用原来的值
    if (job.getStartTime() == null || "".equals(job.getStartTime())) {
      persist.setStartTime(orgPersist.getStartTime());
    }
    if (job.getStartTimestamp() == 0) {
      persist.setStartTimestamp(orgPersist.getStartTimestamp());
    }
    if (job.getStatisStartTime() == null || "".equals(job.getStatisStartTime())) {
      persist.setStatisStartTime(orgPersist.getStatisStartTime());
    }
    if (job.getStatisEndTime() == null || "".equals(job.getStatisEndTime())) {
      persist.setStatisEndTime(orgPersist.getStatisEndTime());
    }

    // 如果是周期任务,则许检查依赖周期是否正确
    if (job.getScheduleType().equals(JobScheduleType.CyleJob)
        && job.getDependencies() != null
        && job.getDependencies().size() != 0) {
      List<JobDescriptor> list = this.getJobDescriptors(job.getDependencies());
      jobValidate.checkCycleJob(job, list);
    }

    if (jobValidate.valide(job)) {
      getHibernateTemplate().update(persist);
    }
  }
  public void updateJob(String user, JobDescriptor job, String owner, String groupId)
      throws ZeusException {
    JobPersistence orgPersist =
        (JobPersistence)
            getHibernateTemplate().get(JobPersistence.class, Long.valueOf(job.getId()));
    if (job.getScheduleType() == JobScheduleType.Independent) {
      job.setDependencies(new ArrayList<String>());
    } else if (job.getScheduleType() == JobScheduleType.Dependent) {
      job.setCronExpression("");
    }
    job.setOwner(owner);
    job.setGroupId(groupId);
    // 以下属性不允许修改,强制采用老的数据
    JobPersistence persist = PersistenceAndBeanConvert.convert(job);
    persist.setGmtCreate(orgPersist.getGmtCreate());
    persist.setGmtModified(new Date());
    persist.setRunType(orgPersist.getRunType());
    persist.setStatus(orgPersist.getStatus());
    persist.setReadyDependency(orgPersist.getReadyDependency());

    if (jobValidate.valide(job)) {
      getHibernateTemplate().update(persist);
    }
  }