Examples of JobEntity


Examples of org.activiti.engine.impl.persistence.entity.JobEntity

    this.jobId = jobId;
    this.exception = exception;
  }

  public Object execute(CommandContext commandContext) {
    JobEntity job = Context
      .getCommandContext()
      .getJobManager()
      .findJobById(jobId);
    job.setRetries(job.getRetries() - 1);
    job.setLockOwner(null);
    job.setLockExpirationTime(null);
   
    if(exception != null) {
      job.setExceptionMessage(exception.getMessage());
      job.setExceptionStacktrace(getExceptionStacktrace());
    }
   
    JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
    MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
    TransactionContext transactionContext = commandContext.getTransactionContext();
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.JobEntity

    } else {
     
      if (job.getProcessDefinitionId() != null) {
       
        // This is a hack .. need to cleanify this in the engine
        JobEntity jobEntity = (JobEntity) job;
        if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) {
          addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_SUSPEND_PROCESSDEFINITION), false);
        } else if (jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
          addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_ACTIVATE_PROCESSDEFINITION), true);
        } else {
          addNotYetExecutedLabel(layout);
        }
       
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.JobEntity

  private void setRetries(final String processInstanceId, final int retries) {
    final Job job = managementService.createJobQuery().processInstanceId(processInstanceId).singleResult();
    commandExecutor.execute(new Command<Void>() {
     
      public Void execute(CommandContext commandContext) {
        JobEntity timer = commandContext.getDbSqlSession().selectById(JobEntity.class, job.getId());
        timer.setRetries(retries);
        return null;
      }
     
    });
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.JobEntity

  public String execute(CommandContext commandContext) {
    if(jobId == null) {
      throw new ActivitiException("jobId is null");
    }
   
    JobEntity job = commandContext
      .getJobManager()
      .findJobById(jobId);
   
    if(job == null) {
      throw new ActivitiException("No job found with id " + jobId);
    }
   
    return job.getExceptionStacktrace();
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.JobEntity

    }
   
    if (log.isLoggable(Level.FINE)) {
      log.fine("Executing job " + jobId);
    }
    JobEntity job = commandContext
      .getJobManager()
      .findJobById(jobId);
   
    if (job == null) {
      throw new JobNotFoundException(jobId);
    }
   
    JobExecutorContext jobExecutorContext = Context.getJobExecutorContext();
    if(jobExecutorContext != null) { // if null, then we are not called by the job executor    
      jobExecutorContext.setCurrentJob(job);
    }
   
    try {
      job.execute(commandContext);
    } catch (RuntimeException exception) {
      // When transaction is rolled back, decrement retries
      CommandExecutor commandExecutor = Context
        .getProcessEngineConfiguration()
        .getCommandExecutorTxRequiresNew();
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.JobEntity

            this.waitBetweenRetriesInSeconds = waitBetweenRetriesInSeconds;
        }

        @Override
        public Object execute(CommandContext commandContext) {
            JobEntity job = Context.getCommandContext()
                .getJobManager()
                .findJobById(jobId);

            updateNumberOfRetries(job);

            if (exception != null) {
                job.setExceptionMessage(exception.getMessage());
                job.setExceptionStacktrace(getExceptionStacktrace());
            }

            return null;
        }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.persistence.entity.JobEntity

   * chars), so essentially the cutoff would be half the actual cutoff for such a string
   */
  public void testInsertJobWithExceptionMessage() {
    String fittingThreeByteMessage = repeatCharacter("\u9faf", JobEntity.MAX_EXCEPTION_MESSAGE_LENGTH);

    JobEntity threeByteJobEntity = new MessageEntity();
    threeByteJobEntity.setExceptionMessage(fittingThreeByteMessage);

    // should not fail
    insertJob(threeByteJobEntity);

    deleteJob(threeByteJobEntity);
View Full Code Here

Examples of org.camunda.bpm.engine.impl.persistence.entity.JobEntity

    deleteJob(threeByteJobEntity);
  }

  public void testJobExceptionMessageCutoff() {
    JobEntity threeByteJobEntity = new MessageEntity();

    String message = repeatCharacter("a", JobEntity.MAX_EXCEPTION_MESSAGE_LENGTH * 2);
    threeByteJobEntity.setExceptionMessage(message);
    assertEquals(JobEntity.MAX_EXCEPTION_MESSAGE_LENGTH, threeByteJobEntity.getExceptionMessage().length());
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.persistence.entity.JobEntity

  private void setRetries(final String processInstanceId, final int retries) {
    final Job job = managementService.createJobQuery().processInstanceId(processInstanceId).singleResult();
    commandExecutor.execute(new Command<Void>() {

      public Void execute(CommandContext commandContext) {
        JobEntity timer = commandContext.getDbEntityManager().selectById(JobEntity.class, job.getId());
        timer.setRetries(retries);
        return null;
      }

    });
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.persistence.entity.JobEntity

    assertEquals(0, job.getRetries());

    assertEquals(1, runtimeService.createIncidentQuery().count());

    // it should not be possible to set negative retries
    final JobEntity jobEntity = (JobEntity) job;
    processEngineConfiguration
      .getCommandExecutorTxRequired()
      .execute(new Command<Void>() {
        public Void execute(CommandContext commandContext) {
          jobEntity.setRetries(-100);
          return null;
        }
      });

    assertEquals(0, job.getRetries());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.