use of org.camunda.bpm.engine.impl.incident.IncidentContext in project camunda-bpm-platform by camunda.
the class ExternalTaskEntity method createIncidentContext.
protected IncidentContext createIncidentContext() {
IncidentContext context = new IncidentContext();
context.setProcessDefinitionId(processDefinitionId);
context.setExecutionId(executionId);
context.setActivityId(activityId);
context.setTenantId(tenantId);
context.setConfiguration(id);
return context;
}
use of org.camunda.bpm.engine.impl.incident.IncidentContext in project camunda-bpm-platform by camunda.
the class JobEntity method removeFailedJobIncident.
protected void removeFailedJobIncident(boolean incidentResolved) {
IncidentHandler handler = Context.getProcessEngineConfiguration().getIncidentHandler(Incident.FAILED_JOB_HANDLER_TYPE);
IncidentContext incidentContext = createIncidentContext();
if (incidentResolved) {
handler.resolveIncident(incidentContext);
} else {
handler.deleteIncident(incidentContext);
}
}
use of org.camunda.bpm.engine.impl.incident.IncidentContext in project camunda-bpm-platform by camunda.
the class JobEntity method createFailedJobIncident.
protected void createFailedJobIncident() {
final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (processEngineConfiguration.isCreateIncidentOnFailedJobEnabled()) {
String incidentHandlerType = Incident.FAILED_JOB_HANDLER_TYPE;
// make sure job has an ID set:
if (id == null) {
id = processEngineConfiguration.getIdGenerator().getNextId();
} else {
// check whether there exists already an incident
// for this job
List<Incident> failedJobIncidents = Context.getCommandContext().getIncidentManager().findIncidentByConfigurationAndIncidentType(id, incidentHandlerType);
if (!failedJobIncidents.isEmpty()) {
return;
}
}
IncidentContext incidentContext = createIncidentContext();
incidentContext.setActivityId(getActivityId());
processEngineConfiguration.getIncidentHandler(incidentHandlerType).handleIncident(incidentContext, exceptionMessage);
}
}
use of org.camunda.bpm.engine.impl.incident.IncidentContext in project camunda-bpm-platform by camunda.
the class JobEntity method createIncidentContext.
protected IncidentContext createIncidentContext() {
IncidentContext incidentContext = new IncidentContext();
incidentContext.setProcessDefinitionId(processDefinitionId);
incidentContext.setExecutionId(executionId);
incidentContext.setTenantId(tenantId);
incidentContext.setConfiguration(id);
incidentContext.setJobDefinitionId(jobDefinitionId);
return incidentContext;
}
use of org.camunda.bpm.engine.impl.incident.IncidentContext in project camunda-bpm-platform by camunda.
the class ExecutionCachedEntityStateTest method testProcessInstanceIncident.
@Deployment
public void testProcessInstanceIncident() {
runtimeService.startProcessInstanceByKey("testProcess");
ExecutionEntity processInstance = (ExecutionEntity) runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(0, processInstance.getCachedEntityStateRaw());
final ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().activityId("task").singleResult();
assertEquals(0, execution.getCachedEntityStateRaw());
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
IncidentContext incidentContext = new IncidentContext();
incidentContext.setExecutionId(execution.getId());
IncidentEntity.createAndInsertIncident("foo", incidentContext, null);
return null;
}
});
ExecutionEntity execution2 = (ExecutionEntity) runtimeService.createExecutionQuery().activityId("task").singleResult();
assertEquals(BitMaskUtil.getMaskForBit(ExecutionEntity.INCIDENT_STATE_BIT), execution2.getCachedEntityStateRaw());
}
Aggregations