本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.JobEntity.getProcessInstanceId方法的典型用法代码示例。如果您正苦于以下问题:Java JobEntity.getProcessInstanceId方法的具体用法?Java JobEntity.getProcessInstanceId怎么用?Java JobEntity.getProcessInstanceId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.JobEntity
的用法示例。
在下文中一共展示了JobEntity.getProcessInstanceId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public AcquiredJobs execute(CommandContext commandContext) {
String lockOwner = jobExecutor.getLockOwner();
int lockTimeInMillis = jobExecutor.getLockTimeInMillis();
int maxNonExclusiveJobsPerAcquisition = jobExecutor.getMaxJobsPerAcquisition();
AcquiredJobs acquiredJobs = new AcquiredJobs();
List<JobEntity> jobs = commandContext
.getJobEntityManager()
.findNextJobsToExecute(new Page(0, maxNonExclusiveJobsPerAcquisition));
for (JobEntity job: jobs) {
List<String> jobIds = new ArrayList<String>();
if (job != null && !acquiredJobs.contains(job.getId())) {
if (job.isExclusive() && job.getProcessInstanceId() != null) {
// acquire all exclusive jobs in the same process instance
// (includes the current job)
List<JobEntity> exclusiveJobs = commandContext.getJobEntityManager()
.findExclusiveJobsToExecute(job.getProcessInstanceId());
for (JobEntity exclusiveJob : exclusiveJobs) {
if(exclusiveJob != null) {
lockJob(exclusiveJob, lockOwner, lockTimeInMillis);
jobIds.add(exclusiveJob.getId());
}
}
} else {
lockJob(job, lockOwner, lockTimeInMillis);
jobIds.add(job.getId());
}
}
acquiredJobs.addJobIdBatch(jobIds);
}
return acquiredJobs;
}
示例2: getProcessId
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
private String getProcessId(CommandContext commandContext) {
JobEntity job = commandContext.getJobEntityManager().findJobById(jobId);
return job.getProcessInstanceId();
}
示例3: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public AcquiredJobs execute(CommandContext commandContext) {
String lockOwner = jobExecutor.getLockOwner();
int lockTimeInMillis = jobExecutor.getLockTimeInMillis();
int maxJobsPerAcquisition = jobExecutor.getMaxJobsPerAcquisition();
int jobsInThisAcquisition = 0;
AcquiredJobs acquiredJobs = new AcquiredJobs();
List<JobEntity> jobs = commandContext
.getJobManager()
.findNextJobsToExecute(new Page(0, maxJobsPerAcquisition));
for (JobEntity job: jobs) {
List<String> jobIds = new ArrayList<String>();
if (job != null && !acquiredJobs.contains(job.getId())) {
if (job.isExclusive() && job.getProcessInstanceId() != null) {
// acquire all exclusive jobs in the same process instance
// (includes the current job)
List<JobEntity> exclusiveJobs = commandContext.getJobManager()
.findExclusiveJobsToExecute(job.getProcessInstanceId());
for (JobEntity exclusiveJob : exclusiveJobs) {
if(exclusiveJob != null) {
lockJob(exclusiveJob, lockOwner, lockTimeInMillis);
jobIds.add(exclusiveJob.getId());
}
}
} else {
lockJob(job, lockOwner, lockTimeInMillis);
jobIds.add(job.getId());
}
}
acquiredJobs.addJobIdBatch(jobIds);
jobsInThisAcquisition += jobIds.size();
if(jobsInThisAcquisition >= maxJobsPerAcquisition) {
break;
}
}
return acquiredJobs;
}