Build the actual Trigger -- NOT intended to be invoked by end users, but will rather be invoked
by a TriggerBuilder which this ScheduleBuilder is given to.
437234
@Override
  public OperableTrigger instantiate() {

    SimpleTriggerImpl st = new SimpleTriggerImpl();
    st.setRepeatInterval(interval);
    st.setRepeatCount(repeatCount);
    st.setMisfireInstruction(misfireInstruction);
    return st;
  }
635017
def build(self, builder):
        """"""
        params = {}

        if self.edit_point is not None:
            params["EditPoint"] = self.edit_point

        if self.used_imputation_method is not None:
            params['UsedImputationMethod'] = bool_to_yes_no(self.used_imputation_method)

        if self.audit_id is not None:
            params['ID'] = str(self.audit_id)

        if self.include_file_oid is not None:
            params['mdsol:IncludeFileOID'] = bool_to_yes_no(self.include_file_oid)

        builder.start("AuditRecord", params)
        if self.user_ref is None:
            raise ValueError("User Reference not set.")
        self.user_ref.build(builder)

        if self.location_ref is None:
            raise ValueError("Location Reference not set.")
        self.location_ref.build(builder)

        if self.date_time_stamp is None:
            raise ValueError("DateTime not set.")

        self.date_time_stamp.build(builder)

        # Optional
        if self.source_id:
            self.source_id.build(builder)
        # Optional
        if self.reason_for_change is not None:
            self.reason_for_change.build(builder)

        builder.end("AuditRecord")
611606
def build(self, builder):
        
        params = {}

        # Add in the transaction type
        if self.transaction_type is not None:
            params["TransactionType"] = self.transaction_type

        if self.seqnum is None:
            # SeqNum is not optional (and defaulted)
            raise ValueError("SeqNum is not set.")  # pragma: no cover
        params["SeqNum"] = str(self.seqnum)

        if self.annotation_id is not None:
            # If an Annotation is contained with an Annotations element,
            # the ID attribute is required.
            params["ID"] = self.annotation_id

        builder.start("Annotation", params)

        if self.flags in (None, []):
            raise ValueError('Flag is not set.')

        # populate the flags
        for flag in self.flags:
            flag.build(builder)

        # add the Comment, if it exists
        if self.comment is not None:
            self.comment.build(builder)

        builder.end("Annotation")
1213724
public static TriggerContext on(Trigger trigger) {
        List<Trigger> addedTriggers = new ArrayList<Trigger>();
        if (trigger != null) {
            addedTriggers.add(trigger);
        }
        return new TriggerContext(addedTriggers);
    }
1294355
public synchronized void runNow(String scheduledJobId) {
    ScheduledJob scheduledJob = getJob(scheduledJobId);

    try {
      JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP);
      if (quartzScheduler.checkExists(jobKey)) {
        // Run job now
        quartzScheduler.triggerJob(jobKey);
      } else {
        // Schedule with 'now' trigger
        Trigger trigger =
            newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build();
        schedule(scheduledJob, trigger);
      }
    } catch (SchedulerException e) {
      LOG.error("Error runNow ScheduledJob", e);
      throw new MolgenisDataException("Error job runNow", e);
    }
  }
895108
@Scheduled(initialDelayString = PROP_SCHEDULER_DELAY_PLACEHOLDER, fixedDelayString = PROP_SCHEDULER_DELAY_PLACEHOLDER)
    public void autoAssignScheduler() {
        LOGGER.debug("auto assign schedule checker has been triggered.");
        // run this code in system code privileged to have the necessary
        // permission to query and create entities.
        systemSecurityContext.runAsSystem(this::executeAutoAssign);
    }
807524
def build(self, builder):
        """"""

        params = dict(
            OID=self.oid,
            Name=self.name,
            Repeating=bool_to_yes_no(self.repeating),
            Type=self.event_type,
        )

        if self.category is not None:
            params["Category"] = self.category

        if self.access_days is not None:
            params["mdsol:AccessDays"] = str(self.access_days)

        if self.start_win_days is not None:
            params["mdsol:StartWinDays"] = str(self.start_win_days)

        if self.target_days is not None:
            params["mdsol:TargetDays"] = str(self.target_days)

        if self.end_win_days is not None:
            params["mdsol:EndWinDays"] = str(self.end_win_days)

        if self.overdue_days is not None:
            params["mdsol:OverDueDays"] = str(self.overdue_days)

        if self.close_days is not None:
            params["mdsol:CloseDays"] = str(self.close_days)

        builder.start("StudyEventDef", params)
        for formref in self.formrefs:
            formref.build(builder)
        for alias in self.aliases:
            alias.build(builder)
        builder.end("StudyEventDef")
1218061
public function scheduleJob(Trigger $trigger, JobDetail $jobDetail = null)
    {
        if ($jobDetail) {
            if ($jobDetail->getKey() == null) {
                throw new SchedulerException('Job\'s key cannot be null');
            }

            if ($trigger->getJobKey() == null) {
                $trigger->setJobKey(clone $jobDetail->getKey());
            } else if (false == $trigger->getJobKey()->equals($jobDetail->getKey())) {
                throw new SchedulerException('Trigger does not reference given job!');
            }
        }

        $trigger->validate();

        $calendar = null;
        if ($trigger->getCalendarName() != null) {
            $calendar = $this->store->retrieveCalendar($trigger->getCalendarName());
        }

        $firstFireTime = $trigger->computeFirstFireTime($calendar);

        if ($firstFireTime == null) {
            throw new SchedulerException(sprintf(
                'Based on configured schedule, the given trigger "%s" will never fire.', $trigger->getKey()
            ));
        }

        if ($jobDetail) {
            $this->store->storeJobAndTrigger($jobDetail, $trigger);

            $this->notify(Event::JOB_ADDED, new JobDetailEvent($jobDetail));
            $this->notify(Event::JOB_SCHEDULED, new TriggerEvent($trigger));
        } else {
            $this->store->storeTrigger($trigger);

            $this->notify(Event::JOB_SCHEDULED, new TriggerEvent($trigger));
        }

        return $firstFireTime;
    }
533170
def build(self, builder):
        
        builder.start("SourceID", {})
        builder.data(self.source_id)
        builder.end("SourceID")
914437
public ScheduledFuture<?> schedule() {
        synchronized (this.triggerContextMonitor) {
            this.scheduledExecutionTime = this.trigger.nextExecutionTime(this.triggerContext);
            if (this.scheduledExecutionTime == null) {
                return null;
            }
            long initialDelay = this.scheduledExecutionTime.getTime() - System.currentTimeMillis();
            this.currentFuture = this.executor.schedule(this, initialDelay, TimeUnit.MILLISECONDS);
            return this;
        }
    }
474618
public void feed() {
        if ( source.hasNext() ) {
            Event< ? > event = source.getNext();
            FeedContext context = new FeedContext( event );
            FeedTrigger trigger = new FeedTrigger();
            trigger.setNextFireTime( event.getDate() );
            FeedJob job = new FeedJob( source,
                                       sink,
                                       trigger,
                                       clock );
            clock.scheduleJob( job,
                               context,
                               trigger );
        }
    }
611773
public Trigger getCronTrigger(String cronExpression) {
    CronScheduleBuilder cronScheduleBuilder = null;
    Trigger cronTrigger = null;
    try {
      cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
      cronScheduleBuilder.withMisfireHandlingInstructionFireAndProceed();
      TriggerBuilder<Trigger> cronTtriggerBuilder = TriggerBuilder.newTrigger();
      cronTtriggerBuilder.withSchedule(cronScheduleBuilder);
      cronTrigger = cronTtriggerBuilder.build();
    } catch (Exception pe) {
      logger.error("Error occurred while builiding the cronTrigger : " + pe.getMessage(), pe);
    }
    return cronTrigger;
  }
859033
function(trigger, job){
  this.trigger = this.decodeTrigger(trigger);

  this.nextTime = this.nextExcuteTime(Date.now());

  this.job = job;
}
515462
public void run() {

        while (keepGoing) {
            TriggerData triggerData = popPair();

            if (triggerData != null) {
                if (triggerData.username != null) {
                    trigger.fire(this.vectorIndex, name.name,
                                 table.getName().name, triggerData.oldRow,
                                 triggerData.newRow);
                }
            }
        }
    }
176647
@Nonnull
  public T build ()
  {
    if (m_aScheduleBuilder == null)
      m_aScheduleBuilder = SimpleScheduleBuilder.simpleSchedule ();
    final IMutableTrigger trig = m_aScheduleBuilder.build ();
    trig.setCalendarName (m_sCalendarName);
    trig.setDescription (m_sDescription);
    trig.setStartTime (m_aStartTime);
    trig.setEndTime (m_aEndTime);
    if (m_aKey == null)
      m_aKey = new TriggerKey (Key.createUniqueName (null), null);
    trig.setKey (m_aKey);
    if (m_aJobKey != null)
      trig.setJobKey (m_aJobKey);
    trig.setPriority (m_nPriority);

    if (!m_aJobDataMap.isEmpty ())
      trig.setJobDataMap (m_aJobDataMap);
    return GenericReflection.uncheckedCast (trig);
  }
1020733
public function build()
    {
        $trigger = new CalendarIntervalTrigger();
        $trigger->setRepeatInterval($this->interval);
        $trigger->setRepeatIntervalUnit($this->intervalUnit);
        $trigger->setMisfireInstruction($this->misfireInstruction);
        $trigger->setTimeZone($this->timeZone);
        $trigger->setPreserveHourOfDayAcrossDaylightSavings($this->preserveHourOfDayAcrossDaylightSavings);
        $trigger->setSkipDayIfHourDoesNotExist($this->skipDayIfHourDoesNotExist);

        return $trigger;
    }
194135
def _trigger(self):
        
        self._completed.set()
        for callback in self._callbacks:
            callback(self)