Search in sources :

Example 1 with HistoryEventType

use of org.camunda.bpm.engine.impl.history.event.HistoryEventType in project camunda-bpm-platform by camunda.

the class IncidentEntity method remove.

protected void remove(boolean resolved) {
    ExecutionEntity execution = getExecution();
    if (execution != null) {
        // Extract possible super execution of the assigned execution
        ExecutionEntity superExecution = null;
        if (execution.getId().equals(execution.getProcessInstanceId())) {
            superExecution = execution.getSuperExecution();
        } else {
            superExecution = execution.getProcessInstance().getSuperExecution();
        }
        if (superExecution != null) {
            // get the incident, where this incident is the cause
            IncidentEntity parentIncident = superExecution.getIncidentByCauseIncidentId(getId());
            if (parentIncident != null) {
                // remove the incident
                parentIncident.remove(resolved);
            }
        }
        // remove link to execution
        execution.removeIncident(this);
    }
    // always delete the incident
    Context.getCommandContext().getDbEntityManager().delete(this);
    // update historic incident
    HistoryEventType eventType = resolved ? HistoryEventTypes.INCIDENT_RESOLVE : HistoryEventTypes.INCIDENT_DELETE;
    fireHistoricIncidentEvent(eventType);
}
Also used : HistoryEventType(org.camunda.bpm.engine.impl.history.event.HistoryEventType)

Example 2 with HistoryEventType

use of org.camunda.bpm.engine.impl.history.event.HistoryEventType in project camunda-bpm-platform by camunda.

the class DetermineHistoryLevelCmdTest method failWhenExistingHistoryLevelIsNotRegistered.

@Test
public void failWhenExistingHistoryLevelIsNotRegistered() {
    // init the db with custom level
    HistoryLevel customLevel = new HistoryLevel() {

        @Override
        public int getId() {
            return 99;
        }

        @Override
        public String getName() {
            return "custom";
        }

        @Override
        public boolean isHistoryEventProduced(HistoryEventType eventType, Object entity) {
            return false;
        }
    };
    ProcessEngineConfigurationImpl config = config("true", "custom");
    config.setCustomHistoryLevels(Arrays.asList(customLevel));
    processEngineImpl = (ProcessEngineImpl) config.buildProcessEngine();
    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("The configured history level with id='99' is not registered in this config.");
    config.getCommandExecutorSchemaOperations().execute(new DetermineHistoryLevelCmd(Collections.<HistoryLevel>emptyList()));
}
Also used : DetermineHistoryLevelCmd(org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventType(org.camunda.bpm.engine.impl.history.event.HistoryEventType) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Aggregations

HistoryEventType (org.camunda.bpm.engine.impl.history.event.HistoryEventType)2 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DetermineHistoryLevelCmd (org.camunda.bpm.engine.impl.cmd.DetermineHistoryLevelCmd)1 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)1 Test (org.junit.Test)1