本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity类的典型用法代码示例。如果您正苦于以下问题:Java SignalEventSubscriptionEntity类的具体用法?Java SignalEventSubscriptionEntity怎么用?Java SignalEventSubscriptionEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SignalEventSubscriptionEntity类属于org.activiti.engine.impl.persistence.entity包,在下文中一共展示了SignalEventSubscriptionEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testActivitySignalBoundaryEventsOnSubProcess
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
@Deployment
public void testActivitySignalBoundaryEventsOnSubProcess() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalOnSubProcess");
assertNotNull(processInstance);
Execution executionWithSignal = runtimeService.createExecutionQuery().activityId("userTaskInsideProcess").singleResult();
assertNotNull(executionWithSignal);
runtimeService.signalEventReceived("signalName");
assertEquals(1, listener.getEventsReceived().size());
// Next, an signal-event is expected, as a result of the message
assertTrue(listener.getEventsReceived().get(0) instanceof FlowableActivityCancelledEvent);
FlowableActivityCancelledEvent signalEvent = (FlowableActivityCancelledEvent) listener.getEventsReceived().get(0);
assertEquals(FlowableEngineEventType.ACTIVITY_CANCELLED, signalEvent.getType());
assertEquals("userTaskInsideProcess", signalEvent.getActivityId());
assertEquals(executionWithSignal.getId(), signalEvent.getExecutionId());
assertEquals(executionWithSignal.getProcessInstanceId(), signalEvent.getProcessInstanceId());
assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
assertNotNull(signalEvent.getCause());
assertTrue(signalEvent.getCause() instanceof SignalEventSubscriptionEntity);
SignalEventSubscriptionEntity cause = (SignalEventSubscriptionEntity) signalEvent.getCause();
assertEquals("signalName", cause.getEventName());
}
示例2: testActivitySignalBoundaryEventsOnUserTask
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
@Deployment
public void testActivitySignalBoundaryEventsOnUserTask() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalOnUserTask");
assertNotNull(processInstance);
Execution executionWithSignal = runtimeService.createExecutionQuery().activityId("userTask").singleResult();
assertNotNull(executionWithSignal);
runtimeService.signalEventReceived("signalName");
assertEquals(1, listener.getEventsReceived().size());
// Next, an signal-event is expected, as a result of the message
assertTrue(listener.getEventsReceived().get(0) instanceof FlowableActivityCancelledEvent);
FlowableActivityCancelledEvent signalEvent = (FlowableActivityCancelledEvent) listener.getEventsReceived().get(0);
assertEquals(FlowableEngineEventType.ACTIVITY_CANCELLED, signalEvent.getType());
assertEquals("userTask", signalEvent.getActivityId());
assertEquals(executionWithSignal.getId(), signalEvent.getExecutionId());
assertEquals(executionWithSignal.getProcessInstanceId(), signalEvent.getProcessInstanceId());
assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
assertNotNull(signalEvent.getCause());
assertTrue(signalEvent.getCause() instanceof SignalEventSubscriptionEntity);
SignalEventSubscriptionEntity cause = (SignalEventSubscriptionEntity) signalEvent.getCause();
assertEquals("signalName", cause.getEventName());
}
示例3: addSignalEventSubscriptions
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void addSignalEventSubscriptions(ProcessDefinitionEntity processDefinition) {
List<EventSubscriptionDeclaration> eventDefinitions = (List<EventSubscriptionDeclaration>) processDefinition.getProperty(BpmnParse.PROPERTYNAME_EVENT_SUBSCRIPTION_DECLARATION);
if (eventDefinitions != null) {
for (EventSubscriptionDeclaration eventDefinition : eventDefinitions) {
if (eventDefinition.getEventType().equals("signal") && eventDefinition.isStartEvent()) {
SignalEventSubscriptionEntity subscriptionEntity = new SignalEventSubscriptionEntity();
subscriptionEntity.setEventName(eventDefinition.getEventName());
subscriptionEntity.setActivityId(eventDefinition.getActivityId());
subscriptionEntity.setProcessDefinitionId(processDefinition.getId());
if (processDefinition.getTenantId() != null) {
subscriptionEntity.setTenantId(processDefinition.getTenantId());
}
subscriptionEntity.insert();
}
}
}
}
示例4: execute
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
List<SignalEventSubscriptionEntity> signalEvents = null;
if(executionId == null) {
signalEvents = commandContext.getEventSubscriptionManager()
.findSignalEventSubscriptionsByEventName(eventName);
} else {
signalEvents = commandContext.getEventSubscriptionManager()
.findSignalEventSubscriptionsByNameAndExecution(eventName, executionId);
if(signalEvents.isEmpty()) {
throw new ActivitiException("Execution '"+executionId+"' has not subscribed to a signal event with name '"+eventName+"'.");
}
}
HashMap<String, Object> payload = null;
if(variables != null) {
payload = new HashMap<String, Object>(variables);
}
for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : signalEvents) {
signalEventSubscriptionEntity.eventReceived(payload, false);
}
return null;
}
示例5: execute
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
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());
}
for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) {
signalEventSubscriptionEntity.eventReceived(null, signalDefinition.isAsync());
}
leave(execution);
}
示例6: testQueryByEventType
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByEventType() {
CommandExecutor commandExecutor = (CommandExecutor) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawCommandExecutor();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.eventType("signal")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}
示例7: testQueryByActivityId
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByActivityId() {
CommandExecutor commandExecutor = (CommandExecutor) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawCommandExecutor();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.setActivityId("someActivity");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.setActivityId("someActivity");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.setActivityId("someOtherActivity");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.activityId("someOtherActivity")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.activityId("someActivity")
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}
示例8: execute
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
@Override
public Void execute(CommandContext commandContext) {
List<SignalEventSubscriptionEntity> signalEvents = null;
if (executionId == null) {
signalEvents = commandContext.getEventSubscriptionEntityManager().findSignalEventSubscriptionsByEventName(eventName, tenantId);
} else {
ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(executionId);
if (execution == null) {
throw new ActivitiObjectNotFoundException("Cannot find execution with id '" + executionId + "'", Execution.class);
}
if (execution.isSuspended()) {
throw new ActivitiException("Cannot throw signal event '" + eventName
+ "' because execution '" + executionId + "' is suspended");
}
signalEvents = commandContext.getEventSubscriptionEntityManager().findSignalEventSubscriptionsByNameAndExecution(eventName, executionId);
if (signalEvents.isEmpty()) {
throw new ActivitiException("Execution '" + executionId + "' has not subscribed to a signal event with name '" + eventName + "'.");
}
}
for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : signalEvents) {
// We only throw the event to globally scoped signals.
// Process instance scoped signals must be thrown within the process itself
if (signalEventSubscriptionEntity.isGlobalScoped()) {
signalEventSubscriptionEntity.eventReceived(payload, async);
}
}
return null;
}
示例9: onEvent
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的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);
}
}
}
示例10: execute
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的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);
}
}
示例11: execute
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
CommandContext commandContext = Context.getCommandContext();
List<SignalEventSubscriptionEntity> findSignalEventSubscriptionsByEventName = commandContext
.getEventSubscriptionManager()
.findSignalEventSubscriptionsByEventName(signalDefinition.getSignalName());
for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : findSignalEventSubscriptionsByEventName) {
signalEventSubscriptionEntity.eventReceived(null, signalDefinition.isAsync());
}
leave(execution);
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:15,代码来源:IntermediateThrowSignalEventActivityBehavior.java
示例12: testQueryByEventType
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByEventType() {
processEngineConfiguration.getCommandExecutorTxRequired()
.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.eventType("signal")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}
示例13: testQueryByActivityId
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByActivityId() {
processEngineConfiguration.getCommandExecutorTxRequired()
.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.setActivityId("someActivity");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.setActivityId("someActivity");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.setActivityId("someOtherActivity");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.activityId("someOtherActivity")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.activityId("someActivity")
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}
示例14: testQueryByEventType
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByEventType() {
processEngineConfiguration.getCommandExecutor()
.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.eventType("signal")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}
示例15: testQueryByActivityId
import org.activiti.engine.impl.persistence.entity.SignalEventSubscriptionEntity; //导入依赖的package包/类
public void testQueryByActivityId() {
processEngineConfiguration.getCommandExecutor()
.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
MessageEventSubscriptionEntity messageEventSubscriptionEntity1 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity1.setEventName("messageName");
messageEventSubscriptionEntity1.setActivityId("someActivity");
messageEventSubscriptionEntity1.insert();
MessageEventSubscriptionEntity messageEventSubscriptionEntity2 = new MessageEventSubscriptionEntity();
messageEventSubscriptionEntity2.setEventName("messageName");
messageEventSubscriptionEntity2.setActivityId("someActivity");
messageEventSubscriptionEntity2.insert();
SignalEventSubscriptionEntity signalEventSubscriptionEntity3 = new SignalEventSubscriptionEntity();
signalEventSubscriptionEntity3.setEventName("messageName2");
signalEventSubscriptionEntity3.setActivityId("someOtherActivity");
signalEventSubscriptionEntity3.insert();
return null;
}
});
List<EventSubscriptionEntity> list = newEventSubscriptionQuery()
.activityId("someOtherActivity")
.list();
assertEquals(1, list.size());
list = newEventSubscriptionQuery()
.activityId("someActivity")
.eventType("message")
.list();
assertEquals(2, list.size());
cleanDb();
}