Search in sources :

Example 1 with HistoricIncidentManager

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager in project camunda-bpm-platform by camunda.

the class HistoricBatchEntity method delete.

public void delete() {
    HistoricIncidentManager historicIncidentManager = Context.getCommandContext().getHistoricIncidentManager();
    historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId);
    historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId);
    historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId);
    HistoricJobLogManager historicJobLogManager = Context.getCommandContext().getHistoricJobLogManager();
    historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId);
    historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId);
    historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId);
    Context.getCommandContext().getHistoricBatchManager().delete(this);
}
Also used : HistoricJobLogManager(org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogManager) HistoricIncidentManager(org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager)

Example 2 with HistoricIncidentManager

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager in project camunda-bpm-platform by camunda.

the class ManagementServiceTest method deleteJobAndIncidents.

protected void deleteJobAndIncidents(final Job job) {
    final List<HistoricIncident> incidents = historyService.createHistoricIncidentQuery().incidentType(Incident.FAILED_JOB_HANDLER_TYPE).list();
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
    commandExecutor.execute(new Command<Void>() {

        @Override
        public Void execute(CommandContext commandContext) {
            ((JobEntity) job).delete();
            HistoricIncidentManager historicIncidentManager = commandContext.getHistoricIncidentManager();
            for (HistoricIncident incident : incidents) {
                HistoricIncidentEntity incidentEntity = (HistoricIncidentEntity) incident;
                historicIncidentManager.delete(incidentEntity);
            }
            commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(job.getId());
            return null;
        }
    });
}
Also used : HistoricIncident(org.camunda.bpm.engine.history.HistoricIncident) HistoricIncidentEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) HistoricIncidentManager(org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager) CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor)

Example 3 with HistoricIncidentManager

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager in project camunda-bpm-platform by camunda.

the class BatchEntity method delete.

public void delete(boolean cascadeToHistory) {
    CommandContext commandContext = Context.getCommandContext();
    deleteSeedJob();
    deleteMonitorJob();
    getBatchJobHandler().deleteJobs(this);
    JobDefinitionManager jobDefinitionManager = commandContext.getJobDefinitionManager();
    jobDefinitionManager.delete(getSeedJobDefinition());
    jobDefinitionManager.delete(getMonitorJobDefinition());
    jobDefinitionManager.delete(getBatchJobDefinition());
    commandContext.getBatchManager().delete(this);
    configuration.deleteByteArrayValue();
    fireHistoricEndEvent();
    if (cascadeToHistory) {
        HistoricIncidentManager historicIncidentManager = commandContext.getHistoricIncidentManager();
        historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId);
        historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId);
        historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId);
        HistoricJobLogManager historicJobLogManager = commandContext.getHistoricJobLogManager();
        historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId);
        historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId);
        historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId);
        commandContext.getHistoricBatchManager().deleteHistoricBatchById(id);
    }
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) JobDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionManager) HistoricJobLogManager(org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogManager) HistoricIncidentManager(org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager)

Aggregations

HistoricIncidentManager (org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager)3 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)2 HistoricJobLogManager (org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogManager)2 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)1 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)1 HistoricIncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity)1 JobDefinitionManager (org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionManager)1