本文整理汇总了Java中org.activiti.engine.impl.context.Context.getProcessEngineConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getProcessEngineConfiguration方法的具体用法?Java Context.getProcessEngineConfiguration怎么用?Java Context.getProcessEngineConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.context.Context
的用法示例。
在下文中一共展示了Context.getProcessEngineConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getServiceRegistry
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
protected ServiceRegistry getServiceRegistry()
{
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null)
{
// Fetch the registry that is injected in the activiti spring-configuration
ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
if (registry == null)
{
throw new RuntimeException(
"Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
}
return registry;
}
throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
}
示例2: eventNotificationsCompleted
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
protected void eventNotificationsCompleted(InterpretableExecution execution) {
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Map<String, Object> variablesMap = null;
try {
variablesMap = execution.getVariables();
} catch (Throwable t) {
// In some rare cases getting the execution variables can fail (JPA entity load failure for example)
// We ignore the exception here, because it's only meant to include variables in the initialized event.
}
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityWithVariablesEvent(FlowableEngineEventType.ENTITY_INITIALIZED,
execution, variablesMap, false));
Context.getProcessEngineConfiguration().getEventDispatcher()
.dispatchEvent(ActivitiEventBuilder.createProcessStartedEvent(execution, variablesMap, false));
}
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
StartingExecution startingExecution = execution.getStartingExecution();
List<ActivityImpl> initialActivityStack = processDefinition.getInitialActivityStack(startingExecution.getInitial());
execution.setActivity(initialActivityStack.get(0));
execution.performOperation(PROCESS_START_INITIAL);
}
示例3: createSubProcessInstance
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition) {
ExecutionEntity subProcessInstance = newExecution();
// manage bidirectional super-subprocess relation
subProcessInstance.setSuperExecution(this);
this.setSubProcessInstance(subProcessInstance);
// Initialize the new execution
subProcessInstance.setProcessDefinition((ProcessDefinitionImpl) processDefinition);
subProcessInstance.setProcessInstance(subProcessInstance);
Context.getCommandContext().getHistoryManager()
.recordSubProcessInstanceStart(this, subProcessInstance);
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, subProcessInstance));
}
return subProcessInstance;
}
示例4: propagateError
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public static void propagateError(String errorCode, ActivityExecution execution) {
while (execution != null) {
String eventHandlerId = findLocalErrorEventHandler(execution, errorCode);
if (eventHandlerId != null) {
executeCatch(eventHandlerId, execution, errorCode);
break;
}
if (execution.isProcessInstanceType()) {
// dispatch process completed event
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.PROCESS_COMPLETED_WITH_ERROR_END_EVENT, execution));
}
}
execution = getSuperExecution(execution);
}
if (execution == null) {
throw new BpmnError(errorCode, "No catching boundary event found for error with errorCode '"
+ errorCode + "', neither in same process nor in parent process");
}
}
示例5: recordProcessInstanceEnd
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
.findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance != null) {
historicProcessInstance.markEnded(deleteReason);
historicProcessInstance.setEndActivityId(activityId);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_ENDED, historicProcessInstance));
}
}
}
}
示例6: execute
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinitionEntity = commandContext
.getProcessDefinitionEntityManager().findProcessDefinitionById(
processDefinitionId);
String resourceName = processDefinitionEntity.getResourceName();
String deploymentId = processDefinitionEntity.getDeploymentId();
JdbcTemplate jdbcTemplate = new JdbcTemplate(Context
.getProcessEngineConfiguration().getDataSource());
jdbcTemplate
.update("update ACT_GE_BYTEARRAY set BYTES_=? where NAME_=? and DEPLOYMENT_ID_=?",
bytes, resourceName, deploymentId);
Context.getProcessEngineConfiguration().getProcessDefinitionCache()
.remove(processDefinitionId);
try {
// update png
GetBpmnModelCmd getBpmnModelCmd = new GetBpmnModelCmd(
processDefinitionId);
BpmnModel bpmnModel = getBpmnModelCmd.execute(commandContext);
ProcessEngineConfiguration processEngineConfiguration = Context
.getProcessEngineConfiguration();
ProcessDefinitionDiagramCmd processDefinitionDiagramCmd = new ProcessDefinitionDiagramCmd(
processDefinitionEntity.getId());
InputStream is = processDefinitionDiagramCmd
.execute(commandContext);
byte[] pngBytes = IOUtils.toByteArray(is);
String diagramResourceName = processDefinitionEntity
.getDiagramResourceName();
jdbcTemplate
.update("update ACT_GE_BYTEARRAY set BYTES_=? where NAME_=? and DEPLOYMENT_ID_=?",
pngBytes, diagramResourceName, deploymentId);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
示例7: execute
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public InputStream execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
processDefinitionId).execute(commandContext);
String diagramResourceName = processDefinition.getDiagramResourceName();
String deploymentId = processDefinition.getDeploymentId();
if (deploymentId != null) {
byte[] bytes = commandContext
.getResourceEntityManager()
.findResourceByDeploymentIdAndResourceName(deploymentId,
diagramResourceName).getBytes();
InputStream inputStream = new ByteArrayInputStream(bytes);
return inputStream;
}
GetBpmnModelCmd getBpmnModelCmd = new GetBpmnModelCmd(
processDefinitionId);
BpmnModel bpmnModel = getBpmnModelCmd.execute(commandContext);
ProcessEngineConfiguration processEngineConfiguration = Context
.getProcessEngineConfiguration();
InputStream is = new DefaultProcessDiagramGenerator().generateDiagram(
bpmnModel, "png",
processEngineConfiguration.getActivityFontName(),
processEngineConfiguration.getLabelFontName(), null);
return is;
}
示例8: execute
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void execute(InterpretableExecution execution) {
ActivityImpl activity = (ActivityImpl) execution.getActivity();
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if (activityBehavior == null) {
throw new PvmException("no behavior specified in " + activity);
}
LOGGER.debug("{} executes {}: {}", execution, activity, activityBehavior.getClass().getName());
try {
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_STARTED,
execution.getActivity().getId(),
(String) execution.getActivity().getProperty("name"),
execution.getId(),
execution.getProcessInstanceId(),
execution.getProcessDefinitionId(),
(String) activity.getProperties().get("type"),
activity.getActivityBehavior().getClass().getCanonicalName()));
}
activityBehavior.execute(execution);
} catch (ActivitiException e) {
throw e;
} catch (Throwable t) {
LogMDC.putMDCExecution(execution);
throw new ActivitiActivityExecutionException("couldn't execute activity <" + activity.getProperty("type") + " id=\"" + activity.getId() + "\" ...>: " + t.getMessage(), t);
}
}
示例9: createVariableInstance
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
protected VariableInstanceEntity createVariableInstance(String variableName, Object value,
ExecutionEntity sourceActivityExecution) {
VariableInstanceEntity result = super.createVariableInstance(variableName, value, sourceActivityExecution);
// Dispatch event, if needed
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createVariableEvent(FlowableEngineEventType.VARIABLE_CREATED, variableName, value, result.getType(), result.getTaskId(),
result.getExecutionId(), getProcessInstanceId(), getProcessDefinitionId()));
}
return result;
}
示例10: endHistoricActivityInstance
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
protected void endHistoricActivityInstance(HistoricActivityInstanceEntity historicActivityInstance) {
historicActivityInstance.markEnded(null);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
}
}
示例11: createExecution
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
/**
* creates a new execution. properties processDefinition, processInstance and activity will be initialized.
*/
@Override
public ExecutionEntity createExecution() {
// create the new child execution
ExecutionEntity createdExecution = newExecution();
// manage the bidirectional parent-child relation
ensureExecutionsInitialized();
executions.add(createdExecution);
createdExecution.setParent(this);
// initialize the new execution
createdExecution.setProcessDefinition(getProcessDefinition());
createdExecution.setProcessInstance(getProcessInstance());
createdExecution.setActivity(getActivity());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Child execution {} created with parent {}", createdExecution, this);
}
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, createdExecution));
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_INITIALIZED, createdExecution));
}
return createdExecution;
}
示例12: fireActivityCompletedEvent
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
protected void fireActivityCompletedEvent() {
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_COMPLETED,
getActivity() != null ? getActivity().getId() : getActivityId(),
getActivity() != null ? (String) getActivity().getProperties().get("name") : null,
getId(),
getProcessInstanceId(),
getProcessDefinitionId(),
getActivity() != null ? (String) getActivity().getProperties().get("type") : null,
getActivity() != null ? getActivity().getActivityBehavior().getClass().getCanonicalName() : null));
}
}
示例13: remove
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void remove() {
ensureParentInitialized();
if (parent != null) {
parent.ensureExecutionsInitialized();
parent.executions.remove(this);
}
// delete all the variable instances
ensureVariableInstancesInitialized();
deleteVariablesInstanceForLeavingScope();
// delete all the tasks
removeTasks(null);
// remove all jobs
removeJobs();
// remove all event subscriptions for this scope, if the scope has event subscriptions:
removeEventSubscriptions();
// remove event scopes:
removeEventScopes();
// remove identity links
removeIdentityLinks();
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_DELETED, this));
}
// finally delete this execution
Context.getCommandContext()
.getDbSqlSession()
.delete(this);
}
示例14: updateVariableInstance
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
protected void updateVariableInstance(VariableInstanceEntity variableInstance, Object value,
ExecutionEntity sourceActivityExecution) {
super.updateVariableInstance(variableInstance, value, sourceActivityExecution);
// Dispatch event, if needed
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createVariableEvent(FlowableEngineEventType.VARIABLE_UPDATED, variableInstance.getName(), value, variableInstance.getType(),
variableInstance.getTaskId(), variableInstance.getExecutionId(), getProcessInstanceId(), getProcessDefinitionId()));
}
}
示例15: updateProcessBusinessKey
import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public String updateProcessBusinessKey(String bzKey) {
if (isProcessInstanceType() && bzKey != null) {
setBusinessKey(bzKey);
Context.getCommandContext().getHistoryManager().updateProcessBusinessKeyInHistory(this);
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, this));
}
return bzKey;
}
return null;
}