Java Code Examples for org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity#getExecutionId()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity#getExecutionId() .
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: EventSubscriptionsByExecutionAndTypeMatcher.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public boolean isRetained(EventSubscriptionEntity eventSubscriptionEntity, Object parameter) { Map<String, String> params = (Map<String, String>) parameter; String type = params.get("eventType"); String executionId = params.get("executionId"); return eventSubscriptionEntity.getEventType() != null && eventSubscriptionEntity.getEventType().equals(type) && eventSubscriptionEntity.getExecutionId() != null && eventSubscriptionEntity.getExecutionId().equals(executionId); }
Example 2
Source File: SignalEventSubscriptionByNameAndExecutionMatcher.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public boolean isRetained(EventSubscriptionEntity eventSubscriptionEntity, Object parameter) { Map<String, String> params = (Map<String, String>) parameter; String executionId = params.get("executionId"); String name = params.get("eventName"); return eventSubscriptionEntity.getEventType() != null && eventSubscriptionEntity.getEventType().equals(SignalEventSubscriptionEntity.EVENT_TYPE) && eventSubscriptionEntity.getExecutionId() != null && eventSubscriptionEntity.getExecutionId().equals(executionId) && eventSubscriptionEntity.getEventName() != null && eventSubscriptionEntity.getEventName().equals(name); }
Example 3
Source File: SignalEventSubscriptionByEventNameMatcher.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public boolean isRetained(EventSubscriptionEntity eventSubscriptionEntity, Object parameter) { Map<String, String> params = (Map<String, String>) parameter; String eventName = params.get("eventName"); String tenantId = params.get("tenantId"); return eventSubscriptionEntity.getEventType() != null && eventSubscriptionEntity.getEventType().equals(SignalEventSubscriptionEntity.EVENT_TYPE) && eventSubscriptionEntity.getEventName() != null && eventSubscriptionEntity.getEventName().equals(eventName) && (eventSubscriptionEntity.getExecutionId() == null || (eventSubscriptionEntity.getExecutionId() != null && eventSubscriptionEntity.getExecution() != null && eventSubscriptionEntity.getExecution().getSuspensionState() == SuspensionState.ACTIVE.getStateCode()) ) && ( (params.containsKey("tenantId") && tenantId.equals(eventSubscriptionEntity.getTenantId())) || (!params.containsKey("tenantId") && StringUtils.isEmpty(eventSubscriptionEntity.getTenantId())) ); }
Example 4
Source File: SignalEventHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) { if (eventSubscription.getExecutionId() != null) { super.handleEvent(eventSubscription, payload, commandContext); } else if (eventSubscription.getProcessDefinitionId() != null) { // Find initial flow element matching the signal start event String processDefinitionId = eventSubscription.getProcessDefinitionId(); ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class); } if (processDefinition.isSuspended()) { throw new ActivitiException("Could not handle signal: process definition with id: " + processDefinitionId + " is suspended"); } org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(processDefinitionId); FlowElement flowElement = process.getFlowElement(eventSubscription.getActivityId(), true); if (flowElement == null) { throw new ActivitiException("Could not find matching FlowElement for activityId " + eventSubscription.getActivityId()); } // Start process instance via that flow element Map<String, Object> variables = null; if (payload instanceof Map) { variables = (Map<String, Object>) payload; } ProcessInstanceHelper processInstanceHelper = commandContext.getProcessEngineConfiguration().getProcessInstanceHelper(); processInstanceHelper.createAndStartProcessInstanceWithInitialFlowElement(processDefinition, null, null, flowElement, process, variables, null, true); } else { throw new ActivitiException("Invalid signal handling: no execution nor process definition set"); } }
Example 5
Source File: SignalEventHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) { if (eventSubscription.getExecutionId() != null) { super.handleEvent(eventSubscription, payload, commandContext); } else if (eventSubscription.getProcessDefinitionId() != null) { // Start event String processDefinitionId = eventSubscription.getProcessDefinitionId(); DeploymentManager deploymentCache = Context .getProcessEngineConfiguration() .getDeploymentManager(); ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class); } ActivityImpl startActivity = processDefinition.findActivity(eventSubscription.getActivityId()); if (startActivity == null) { throw new ActivitiException("Could no handle signal: no start activity found with id " + eventSubscription.getActivityId()); } ExecutionEntity processInstance = processDefinition.createProcessInstance(null, startActivity); if (processInstance == null) { throw new ActivitiException("Could not handle signal: no process instance started"); } if (payload != null) { if (payload instanceof Map) { Map<String, Object> variables = (Map<String, Object>) payload; processInstance.setVariables(variables); } } processInstance.start(); } else { throw new ActivitiException("Invalid signal handling: no execution nor process definition set"); } }
Example 6
Source File: EventSubscriptionsByExecutionIdMatcher.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public boolean isRetained(EventSubscriptionEntity eventSubscriptionEntity, Object parameter) { return eventSubscriptionEntity.getExecutionId() != null && eventSubscriptionEntity.getExecutionId().equals((String) parameter); }