use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class GetUserPictureCmd method execute.
public Picture execute(CommandContext commandContext) {
ensureNotNull("userId", userId);
IdentityInfoEntity pictureInfo = commandContext.getIdentityInfoManager().findUserInfoByUserIdAndKey(userId, "picture");
if (pictureInfo != null) {
String pictureByteArrayId = pictureInfo.getValue();
if (pictureByteArrayId != null) {
ByteArrayEntity byteArray = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, pictureByteArrayId);
return new Picture(byteArray.getBytes(), byteArray.getName());
}
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity 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;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogEntity method setErrorDetails.
public void setErrorDetails(String exception) {
EnsureUtil.ensureNotNull("exception", exception);
byte[] exceptionBytes = toByteArray(exception);
ByteArrayEntity byteArray = createExceptionByteArray(EXCEPTION_NAME, exceptionBytes);
errorDetailsByteArrayId = byteArray.getId();
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class MigrationBatchJobHandler method execute.
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
MigrationBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
MigrationPlanExecutionBuilder executionBuilder = commandContext.getProcessEngineConfiguration().getRuntimeService().newMigration(batchConfiguration.getMigrationPlan()).processInstanceIds(batchConfiguration.getIds());
if (batchConfiguration.isSkipCustomListeners()) {
executionBuilder.skipCustomListeners();
}
if (batchConfiguration.isSkipIoMappings()) {
executionBuilder.skipIoMappings();
}
// uses internal API in order to skip writing user operation log (CommandContext#disableUserOperationLog
// is not sufficient with legacy engine config setting "restrictUserOperationLogToAuthenticatedUsers" = false)
((MigrationPlanExecutionBuilderImpl) executionBuilder).execute(false);
commandContext.getByteArrayManager().delete(configurationEntity);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class BatchMigrationTest method testDeleteBatchJobManually.
@Test
public void testDeleteBatchJobManually() {
// given
Batch batch = helper.createMigrationBatchWithSize(1);
helper.executeSeedJob(batch);
JobEntity migrationJob = (JobEntity) helper.getExecutionJobs(batch).get(0);
String byteArrayId = migrationJob.getJobHandlerConfigurationRaw();
ByteArrayEntity byteArrayEntity = engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(new GetByteArrayCommand(byteArrayId));
assertNotNull(byteArrayEntity);
// when
managementService.deleteJob(migrationJob.getId());
// then
byteArrayEntity = engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(new GetByteArrayCommand(byteArrayId));
assertNull(byteArrayEntity);
}
Aggregations