use of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager in project camunda-bpm-platform by camunda.
the class HistoricDetailVariableInstanceUpdateEntity method delete.
@Override
public void delete() {
DbEntityManager dbEntityManger = Context.getCommandContext().getDbEntityManager();
dbEntityManger.delete(this);
byteArrayField.deleteByteArrayValue();
}
use of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager in project camunda-bpm-platform by camunda.
the class GetAttachmentContentCmd method execute.
public InputStream execute(CommandContext commandContext) {
DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
AttachmentEntity attachment = dbEntityManger.selectById(AttachmentEntity.class, attachmentId);
String contentId = attachment.getContentId();
if (contentId == null) {
return null;
}
ByteArrayEntity byteArray = dbEntityManger.selectById(ByteArrayEntity.class, contentId);
byte[] bytes = byteArray.getBytes();
return new ByteArrayInputStream(bytes);
}
use of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager in project camunda-bpm-platform by camunda.
the class DbHistoryEventHandler method insertOrUpdate.
/**
* general history event insert behavior
*/
protected void insertOrUpdate(HistoryEvent historyEvent) {
final DbEntityManager dbEntityManager = getDbEntityManager();
if (isInitialEvent(historyEvent)) {
dbEntityManager.insert(historyEvent);
} else {
if (dbEntityManager.getCachedEntity(historyEvent.getClass(), historyEvent.getId()) == null) {
if (historyEvent instanceof HistoricScopeInstanceEvent) {
// if this is a scope, get start time from existing event in DB
HistoricScopeInstanceEvent existingEvent = (HistoricScopeInstanceEvent) dbEntityManager.selectById(historyEvent.getClass(), historyEvent.getId());
if (existingEvent != null) {
HistoricScopeInstanceEvent historicScopeInstanceEvent = (HistoricScopeInstanceEvent) historyEvent;
historicScopeInstanceEvent.setStartTime(existingEvent.getStartTime());
}
}
if (historyEvent.getId() == null) {
// dbSqlSession.insert(historyEvent);
} else {
dbEntityManager.merge(historyEvent);
}
}
}
}
use of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager in project camunda-bpm-platform by camunda.
the class TaskEntity method update.
public void update() {
ensureTenantIdNotChanged();
registerCommandContextCloseListener();
CommandContext commandContext = Context.getCommandContext();
DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
dbEntityManger.merge(this);
}
use of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager in project camunda-bpm-platform by camunda.
the class AcquireJobCmdUnitTest method initCommand.
@Before
public void initCommand() {
JobExecutor jobExecutor = mock(JobExecutor.class);
when(jobExecutor.getMaxJobsPerAcquisition()).thenReturn(3);
when(jobExecutor.getLockOwner()).thenReturn("test");
when(jobExecutor.getLockTimeInMillis()).thenReturn(5 * 60 * 1000);
acquireJobsCmd = new AcquireJobsCmd(jobExecutor);
commandContext = mock(CommandContext.class);
DbEntityManager dbEntityManager = mock(DbEntityManager.class);
when(commandContext.getDbEntityManager()).thenReturn(dbEntityManager);
jobManager = mock(JobManager.class);
when(commandContext.getJobManager()).thenReturn(jobManager);
}
Aggregations