Example #1
0
        /// <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);
                    }
                }
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public java.util.List<EventSubscriptionEntity> findEventSubscriptionsByNameAndExecution(String type, String eventName, String executionId, boolean lockResult)
        public virtual IList <EventSubscriptionEntity> findEventSubscriptionsByNameAndExecution(string type,string eventName,string executionId,bool lockResult)
        {
            // first check cache in case entity is already loaded
            ExecutionEntity cachedExecution = DbEntityManager.getCachedEntity(typeof(ExecutionEntity),executionId);

            if (cachedExecution != null && !lockResult)
            {
                IList <EventSubscriptionEntity> eventSubscriptions = cachedExecution.EventSubscriptions;
                IList <EventSubscriptionEntity> result             = new List <EventSubscriptionEntity>();
                foreach (EventSubscriptionEntity subscription in eventSubscriptions)
                {
                    if (matchesSubscription(subscription,type,eventName))
                    {
                        result.Add(subscription);
                    }
                }
                return(result);
            }
            else
            {
                const string query = "selectEventSubscriptionsByNameAndExecution";
                IDictionary <string,object> @params = new Dictionary <string,object>();
                @params["eventType"]   = type;
                @params["eventName"]   = eventName;
                @params["executionId"] = executionId;
                @params["lockResult"]  = lockResult;
                return(DbEntityManager.selectList(query,@params));
            }
        }
Example #3
0
 public virtual DecisionDefinitionEntity getCachedResourceDefinitionEntity(string definitionId)
 {
     return(DbEntityManager.getCachedEntity(typeof(DecisionDefinitionEntity), definitionId));
 }