本文整理汇总了Java中org.camunda.bpm.engine.impl.context.Context类的典型用法代码示例。如果您正苦于以下问题:Java Context类的具体用法?Java Context怎么用?Java Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Context类属于org.camunda.bpm.engine.impl.context包,在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getTenantIdOfCurrentAuthentication
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
protected String getTenantIdOfCurrentAuthentication() {
IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
if (currentAuthentication != null) {
List<String> tenantIds = currentAuthentication.getTenantIds();
if (tenantIds.size() == 1) {
return tenantIds.get(0);
} else if (tenantIds.isEmpty()) {
return null;
} else {
throw new IllegalStateException("more than one authenticated tenant");
}
} else {
return null;
}
}
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:20,代码来源:UasTenantIdProvider.java
示例2: evaluate
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public boolean evaluate(ExecutionEntity executionEntity) {
if (script == null) {
return true;
}
Context.getProcessEngineConfiguration().getScriptFactory();
ExecutableScript executableScript = Context.getProcessEngineConfiguration()
.getScriptFactory()
.createScriptFromSource(scriptingLanguage, script);
Object result = Context.getProcessEngineConfiguration()
.getScriptingEnvironment()
.execute(executableScript, executionEntity);
if (result == null) {
throw new DebuggerException("Breakpoint condition evaluates to null: " + script);
} else if (!(result instanceof Boolean)) {
throw new DebuggerException("Script does not return boolean value: " + script);
}
return (Boolean) result;
}
开发者ID:camunda,项目名称:camunda-bpm-workbench,代码行数:24,代码来源:ScriptBreakPointCondition.java
示例3: execute
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public void execute(DebugSessionImpl debugSession, SuspendedExecutionImpl suspendedExecution) {
CodeCompleterBuilder builder = new CodeCompleterBuilder();
if (scopeId != null) {
synchronized (suspendedExecution) {
if(!suspendedExecution.isResumed) {
ExecutionEntity executionEntity = suspendedExecution.getExecution();
ScriptBindingsFactory bindingsFactory = Context.getProcessEngineConfiguration()
.getScriptingEngines().getScriptBindingsFactory();
Bindings scopeBindings = bindingsFactory.createBindings(executionEntity, new SimpleBindings());
builder.bindings(scopeBindings);
}
}
}
List<CodeCompletionHint> hints = builder.buildCompleter().complete(prefix);
debugSession.fireCodeCompletion(hints);
}
开发者ID:camunda,项目名称:camunda-bpm-workbench,代码行数:19,代码来源:CodeCompletionOperation.java
示例4: execute
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
DbEntityManagerFactory dbEntityManagerFactory = new DbEntityManagerFactory(Context.getProcessEngineConfiguration().getIdGenerator());
DbEntityManager newEntityManager = dbEntityManagerFactory.openSession();
HistoricProcessInstanceEventEntity hpi = new HistoricProcessInstanceEventEntity();
hpi.setId(id);
hpi.setProcessInstanceId(id);
hpi.setProcessDefinitionId("someProcDefId");
hpi.setStartTime(new Date());
hpi.setState(HistoricProcessInstance.STATE_ACTIVE);
newEntityManager.insert(hpi);
newEntityManager.flush();
monitor.sync();
DbEntityManager cmdEntityManager = commandContext.getDbEntityManager();
cmdEntityManager.createHistoricProcessInstanceQuery().list();
monitor.sync();
return null;
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:DbDeadlockTest.java
示例5: execute
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public TypedValue execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
ensureNotNull("variableName", variableName);
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
ensureNotNull("task " + taskId + " doesn't exist", "task", task);
checkGetTaskVariableTyped(task, commandContext);
TypedValue value;
if (isLocal) {
value = task.getVariableLocalTyped(variableName, deserializeValue);
} else {
value = task.getVariableTyped(variableName, deserializeValue);
}
return value;
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:GetTaskVariableCmdTyped.java
示例6: fireHistoricIdentityLinkEvent
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public void fireHistoricIdentityLinkEvent(final HistoryEventType eventType) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
if(historyLevel.isHistoryEventProduced(eventType, this)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
HistoryEvent event = null;
if (HistoryEvent.IDENTITY_LINK_ADD.equals(eventType.getEventName())) {
event = producer.createHistoricIdentityLinkAddEvent(IdentityLinkEntity.this);
} else if (HistoryEvent.IDENTITY_LINK_DELETE.equals(eventType.getEventName())) {
event = producer.createHistoricIdentityLinkDeleteEvent(IdentityLinkEntity.this);
}
return event;
}
});
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:IdentityLinkEntity.java
示例7: deserializeFromByteArray
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
protected Object deserializeFromByteArray(byte[] bytes, String objectTypeName) throws Exception {
DataFormatMapper mapper = dataFormat.getMapper();
DataFormatReader reader = dataFormat.getReader();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
InputStreamReader inReader = new InputStreamReader(bais, Context.getProcessEngineConfiguration().getDefaultCharset());
BufferedReader bufferedReader = new BufferedReader(inReader);
try {
Object mappedObject = reader.readInput(bufferedReader);
return mapper.mapInternalToJava(mappedObject, objectTypeName);
}
finally{
IoUtil.closeSilently(bais);
IoUtil.closeSilently(inReader);
IoUtil.closeSilently(bufferedReader);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:SpinObjectValueSerializer.java
示例8: performNotification
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
protected void performNotification(final DelegateExecution execution, Callable<Void> notification) throws Exception {
final ProcessApplicationReference processApp = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution);
if (processApp == null) {
// ignore silently
LOG.noTargetProcessApplicationForExecution(execution);
} else {
if (ProcessApplicationContextUtil.requiresContextSwitch(processApp)) {
// this should not be necessary since context switch is already performed by OperationContext and / or DelegateInterceptor
Context.executeWithinProcessApplication(notification, processApp, new InvocationContext(execution));
} else {
// context switch already performed
notification.call();
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ProcessApplicationEventListenerDelegate.java
示例9: provideTenantId
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
protected void provideTenantId(Map<String, Object> variables) {
if (tenantId == null) {
TenantIdProvider tenantIdProvider = Context.getProcessEngineConfiguration().getTenantIdProvider();
if (tenantIdProvider != null) {
VariableMap variableMap = Variables.fromMap(variables);
ProcessDefinition processDefinition = getProcessDefinition();
TenantIdProviderProcessInstanceContext ctx;
if (superExecutionId != null) {
ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperExecution());
} else if (superCaseExecutionId != null) {
ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap, getSuperCaseExecution());
} else {
ctx = new TenantIdProviderProcessInstanceContext(processDefinition, variableMap);
}
tenantId = tenantIdProvider.provideTenantIdForProcessInstance(ctx);
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:ExecutionEntity.java
示例10: handleStartEvent
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的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();
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:SignalEventHandler.java
示例11: executeSelectSum
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public Long executeSelectSum(MetricsQueryImpl query) {
Long result = (Long) getDbEntityManager().selectOne(SELECT_METER_SUM, query);
result = result != null ? result : 0;
if(shouldAddCurrentUnloggedCount(query)) {
// add current unlogged count
Meter meter = Context.getProcessEngineConfiguration()
.getMetricsRegistry()
.getMeterByName(query.getName());
if(meter != null) {
result += meter.get();
}
}
return result;
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:MeterLogManager.java
示例12: instantiateDelegate
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public static Object instantiateDelegate(String className, List<FieldDeclaration> fieldDeclarations) {
ArtifactFactory artifactFactory = Context.getProcessEngineConfiguration().getArtifactFactory();
try {
Class<?> clazz = ReflectUtil.loadClass(className);
Object object = artifactFactory.getArtifact(clazz);
applyFieldDeclaration(fieldDeclarations, object);
return object;
}
catch (Exception e) {
throw LOG.exceptionWhileInstantiatingClass(className, e);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:ClassDelegateUtil.java
示例13: loadProcessDefinition
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
/**
* Returns the cached version if exists; does not update the entity from the database in that case
*/
protected ProcessDefinitionEntity loadProcessDefinition(String processDefinitionId) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = configuration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findProcessDefinitionFromCache(processDefinitionId);
if (processDefinition == null) {
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
if (processDefinition != null) {
processDefinition = deploymentCache.resolveProcessDefinition(processDefinition);
}
}
return processDefinition;
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:ProcessDefinitionEntity.java
示例14: parseConfiguration
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) {
this.deploymentId = deployment.getId();
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration()
.getExpressionManager();
Element extensionElement = activityElement.element("extensionElements");
if (extensionElement != null) {
// provide support for deprecated form properties
parseFormProperties(bpmnParse, expressionManager, extensionElement);
// provide support for new form field metadata
parseFormData(bpmnParse, expressionManager, extensionElement);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:DefaultFormHandler.java
示例15: setAssignee
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的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();
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskEntity.java
示例16: setOwner
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
@Override
public void setOwner(String owner) {
ensureTaskActive();
registerCommandContextCloseListener();
String oldOwner = this.owner;
if (owner==null && oldOwner==null) {
return;
}
addIdentityLinkChanges(IdentityLinkType.OWNER, oldOwner, owner);
propertyChanged(OWNER, oldOwner, owner);
this.owner = owner;
CommandContext commandContext = Context.getCommandContext();
// if there is no command context, then it means that the user is calling the
// setOwner outside a service method. E.g. while creating a new task.
if (commandContext != null && commandContext.getDbEntityManager().contains(this)) {
fireOwnerAuthorizationProvider(oldOwner, owner);
this.fireHistoricIdentityLinks();
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:TaskEntity.java
示例17: getValue
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
public Object getValue(VariableScope variableScope, BaseDelegateExecution contextExecution) {
ELContext elContext = expressionManager.getElContext(variableScope);
try {
ExpressionGetInvocation invocation = new ExpressionGetInvocation(valueExpression, elContext, contextExecution);
Context.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(invocation);
return invocation.getInvocationResult();
} catch (PropertyNotFoundException pnfe) {
throw new ProcessEngineException("Unknown property used in expression: " + expressionText+". Cause: "+pnfe.getMessage(), pnfe);
} catch (MethodNotFoundException mnfe) {
throw new ProcessEngineException("Unknown method used in expression: " + expressionText+". Cause: "+mnfe.getMessage(), mnfe);
} catch(ELException ele) {
throw new ProcessEngineException("Error while evaluating expression: " + expressionText+". Cause: "+ele.getMessage(), ele);
} catch (Exception e) {
throw new ProcessEngineException("Error while evaluating expression: " + expressionText+". Cause: "+e.getMessage(), e);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:JuelExpression.java
示例18: removeProcessApplicationRegistration
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
protected void removeProcessApplicationRegistration(final Set<String> deploymentIds, boolean removeProcessesFromCache) {
for (String deploymentId : deploymentIds) {
try {
if(removeProcessesFromCache) {
Context.getProcessEngineConfiguration()
.getDeploymentCache()
.removeDeployment(deploymentId);
}
}
catch (Throwable t) {
LOG.couldNotRemoveDefinitionsFromCache(t);
}
finally {
if(deploymentId != null) {
registrationsByDeploymentId.remove(deploymentId);
}
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:ProcessApplicationManager.java
示例19: testExecuteWithInvocationContext
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testExecuteWithInvocationContext() throws Exception {
// given a process application which extends the default one
// - using a spy for verify the invocations
TestApplicationWithoutEngine processApplication = spy(pa);
ProcessApplicationReference processApplicationReference = mock(ProcessApplicationReference.class);
when(processApplicationReference.getProcessApplication()).thenReturn(processApplication);
// when execute with context
InvocationContext invocationContext = new InvocationContext(mock(BaseDelegateExecution.class));
Context.executeWithinProcessApplication(mock(Callable.class), processApplicationReference, invocationContext);
// then the execute method should be invoked with context
verify(processApplication).execute(any(Callable.class), eq(invocationContext));
// and forward to call to the default execute method
verify(processApplication).execute(any(Callable.class));
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:ProcessApplicationContextTest.java
示例20: execute
import org.camunda.bpm.engine.impl.context.Context; //导入依赖的package包/类
@Override
public void execute(AsyncContinuationConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
LegacyBehavior.repairMultiInstanceAsyncJob(execution);
PvmAtomicOperation atomicOperation = findMatchingAtomicOperation(configuration.getAtomicOperation());
ensureNotNull("Cannot process job with configuration " + configuration, "atomicOperation", atomicOperation);
// reset transition id.
String transitionId = configuration.getTransitionId();
if (transitionId != null) {
PvmActivity activity = execution.getActivity();
TransitionImpl transition = (TransitionImpl) activity.findOutgoingTransition(transitionId);
execution.setTransition(transition);
}
Context.getCommandInvocationContext()
.performOperation(atomicOperation, execution);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:AsyncContinuationJobHandler.java
注:本文中的org.camunda.bpm.engine.impl.context.Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论