예제 #1
0
        /// <summary>
        /// Sets sign IsObsolete to the scheme
        /// </summary>
        /// <param name="schemeCode">Name of the scheme</param>
        /// <param name="parameters">Parameters for creating the scheme</param>
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters = DefiningParametersSerializer.Serialize(parameters);
            var db = _connector.GetDatabase();

            db.HashDelete(GetKeyForCurrentScheme(schemeCode), definingParameters);
        }
예제 #2
0
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = DefiningParametersSerializer.Serialize(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            var session = Store.OpenSession();

            do
            {
                var oldSchemes =
                    session.Query <WorkflowProcessScheme>().Customize(c => c.WaitForNonStaleResultsAsOfNow()).Where(wps =>
                                                                                                                    wps.DefiningParametersHash == definingParametersHash && (wps.SchemeCode == schemeCode || wps.RootSchemeCode == schemeCode) &&
                                                                                                                    !wps.IsObsolete).ToList();

                if (oldSchemes.Count == 0)
                {
                    break;
                }

                foreach (var scheme in oldSchemes)
                {
                    scheme.IsObsolete = true;
                }

                session.SaveChanges();

                if (session.Advanced.NumberOfRequests >= session.Advanced.MaxNumberOfRequestsPerSession - 2)
                {
                    session.Dispose();
                    session = Store.OpenSession();
                }
            } while (true);

            session.Dispose();
        }
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = DefiningParametersSerializer.Serialize(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            using (var scope = PredefinedTransactionScopes.SerializableSupressedScope)
            {
                using (var context = CreateContext())
                {
                    var oldSchemes =
                        context.WorkflowProcessSchemes.Where(
                            wps =>
                            wps.DefiningParametersHash == definingParametersHash && (wps.SchemeCode == schemeCode || wps.RootSchemeCode == schemeCode) &&
                            !wps.IsObsolete).ToList();

                    foreach (var scheme in oldSchemes)
                    {
                        scheme.IsObsolete = true;
                    }

                    context.SubmitChanges();
                }

                scope.Complete();
            }
        }
예제 #4
0
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = DefiningParametersSerializer.Serialize(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            using (MySqlConnection connection = new MySqlConnection(ConnectionString))
            {
                WorkflowProcessScheme.SetObsolete(connection, schemeCode, definingParametersHash);
            }
        }
예제 #5
0
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = DefiningParametersSerializer.Serialize(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            var dbcoll = Store.GetCollection <WorkflowProcessScheme>(MongoDBConstants.WorkflowProcessSchemeCollectionName);

            dbcoll.UpdateMany(
                item => (item.SchemeCode == schemeCode || item.RootSchemeCode == schemeCode) && item.DefiningParametersHash == definingParametersHash,
                Builders <WorkflowProcessScheme> .Update.Set(c => c.IsObsolete, true));
        }
예제 #6
0
        public void SetSchemeIsObsolete(string schemeCode, IDictionary <string, object> parameters)
        {
            var definingParameters     = DefiningParametersSerializer.Serialize(parameters);
            var definingParametersHash = HashHelper.GenerateStringHash(definingParameters);

            var cache =
                Store.GetOrCreateCache <Guid, WorkflowProcessScheme>(IgniteConstants.WorkflowProcessSchemeCacheName);
            var schemes = cache.AsCacheQueryable().Where(
                item =>
                (item.Value.SchemeCode == schemeCode || item.Value.RootSchemeCode == schemeCode) &&
                item.Value.DefiningParametersHash == definingParametersHash).Select(c => c.Value).ToList();

            foreach (var scheme in schemes)
            {
                scheme.IsObsolete = true;
            }

            cache.PutAll(schemes.ToDictionary(c => c.Id));
        }