public virtual IdentityOperationResult saveUser(User user) { UserEntity userEntity = (UserEntity)user; // encrypt password userEntity.encryptPassword(); string operation = null; if (userEntity.Revision == 0) { operation = IdentityOperationResult.OPERATION_CREATE; checkAuthorization(Permissions.CREATE, Resources.USER, null); DbEntityManager.insert(userEntity); createDefaultAuthorizations(userEntity); } else { operation = IdentityOperationResult.OPERATION_UPDATE; checkAuthorization(Permissions.UPDATE, Resources.USER, user.Id); DbEntityManager.merge(userEntity); } return(new IdentityOperationResult(userEntity, operation)); }
/// <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); } } } }
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 virtual IdentityOperationResult saveTenant(Tenant tenant) { TenantEntity tenantEntity = (TenantEntity)tenant; string operation = null; if (tenantEntity.Revision == 0) { operation = IdentityOperationResult.OPERATION_CREATE; checkAuthorization(Permissions.CREATE, Resources.TENANT, null); DbEntityManager.insert(tenantEntity); createDefaultAuthorizations(tenant); } else { operation = IdentityOperationResult.OPERATION_UPDATE; checkAuthorization(Permissions.UPDATE, Resources.TENANT, tenant.Id); DbEntityManager.merge(tenantEntity); } return(new IdentityOperationResult(tenantEntity, operation)); }
public virtual IdentityOperationResult saveGroup(Group group) { GroupEntity groupEntity = (GroupEntity)group; string operation = null; if (groupEntity.Revision == 0) { operation = IdentityOperationResult.OPERATION_CREATE; checkAuthorization(Permissions.CREATE, Resources.GROUP, null); DbEntityManager.insert(groupEntity); createDefaultAuthorizations(group); } else { operation = IdentityOperationResult.OPERATION_UPDATE; checkAuthorization(Permissions.UPDATE, Resources.GROUP, group.Id); DbEntityManager.merge(groupEntity); } return(new IdentityOperationResult(groupEntity, operation)); }
public virtual Filter insertOrUpdateFilter(Filter filter) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.camunda.bpm.engine.impl.AbstractQuery<?, ?> query = filter.getQuery(); AbstractQuery <object, ?> query = filter.Query; query.validate(StoredQueryValidator.get()); if (string.ReferenceEquals(filter.Id, null)) { checkAuthorization(CREATE, FILTER, ANY); DbEntityManager.insert((FilterEntity)filter); createDefaultAuthorizations(filter); } else { checkAuthorization(UPDATE, FILTER, filter.Id); DbEntityManager.merge((FilterEntity)filter); } return(filter); }
public virtual void updateJob(JobEntity job) { DbEntityManager.merge(job); }
public virtual void update(AuthorizationEntity authorization) { checkAuthorization(UPDATE, AUTHORIZATION, authorization.Id); DbEntityManager.merge(authorization); }