当前位置: 首页>>代码示例>>Java>>正文


Java Context.getCommandContext方法代码示例

本文整理汇总了Java中org.activiti.engine.impl.context.Context.getCommandContext方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getCommandContext方法的具体用法?Java Context.getCommandContext怎么用?Java Context.getCommandContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.impl.context.Context的用法示例。


在下文中一共展示了Context.getCommandContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findInitiator

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
/**
 * 获得流程发起人.
 */
public String findInitiator(String processInstanceId) {
    String initiator = null;

    if (Context.getCommandContext() == null) {
        initiator = processEngine.getHistoryService()
                .createHistoricProcessInstanceQuery()
                .processInstanceId(processInstanceId).singleResult()
                .getStartUserId();
    } else {
        initiator = Context.getCommandContext()
                .getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(processInstanceId)
                .getStartUserId();
    }

    return initiator;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:ActivitiInternalProcessConnector.java

示例2: updateProcessInstanceLockTime

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void updateProcessInstanceLockTime(String processInstanceId) {
    CommandContext commandContext = Context.getCommandContext();
    Date expirationTime = commandContext.getProcessEngineConfiguration().getClock().getCurrentTime();
    int lockMillis = commandContext.getProcessEngineConfiguration().getAsyncExecutorAsyncJobLockTimeInMillis();
    GregorianCalendar lockCal = new GregorianCalendar();
    lockCal.setTime(expirationTime);
    lockCal.add(Calendar.MILLISECOND, lockMillis);

    HashMap<String, Object> params = new HashMap<>();
    params.put("id", processInstanceId);
    params.put("lockTime", lockCal.getTime());
    params.put("expirationTime", expirationTime);

    int result = getDbSqlSession().update("updateProcessInstanceLockTime", params);
    if (result == 0) {
        throw new ActivitiOptimisticLockingException("Could not lock process instance");
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:ExecutionEntityManager.java

示例3: insert

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void insert(ExecutionEntity execution, boolean fireEvents) {
    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.insert(this);

    // Inherit tenant id (if applicable)
    if (execution != null && execution.getTenantId() != null) {
        setTenantId(execution.getTenantId());
    }

    if (execution != null) {
        execution.addTask(this);
    }

    commandContext.getHistoryManager().recordTaskCreated(this, execution);

    if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled() && fireEvents) {
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, this));
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_INITIALIZED, this));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:TaskEntity.java

示例4: update

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void update() {
    // Needed to make history work: the setter will also update the historic task
    setOwner(this.getOwner());
    setAssignee(this.getAssignee(), true, false);
    setDelegationState(this.getDelegationState());
    setName(this.getName());
    setDescription(this.getDescription());
    setPriority(this.getPriority());
    setCategory(this.getCategory());
    setCreateTime(this.getCreateTime());
    setDueDate(this.getDueDate());
    setParentTaskId(this.getParentTaskId());
    setFormKey(formKey);

    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.update(this);

    if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, this));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:TaskEntity.java

示例5: setDueDate

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void setDueDate(Date dueDate, boolean dispatchUpdateEvent) {
    this.dueDate = dueDate;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext != null) {
        commandContext
                .getHistoryManager()
                .recordTaskDueDateChange(id, dueDate);

        if (dispatchUpdateEvent && commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
            if (dispatchUpdateEvent) {
                commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                        ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, this));
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:18,代码来源:TaskEntity.java

示例6: onEvent

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void onEvent(FlowableEvent event) {
    if (isValidEvent(event) && event instanceof FlowableEngineEvent) {
        FlowableEngineEvent engineEvent = (FlowableEngineEvent) event;

        if (engineEvent.getProcessInstanceId() == null && processInstanceScope) {
            throw new ActivitiIllegalArgumentException(
                    "Cannot throw process-instance scoped signal, since the dispatched event is not part of an ongoing process instance");
        }

        CommandContext commandContext = Context.getCommandContext();
        List<SignalEventSubscriptionEntity> subscriptionEntities = null;
        if (processInstanceScope) {
            subscriptionEntities = commandContext.getEventSubscriptionEntityManager()
                    .findSignalEventSubscriptionsByProcessInstanceAndEventName(engineEvent.getProcessInstanceId(), signalName);
        } else {
            String tenantId = null;
            if (engineEvent.getProcessDefinitionId() != null) {
                ProcessDefinition processDefinition = commandContext.getProcessEngineConfiguration()
                        .getDeploymentManager().findDeployedProcessDefinitionById(engineEvent.getProcessDefinitionId());
                tenantId = processDefinition.getTenantId();
            }
            subscriptionEntities = commandContext.getEventSubscriptionEntityManager()
                    .findSignalEventSubscriptionsByEventName(signalName, tenantId);
        }

        for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) {
            signalEventSubscriptionEntity.eventReceived(null, false);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:32,代码来源:SignalThrowingEventListener.java

示例7: setName

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void setName(String taskName) {
    this.name = taskName;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext != null) {
        commandContext
                .getHistoryManager()
                .recordTaskNameChange(id, taskName);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:TaskEntity.java

示例8: updateProcessDefinitionInfo

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void updateProcessDefinitionInfo(ProcessDefinitionInfoEntity updatedProcessDefinitionInfo) {
    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.update(updatedProcessDefinitionInfo);

    if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, updatedProcessDefinitionInfo));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:11,代码来源:ProcessDefinitionInfoEntityManager.java

示例9: initializeVariable

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
/**
 * If the passed {@link HistoricVariableInstanceEntity} is a binary variable and the command-context is active, the variable value is fetched to ensure the byte-array is populated.
 */
protected void initializeVariable(HistoricVariableInstanceEntity e) {
    if (Context.getCommandContext() != null && e != null && e.getVariableType() != null) {
        e.getValue();

        // make sure JPA entities are cached for later retrieval
        if (JPAEntityVariableType.TYPE_NAME.equals(e.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(e.getVariableType().getTypeName())) {
            ((CacheableVariable) e.getVariableType()).setForceCacheable(true);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:HistoricVariableInitializingList.java

示例10: setOwner

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
public void setOwner(String owner, boolean dispatchUpdateEvent) {
    if (owner == null && this.owner == null) {
        return;
    }
    // if (owner!=null && owner.equals(this.owner)) {
    // return;
    // }
    this.owner = owner;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext != null) {
        commandContext
                .getHistoryManager()
                .recordTaskOwnerChange(id, owner);

        if (owner != null && processInstanceId != null) {
            getProcessInstance().involveUser(owner, IdentityLinkType.PARTICIPANT);
        }

        if (dispatchUpdateEvent && commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
            if (dispatchUpdateEvent) {
                commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                        ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, this));
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:TaskEntity.java

示例11: readJsonValue

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
protected static JsonNode readJsonValue(String config) throws IOException {
    if (Context.getCommandContext() != null) {
        return Context.getProcessEngineConfiguration().getObjectMapper().readTree(config);
    } else {
        return new ObjectMapper().readTree(config);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:8,代码来源:TimerEventHandler.java

示例12: setCategory

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void setCategory(String category) {
    this.category = category;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext != null) {
        commandContext
                .getHistoryManager()
                .recordTaskCategoryChange(id, category);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:TaskEntity.java

示例13: dispatchStateChangeEvent

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
protected static void dispatchStateChangeEvent(Object entity, SuspensionState state) {
    if (Context.getCommandContext() != null && Context.getCommandContext().getEventDispatcher().isEnabled()) {
        FlowableEngineEventType eventType = null;
        if (state == SuspensionState.ACTIVE) {
            eventType = FlowableEngineEventType.ENTITY_ACTIVATED;
        } else {
            eventType = FlowableEngineEventType.ENTITY_SUSPENDED;
        }
        Context.getCommandContext().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(eventType, entity));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:SuspensionState.java

示例14: setFormKey

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void setFormKey(String formKey) {
    this.formKey = formKey;

    CommandContext commandContext = Context.getCommandContext();
    if (commandContext != null) {
        commandContext
                .getHistoryManager()
                .recordTaskFormKeyChange(id, formKey);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:TaskEntity.java

示例15: execute

import org.activiti.engine.impl.context.Context; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) {

    CommandContext commandContext = Context.getCommandContext();

    List<SignalEventSubscriptionEntity> subscriptionEntities = null;
    if (processInstanceScope) {
        subscriptionEntities = commandContext
                .getEventSubscriptionEntityManager()
                .findSignalEventSubscriptionsByProcessInstanceAndEventName(execution.getProcessInstanceId(), signalDefinition.getEventName());
    } else {
        subscriptionEntities = commandContext
                .getEventSubscriptionEntityManager()
                .findSignalEventSubscriptionsByEventName(signalDefinition.getEventName(), execution.getTenantId());
    }

    for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) {
        ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(signalEventSubscriptionEntity.getProcessDefinitionId());
        if (Flowable5Util.isVersion5Tag(processDefinition.getEngineVersion())) {
            signalEventSubscriptionEntity.eventReceived(null, signalDefinition.isAsync());
            
        } else {
            org.flowable.engine.ProcessEngineConfiguration flowable6ProcessEngineConfiguration = commandContext.getProcessEngineConfiguration()
                    .getFlowable5CompatibilityHandler()
                    .getFlowable6ProcessEngineConfiguration();
            
            org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl flowable6ProcessEngineConfigurationImpl = (org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl) flowable6ProcessEngineConfiguration;
            EventSubscriptionEntityManager eventSubScriptionEntityManager = flowable6ProcessEngineConfigurationImpl.getEventSubscriptionEntityManager();
            EventSubscriptionEntity flowable6EventSubscription = eventSubScriptionEntityManager.findById(signalEventSubscriptionEntity.getId());
            eventSubScriptionEntityManager.eventReceived(flowable6EventSubscription, null, signalDefinition.isAsync());
        }
    }

    ActivityExecution activityExecution = (ActivityExecution) execution;
    if (activityExecution.getActivity() != null) { // don't continue if process has already finished
        leave(activityExecution);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:39,代码来源:IntermediateThrowSignalEventActivityBehavior.java


注:本文中的org.activiti.engine.impl.context.Context.getCommandContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。