Java Code Examples for org.flowable.common.engine.impl.interceptor.CommandContext#getAttribute()

The following examples show how to use org.flowable.common.engine.impl.interceptor.CommandContext#getAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandContextUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static void addInvolvedCaseInstanceId(CommandContext commandContext, String caseInstanceId) {
    if (caseInstanceId != null) {
        Set<String> involvedCaseInstanceIds = null;
        Object obj = commandContext.getAttribute(ATTRIBUTE_INVOLVED_CASE_INSTANCE_IDS);
        if (obj != null) {
            involvedCaseInstanceIds = (Set<String>) obj;
        } else {
            involvedCaseInstanceIds = new HashSet<>(1); // typically will be only 1 entry
            commandContext.addAttribute(ATTRIBUTE_INVOLVED_CASE_INSTANCE_IDS, involvedCaseInstanceIds);
        }
        involvedCaseInstanceIds.add(caseInstanceId);
    }
}
 
Example 2
Source File: CommandContextUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static Set<String> getInvolvedCaseInstanceIds(CommandContext commandContext) {
     Object obj = commandContext.getAttribute(ATTRIBUTE_INVOLVED_CASE_INSTANCE_IDS);
     if (obj != null) {
         return (Set<String>) obj;
     }
     return null;
}
 
Example 3
Source File: CommandContextUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static void addInvolvedExecution(CommandContext commandContext, ExecutionEntity executionEntity) {
    if (executionEntity.getId() != null) {
        Map<String, ExecutionEntity> involvedExecutions = null;
        Object obj = commandContext.getAttribute(ATTRIBUTE_INVOLVED_EXECUTIONS);
        if (obj != null) {
            involvedExecutions = (Map<String, ExecutionEntity>) obj;
        } else {
            involvedExecutions = new HashMap<>();
            commandContext.addAttribute(ATTRIBUTE_INVOLVED_EXECUTIONS, involvedExecutions);
        }
        involvedExecutions.put(executionEntity.getId(), executionEntity);
    }
}
 
Example 4
Source File: CommandContextUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static Map<String, ExecutionEntity> getInvolvedExecutions(CommandContext commandContext) {
    Object obj = commandContext.getAttribute(ATTRIBUTE_INVOLVED_EXECUTIONS);
    if (obj != null) {
        return (Map<String, ExecutionEntity>) obj;
    }
    return null;
}