use of org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity in project camunda-bpm-platform by camunda.
the class GetHistoricJobLogExceptionStacktraceCmd method execute.
public String execute(CommandContext commandContext) {
ensureNotNull("historicJobLogId", historicJobLogId);
HistoricJobLogEventEntity job = commandContext.getHistoricJobLogManager().findHistoricJobLogById(historicJobLogId);
ensureNotNull("No historic job log found with id " + historicJobLogId, "historicJobLog", job);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadHistoricJobLog(job);
}
return job.getExceptionStacktrace();
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity in project camunda-bpm-platform by camunda.
the class HistoryCleanupHistoricBatchTest method findExceptionByteArrayIds.
private List<String> findExceptionByteArrayIds() {
List<String> exceptionByteArrayIds = new ArrayList<String>();
List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery().list();
for (HistoricJobLog historicJobLog : historicJobLogs) {
HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity) historicJobLog;
if (historicJobLogEventEntity.getExceptionByteArrayId() != null) {
exceptionByteArrayIds.add(historicJobLogEventEntity.getExceptionByteArrayId());
}
}
return exceptionByteArrayIds;
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testDeleteByteArray.
public void testDeleteByteArray() {
final String processDefinitionId = "myProcessDefition";
processEngineConfiguration.getCommandExecutorTxRequiresNew().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
for (int i = 0; i < 1234; i++) {
HistoricJobLogEventEntity log = new HistoricJobLogEventEntity();
log.setJobId(String.valueOf(i));
log.setTimestamp(new Date());
log.setJobDefinitionType(MessageEntity.TYPE);
log.setProcessDefinitionId(processDefinitionId);
byte[] aByteValue = StringUtil.toByteArray("abc");
ByteArrayEntity byteArray = ExceptionUtil.createJobExceptionByteArray(aByteValue);
log.setExceptionByteArrayId(byteArray.getId());
commandContext.getHistoricJobLogManager().insert(log);
}
return null;
}
});
assertEquals(1234, historyService.createHistoricJobLogQuery().count());
processEngineConfiguration.getCommandExecutorTxRequiresNew().execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByProcessDefinitionId(processDefinitionId);
return null;
}
});
assertEquals(0, historyService.createHistoricJobLogQuery().count());
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createHistoricJobLogEvt.
protected HistoryEvent createHistoricJobLogEvt(Job job, HistoryEventType eventType) {
HistoricJobLogEventEntity event = newHistoricJobLogEntity(job);
initHistoricJobLogEvent(event, job, eventType);
return event;
}
use of org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createHistoricJobLogFailedEvt.
public HistoryEvent createHistoricJobLogFailedEvt(Job job, Throwable exception) {
HistoricJobLogEventEntity event = (HistoricJobLogEventEntity) createHistoricJobLogEvt(job, HistoryEventTypes.JOB_FAIL);
if (exception != null) {
// exception message
event.setJobExceptionMessage(exception.getMessage());
// stacktrace
String exceptionStacktrace = getExceptionStacktrace(exception);
byte[] exceptionBytes = toByteArray(exceptionStacktrace);
ByteArrayEntity byteArray = createJobExceptionByteArray(exceptionBytes);
event.setExceptionByteArrayId(byteArray.getId());
}
return event;
}
Aggregations