/// <summary> /// customized insert behavior for HistoricVariableUpdateEventEntity </summary> protected internal virtual void insertHistoricVariableUpdateEntity(HistoricVariableUpdateEventEntity historyEvent) { DbEntityManager dbEntityManager = DbEntityManager; // insert update only if history level = FULL if (shouldWriteHistoricDetail(historyEvent)) { // insert byte array entity (if applicable) sbyte[] byteValue = historyEvent.ByteValue; if (byteValue != null) { ByteArrayEntity byteArrayEntity = new ByteArrayEntity(historyEvent.VariableName, byteValue, ResourceTypes.HISTORY); byteArrayEntity.RootProcessInstanceId = historyEvent.RootProcessInstanceId; byteArrayEntity.RemovalTime = historyEvent.RemovalTime; Context.CommandContext.ByteArrayManager.insertByteArray(byteArrayEntity); historyEvent.ByteArrayId = byteArrayEntity.Id; } dbEntityManager.insert(historyEvent); } // always insert/update HistoricProcessVariableInstance if (historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_CREATE)) { HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity(historyEvent); dbEntityManager.insert(persistentObject); } else if (historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_UPDATE) || historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_MIGRATE)) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager.selectById(typeof(HistoricVariableInstanceEntity), historyEvent.VariableInstanceId); if (historicVariableInstanceEntity != null) { historicVariableInstanceEntity.updateFromEvent(historyEvent); historicVariableInstanceEntity.State = org.camunda.bpm.engine.history.HistoricVariableInstance_Fields.STATE_CREATED; } else { // #CAM-1344 / #SUPPORT-688 // this is a FIX for process instances which were started in camunda fox 6.1 and migrated to camunda BPM 7.0. // in fox 6.1 the HistoricVariable instances were flushed to the DB when the process instance completed. // Since fox 6.2 we populate the HistoricVariable table as we go. HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity(historyEvent); dbEntityManager.insert(persistentObject); } } else if (historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_DELETE)) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager.selectById(typeof(HistoricVariableInstanceEntity), historyEvent.VariableInstanceId); if (historicVariableInstanceEntity != null) { historicVariableInstanceEntity.State = org.camunda.bpm.engine.history.HistoricVariableInstance_Fields.STATE_DELETED; } } }
public virtual HistoricProcessInstanceEventEntity findHistoricProcessInstanceEvent(string eventId) { if (HistoryEnabled) { return(DbEntityManager.selectById(typeof(HistoricProcessInstanceEventEntity), eventId)); } return(null); }
public virtual HistoricCaseInstanceEntity findHistoricCaseInstance(string caseInstanceId) { if (HistoryEnabled) { return(DbEntityManager.selectById(typeof(HistoricCaseInstanceEntity), caseInstanceId)); } return(null); }
public virtual Stream execute(CommandContext commandContext) { DbEntityManager dbEntityManger = commandContext.DbEntityManager; AttachmentEntity attachment = dbEntityManger.selectById(typeof(AttachmentEntity), attachmentId); string contentId = attachment.ContentId; if (string.ReferenceEquals(contentId, null)) { return(null); } ByteArrayEntity byteArray = dbEntityManger.selectById(typeof(ByteArrayEntity), contentId); sbyte[] bytes = byteArray.Bytes; return(new MemoryStream(bytes)); }
public object execute(CommandContext commandContext) { DbEntityManager dbEntityManager = commandContext.DbEntityManager; PropertyEntity historyLevelProperty = dbEntityManager.selectById(typeof(PropertyEntity), "historyLevel"); if (historyLevelProperty != null) { dbEntityManager.delete(historyLevelProperty); } return(null); }
public object execute(CommandContext commandContext) { DbEntityManager dbEntityManager = commandContext.DbEntityManager; PropertyEntity historyLevelProperty = dbEntityManager.selectById(typeof(PropertyEntity), "historyLevel"); if (historyLevelProperty != null) { if (processEngineConfiguration.HistoryLevel.Id != new int?(historyLevelProperty.Value)) { historyLevelProperty.Value = Convert.ToString(processEngineConfiguration.HistoryLevel.Id); dbEntityManager.merge(historyLevelProperty); } } else { HistoryLevelSetupCommand.dbCreateHistoryLevel(commandContext); } return(null); }
public override Void execute(CommandContext commandContext) { DbEntityManagerFactory dbEntityManagerFactory = new DbEntityManagerFactory(Context.ProcessEngineConfiguration.IdGenerator); DbEntityManager entityManager = dbEntityManagerFactory.openSession(); JobEntity job = entityManager.selectById(typeof(JobEntity), JOB_ENTITY_ID); job.LockOwner = lockOwner; entityManager.forceUpdate(job); monitor.sync(); // flush the changed entity and create a lock for the table entityManager.flush(); monitor.sync(); // commit transaction and remove the lock commandContext.TransactionContext.commit(); return(null); }
public virtual ProcessDefinitionEntity findLatestProcessDefinitionById(string processDefinitionId) { return(DbEntityManager.selectById(typeof(ProcessDefinitionEntity), processDefinitionId)); }
public virtual DecisionRequirementsDefinitionEntity findLatestDefinitionById(string id) { return(DbEntityManager.selectById(typeof(DecisionRequirementsDefinitionEntity), id)); }
protected internal virtual FilterEntity findFilterByIdInternal(string filterId) { return(DbEntityManager.selectById(typeof(FilterEntity), filterId)); }
/// <summary> /// general history event insert behavior </summary> protected internal virtual void insertOrUpdate(HistoryEvent historyEvent) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager dbEntityManager = getDbEntityManager(); DbEntityManager dbEntityManager = DbEntityManager; if (isInitialEvent(historyEvent)) { dbEntityManager.insert(historyEvent); } else { if (dbEntityManager.getCachedEntity(historyEvent.GetType(), historyEvent.Id) == null) { if (historyEvent is HistoricScopeInstanceEvent) { // if this is a scope, get start time from existing event in DB HistoricScopeInstanceEvent existingEvent = (HistoricScopeInstanceEvent)dbEntityManager.selectById(historyEvent.GetType(), historyEvent.Id); if (existingEvent != null) { HistoricScopeInstanceEvent historicScopeInstanceEvent = (HistoricScopeInstanceEvent)historyEvent; historicScopeInstanceEvent.StartTime = existingEvent.StartTime; } } if (string.ReferenceEquals(historyEvent.Id, null)) { // dbSqlSession.insert(historyEvent); } else { dbEntityManager.merge(historyEvent); } } } }
// users ///////////////////////////////////////// public virtual UserEntity findUserById(string userId) { checkAuthorization(Permissions.READ, Resources.USER, userId); return(DbEntityManager.selectById(typeof(UserEntity), userId)); }
public virtual PropertyEntity findPropertyById(string propertyId) { return(DbEntityManager.selectById(typeof(PropertyEntity), propertyId)); }
public virtual HistoricBatchEntity findHistoricBatchById(string batchId) { return(DbEntityManager.selectById(typeof(HistoricBatchEntity), batchId)); }
public virtual CaseExecutionEntity findCaseExecutionById(string caseExecutionId) { return(DbEntityManager.selectById(typeof(CaseExecutionEntity), caseExecutionId)); }
public virtual JobDefinitionEntity findById(string jobDefinitionId) { return DbEntityManager.selectById(typeof(JobDefinitionEntity), jobDefinitionId); }
public virtual ExecutionEntity findExecutionById(string executionId) { return(DbEntityManager.selectById(typeof(ExecutionEntity), executionId)); }
// groups ////////////////////////////////////////// public virtual GroupEntity findGroupById(string groupId) { checkAuthorization(Permissions.READ, Resources.GROUP, groupId); return(DbEntityManager.selectById(typeof(GroupEntity), groupId)); }
//tenants ////////////////////////////////////////// public virtual TenantEntity findTenantById(string tenantId) { checkAuthorization(Permissions.READ, Resources.TENANT, tenantId); return(DbEntityManager.selectById(typeof(TenantEntity), tenantId)); }
public virtual ExternalTaskEntity findExternalTaskById(string id) { return(DbEntityManager.selectById(typeof(ExternalTaskEntity), id)); }
public virtual DeploymentEntity findDeploymentById(string deploymentId) { return(DbEntityManager.selectById(typeof(DeploymentEntity), deploymentId)); }
public virtual Incident findIncidentById(string id) { return((Incident)DbEntityManager.selectById(typeof(IncidentEntity), id)); }
public virtual TaskEntity findTaskById(string id) { ensureNotNull("Invalid task id", "id", id); return(DbEntityManager.selectById(typeof(TaskEntity), id)); }
public virtual BatchEntity findBatchById(string id) { return(DbEntityManager.selectById(typeof(BatchEntity), id)); }
public virtual DecisionDefinitionEntity findDecisionDefinitionById(string decisionDefinitionId) { return(DbEntityManager.selectById(typeof(DecisionDefinitionEntity), decisionDefinitionId)); }
public virtual UserOperationLogEntry findOperationLogById(string entryId) { return(DbEntityManager.selectById(typeof(UserOperationLogEntryEventEntity), entryId)); }