use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class ByteArrayField method setByteArrayValue.
public void setByteArrayValue(byte[] bytes) {
if (bytes != null) {
// thus we also need to check if the actual byte array entity still exists
if (this.byteArrayId != null && getByteArrayEntity() != null) {
byteArrayValue.setBytes(bytes);
} else {
deleteByteArrayValue();
byteArrayValue = new ByteArrayEntity(nameProvider.getName(), bytes);
Context.getCommandContext().getDbEntityManager().insert(byteArrayValue);
byteArrayId = byteArrayValue.getId();
}
} else {
deleteByteArrayValue();
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstancesJobHandler method execute.
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
commandContext.disableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
commandContext.getProcessEngineConfiguration().getHistoryService().deleteHistoricDecisionInstancesBulk(batchConfiguration.getIds());
} finally {
commandContext.enableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
commandContext.getByteArrayManager().delete(configurationEntity);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class SetJobRetriesJobHandler method execute.
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
SetRetriesBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
commandContext.disableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
commandContext.getProcessEngineConfiguration().getManagementService().setJobRetries(batchConfiguration.getIds(), batchConfiguration.getRetries());
} finally {
commandContext.enableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
commandContext.getByteArrayManager().delete(configurationEntity);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity in project camunda-bpm-platform by camunda.
the class ExceptionUtil method createExceptionByteArray.
/**
* create ByteArrayEntity with specified name and payload and make sure it's
* persisted
*
* used in Jobs and ExternalTasks
*
* @param name - type\source of the exception
* @param byteArray - payload of the exception
* @return persisted entity
*/
public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray) {
ByteArrayEntity result = null;
if (byteArray != null) {
result = new ByteArrayEntity(name, byteArray);
Context.getCommandContext().getDbEntityManager().insert(result);
}
return result;
}
Aggregations