Search in sources :

Example 1 with IncidentState

use of org.camunda.bpm.engine.history.IncidentState in project camunda-bpm-platform by camunda.

the class DefaultHistoryEventProducer method initHistoricIncidentEvent.

protected void initHistoricIncidentEvent(HistoricIncidentEventEntity evt, Incident incident, HistoryEventType eventType) {
    // init properties
    evt.setId(incident.getId());
    evt.setProcessDefinitionId(incident.getProcessDefinitionId());
    evt.setProcessInstanceId(incident.getProcessInstanceId());
    evt.setExecutionId(incident.getExecutionId());
    evt.setCreateTime(incident.getIncidentTimestamp());
    evt.setIncidentType(incident.getIncidentType());
    evt.setActivityId(incident.getActivityId());
    evt.setCauseIncidentId(incident.getCauseIncidentId());
    evt.setRootCauseIncidentId(incident.getRootCauseIncidentId());
    evt.setConfiguration(incident.getConfiguration());
    evt.setIncidentMessage(incident.getIncidentMessage());
    evt.setTenantId(incident.getTenantId());
    evt.setJobDefinitionId(incident.getJobDefinitionId());
    IncidentEntity incidentEntity = (IncidentEntity) incident;
    ProcessDefinitionEntity definition = incidentEntity.getProcessDefinition();
    if (definition != null) {
        evt.setProcessDefinitionKey(definition.getKey());
    }
    // init event type
    evt.setEventType(eventType.getEventName());
    // init state
    IncidentState incidentState = IncidentState.DEFAULT;
    if (HistoryEventTypes.INCIDENT_DELETE.equals(eventType)) {
        incidentState = IncidentState.DELETED;
    } else if (HistoryEventTypes.INCIDENT_RESOLVE.equals(eventType)) {
        incidentState = IncidentState.RESOLVED;
    }
    evt.setIncidentState(incidentState.getStateCode());
}
Also used : IncidentState(org.camunda.bpm.engine.history.IncidentState) IncidentEntity(org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Aggregations

IncidentState (org.camunda.bpm.engine.history.IncidentState)1 IncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1