本文整理汇总了Java中org.camunda.bpm.engine.impl.interceptor.CommandContext类的典型用法代码示例。如果您正苦于以下问题:Java CommandContext类的具体用法?Java CommandContext怎么用?Java CommandContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandContext类属于org.camunda.bpm.engine.impl.interceptor包,在下文中一共展示了CommandContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerProcessApplication
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
protected ProcessApplicationRegistration registerProcessApplication(CommandContext commandContext, DeploymentEntity deployment,
Set<String> processKeysToRegisterFor) {
ProcessApplicationDeploymentBuilderImpl appDeploymentBuilder = (ProcessApplicationDeploymentBuilderImpl) deploymentBuilder;
final ProcessApplicationReference appReference = appDeploymentBuilder.getProcessApplicationReference();
// build set of deployment ids this process app should be registered for:
Set<String> deploymentsToRegister = new HashSet<String>(Collections.singleton(deployment.getId()));
if (appDeploymentBuilder.isResumePreviousVersions()) {
if (ResumePreviousBy.RESUME_BY_PROCESS_DEFINITION_KEY.equals(appDeploymentBuilder.getResumePreviousVersionsBy())) {
deploymentsToRegister.addAll(resumePreviousByProcessDefinitionKey(commandContext, deployment, processKeysToRegisterFor));
}else if(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME.equals(appDeploymentBuilder.getResumePreviousVersionsBy())){
deploymentsToRegister.addAll(resumePreviousByDeploymentName(commandContext, deployment));
}
}
// register process application for deployments
return new RegisterProcessApplicationCmd(deploymentsToRegister, appReference).execute(commandContext);
}
示例2: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
DbEntityManagerFactory dbEntityManagerFactory = new DbEntityManagerFactory(Context.getProcessEngineConfiguration().getIdGenerator());
DbEntityManager entityManager = dbEntityManagerFactory.openSession();
JobEntity job = entityManager.selectById(JobEntity.class, JOB_ENTITY_ID);
job.setLockOwner(lockOwner);
entityManager.forceUpdate(job);
monitor.sync();
// flush the changed entity and create a lock for the table
entityManager.flush();
monitor.sync();
// commit transaction and remove the lock
commandContext.getTransactionContext().commit();
return null;
}
示例3: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
public VariableMap execute(final CommandContext commandContext) {
StartFormData startFormData = commandContext.runWithoutAuthorization(new Callable<StartFormData>() {
public StartFormData call() throws Exception {
return new GetStartFormCmd(resourceId).execute(commandContext);
}
});
ProcessDefinition definition = startFormData.getProcessDefinition();
checkGetStartFormVariables((ProcessDefinitionEntity) definition, commandContext);
VariableMap result = new VariableMapImpl();
for (FormField formField : startFormData.getFormFields()) {
if(formVariableNames == null || formVariableNames.contains(formField.getId())) {
result.put(formField.getId(), createVariable(formField, null));
}
}
return result;
}
示例4: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
ensureNotNull("UserId", userId);
IdentityInfoEntity infoEntity = commandContext.getIdentityInfoManager()
.findUserInfoByUserIdAndKey(userId, "picture");
if(infoEntity != null) {
String byteArrayId = infoEntity.getValue();
if(byteArrayId != null) {
commandContext.getByteArrayManager()
.deleteByteArrayById(byteArrayId);
}
commandContext.getIdentityInfoManager()
.delete(infoEntity);
}
return null;
}
示例5: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
public InputStream execute(final CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
final String deploymentId = processDefinition.getDeploymentId();
final String resourceName = processDefinition.getDiagramResourceName();
if (resourceName == null ) {
return null;
} else {
InputStream processDiagramStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
return processDiagramStream;
}
}
示例6: setAssignee
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
@Override
public void setAssignee(String assignee) {
ensureTaskActive();
registerCommandContextCloseListener();
String oldAssignee = this.assignee;
if (assignee==null && oldAssignee==null) {
return;
}
addIdentityLinkChanges(IdentityLinkType.ASSIGNEE, oldAssignee, assignee);
propertyChanged(ASSIGNEE, oldAssignee, assignee);
this.assignee = assignee;
CommandContext commandContext = Context.getCommandContext();
// if there is no command context, then it means that the user is calling the
// setAssignee outside a service method. E.g. while creating a new task.
if (commandContext != null) {
fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
if (commandContext.getDbEntityManager().contains(this)) {
fireAssigneeAuthorizationProvider(oldAssignee, assignee);
fireHistoricIdentityLinks();
}
}
}
示例7: handleStartEvent
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
protected void handleStartEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
String processDefinitionId = eventSubscription.getConfiguration();
ensureNotNull("Configuration of signal start event subscription '" + eventSubscription.getId() + "' contains no process definition id.",
processDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null || processDefinition.isSuspended()) {
// ignore event subscription
LOG.debugIgnoringEventSubscription(eventSubscription, processDefinitionId);
} else {
ActivityImpl signalStartEvent = processDefinition.findActivity(eventSubscription.getActivityId());
PvmProcessInstance processInstance = processDefinition.createProcessInstanceForInitial(signalStartEvent);
processInstance.start();
}
}
示例8: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
@Override
public Void execute(CommandContext commandContext) {
ensureNotNull("processDefinitionKey", processDefinitionKey);
List<ProcessDefinition> processDefinitions = commandContext.getProcessDefinitionManager()
.findDefinitionsByKeyAndTenantId(processDefinitionKey, tenantId, isTenantIdSet);
ensureNotEmpty(NotFoundException.class, "No process definition found with key '" + processDefinitionKey + "'",
"processDefinitions", processDefinitions);
for (ProcessDefinition processDefinition: processDefinitions) {
String processDefinitionId = processDefinition.getId();
deleteProcessDefinitionCmd(commandContext, processDefinitionId, cascade, skipCustomListeners);
}
return null;
}
示例9: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
public InputStream execute(CommandContext commandContext) {
AttachmentEntity attachment = (AttachmentEntity) commandContext
.getAttachmentManager()
.findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId);
if (attachment == null) {
return null;
}
String contentId = attachment.getContentId();
if (contentId==null) {
return null;
}
ByteArrayEntity byteArray = commandContext
.getDbEntityManager()
.selectById(ByteArrayEntity.class, contentId);
byte[] bytes = byteArray.getBytes();
return new ByteArrayInputStream(bytes);
}
示例10: writeUserOperationLog
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
protected void writeUserOperationLog(CommandContext commandContext,
int numInstances,
boolean async) {
List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
propertyChanges.add(new PropertyChange("nrOfInstances",
null,
numInstances));
propertyChanges.add(new PropertyChange("async", null, async));
String operationType;
if(suspending) {
operationType = UserOperationLogEntry.OPERATION_TYPE_SUSPEND_JOB;
} else {
operationType = UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_JOB;
}
commandContext.getOperationLogManager()
.logProcessInstanceOperation(operationType,
null,
null,
null,
propertyChanges);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:AbstractUpdateProcessInstancesSuspendStateCmd.java
示例11: collectJobIds
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
protected List<String> collectJobIds(CommandContext commandContext) {
Set<String> collectedJobIds = new HashSet<String>();
List<String> jobIds = this.getJobIds();
if (jobIds != null) {
collectedJobIds.addAll(jobIds);
}
final JobQuery jobQuery = this.jobQuery;
if (jobQuery != null) {
for (Job job : jobQuery.list()) {
collectedJobIds.add(job.getId());
}
}
return new ArrayList<String>(collectedJobIds);
}
示例12: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
@Override
public Batch execute(CommandContext commandContext) {
List<String> processInstanceIds = collectProcessInstanceIds();
ensureNotEmpty(BadUserRequestException.class, "processInstanceIds", processInstanceIds);
checkAuthorizations(commandContext);
writeUserOperationLog(commandContext,
deleteReason,
processInstanceIds.size(),
true);
BatchEntity batch = createBatch(commandContext, processInstanceIds);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
示例13: setJobRetriesByJobDefinitionId
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
protected void setJobRetriesByJobDefinitionId(CommandContext commandContext) {
JobDefinitionManager jobDefinitionManager = commandContext.getJobDefinitionManager();
JobDefinitionEntity jobDefinition = jobDefinitionManager.findById(jobDefinitionId);
if (jobDefinition != null) {
String processDefinitionId = jobDefinition.getProcessDefinitionId();
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstanceByProcessDefinitionId(processDefinitionId);
}
}
commandContext
.getJobManager()
.updateFailedJobRetriesByJobDefinitionId(jobDefinitionId, retries);
PropertyChange propertyChange = new PropertyChange(RETRIES, null, retries);
commandContext.getOperationLogManager().logJobOperation(getLogEntryOperation(), null, jobDefinitionId, null,
null, null, propertyChange);
}
示例14: execute
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext
.getDbEntityManager()
.selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
commandContext.disableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
commandContext.getProcessEngineConfiguration()
.getHistoryService()
.deleteHistoricProcessInstances(batchConfiguration.getIds());
} finally {
commandContext.enableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
commandContext.getByteArrayManager().delete(configurationEntity);
}
示例15: cleanup
import org.camunda.bpm.engine.impl.interceptor.CommandContext; //导入依赖的package包/类
@After
public void cleanup() {
//remove history level from database
((ProcessEngineConfigurationImpl)processEngine.getProcessEngineConfiguration()).getCommandExecutorTxRequired().execute(new Command<Void>() {
@Override
public Void execute(CommandContext commandContext) {
final PropertyEntity historyLevel = commandContext.getPropertyManager().findPropertyById("historyLevel");
if (historyLevel != null) {
commandContext.getDbEntityManager().delete(historyLevel);
}
return null;
}
});
}
开发者ID:camunda,项目名称:camunda-bpm-spring-boot-starter,代码行数:15,代码来源:AbstractCamundaAutoConfigurationIT.java