camunda/camunda-bpm-platform — pull request #115 by falko (2014-10-20 17:57:37+00:00)
Title: feat(FailedJobIncidentHandler): make incident available to sub-classes

An incident can only be uniquely identified through its id. However, sub-classes of the FailedJobIncidentHandler like [UserTaskFailedJobIncidentHandler](https://github.com/camunda/camunda-consulting/blob/master/snippets/incidents-as-tasks/src/main/java/org/example/incidents_as_tasks/UserTaskFailedJobIncidentHandler.java) don't have access to the created incident and can therefore not reference or work with it. With this change code could look like this:

```java
public class UserTaskFailedJobIncidentHandler extends FailedJobIncidentHandler
implements IncidentHandler {

@Override
public void handleIncident(String processDefinitionId, String activityId,
String executionId, String jobId, String message) {
Incident incident = createIncident(processDefinitionId, activityId, executionId, jobId,
message);
TaskServiceImpl taskServiceImpl = getTaskService();
Task task = taskServiceImpl.newTask();
task.setName("Handle Incident");
task.setAssignee("demo");
taskServiceImpl.saveTask(task);
taskServiceImpl.setVariable(task.getId(), "incidentId", incident.getId());
}
```