use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity in project camunda-bpm-platform by camunda.
the class IncidentAuthorizationTest method clearDatabase.
protected void clearDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
if (historyLevel.equals(HistoryLevel.HISTORY_LEVEL_FULL)) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list();
for (HistoricIncident incident : incidents) {
commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident);
}
}
return null;
}
});
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method clearDatabase.
protected void clearDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list();
for (HistoricIncident incident : incidents) {
commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident);
}
return null;
}
});
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity in project camunda-bpm-platform by camunda.
the class HistoryCleanupAuthorizationTest method clearDatabase.
protected void clearDatabase() {
// reset configuration changes
String defaultStartTime = processEngineConfiguration.getHistoryCleanupBatchWindowStartTime();
String defaultEndTime = processEngineConfiguration.getHistoryCleanupBatchWindowEndTime();
int defaultBatchSize = processEngineConfiguration.getHistoryCleanupBatchSize();
processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(defaultStartTime);
processEngineConfiguration.setHistoryCleanupBatchWindowEndTime(defaultEndTime);
processEngineConfiguration.setHistoryCleanupBatchSize(defaultBatchSize);
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
List<Job> jobs = managementService.createJobQuery().list();
if (jobs.size() > 0) {
assertEquals(1, jobs.size());
String jobId = jobs.get(0).getId();
commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0));
commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId);
}
List<HistoricIncident> historicIncidents = historyService.createHistoricIncidentQuery().list();
for (HistoricIncident historicIncident : historicIncidents) {
commandContext.getDbEntityManager().delete((HistoricIncidentEntity) historicIncident);
}
commandContext.getMeterLogManager().deleteAll();
return null;
}
});
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
historyService.deleteHistoricProcessInstance(historicProcessInstance.getId());
}
List<HistoricDecisionInstance> historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
for (HistoricDecisionInstance historicDecisionInstance : historicDecisionInstances) {
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
}
List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery().list();
for (HistoricCaseInstance historicCaseInstance : historicCaseInstances) {
historyService.deleteHistoricCaseInstance(historicCaseInstance.getId());
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity 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;
}
});
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity in project camunda-bpm-platform by camunda.
the class HistoryCleanupBatchWindowTest method clearDatabase.
@After
public void clearDatabase() {
// reset configuration changes
processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(defaultStartTime);
processEngineConfiguration.setHistoryCleanupBatchWindowEndTime(defaultEndTime);
processEngineConfiguration.setHistoryCleanupBatchSize(defaultBatchSize);
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
List<Job> jobs = managementService.createJobQuery().list();
if (jobs.size() > 0) {
assertEquals(1, jobs.size());
String jobId = jobs.get(0).getId();
commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0));
commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId);
}
List<HistoricIncident> historicIncidents = historyService.createHistoricIncidentQuery().list();
for (HistoricIncident historicIncident : historicIncidents) {
commandContext.getDbEntityManager().delete((HistoricIncidentEntity) historicIncident);
}
commandContext.getMeterLogManager().deleteAll();
return null;
}
});
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
historyService.deleteHistoricProcessInstance(historicProcessInstance.getId());
}
List<HistoricDecisionInstance> historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
for (HistoricDecisionInstance historicDecisionInstance : historicDecisionInstances) {
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
}
List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery().list();
for (HistoricCaseInstance historicCaseInstance : historicCaseInstances) {
historyService.deleteHistoricCaseInstance(historicCaseInstance.getId());
}
clearMetrics();
}
Aggregations