private static int InnerActivityClose(HeContext heContext, int activityId, bool advanceProcess, bool skip, bool skipAll, Action </*id*/ int, /*name*/ string, ActivityKind, /*key*/ string> activityChecks, List <Pair <string, object> > inputs)
        {
            int    userId = heContext.Session.UserId;
            string SSKey;
            string url;
            int    tenantId;
            List <Pair <int, ActivityKind> > nextActIds;

            ActivityKind activityKind;
            string       activityName;
            int          processId;

            BPMRuntime.GetActivityDataForWS(activityId, out processId, out activityKind, out activityName, out SSKey, out url, out tenantId);

            activityChecks(activityId, activityName, activityKind, SSKey);

            using (ActivityHandler activityHandler = new ActivityHandler(url)) {
                string failureMessage;
                bool   success = activityHandler.ExecuteOnClose(SSKey, activityId, processId, tenantId, userId, BuiltInFunction.GetCurrentLocale(), advanceProcess, skip, skipAll, inputs, out failureMessage, out nextActIds);

                if (!success)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
            }

            if (advanceProcess)
            {
                using (Transaction tran = DatabaseAccess.ForSystemDatabase.GetReadOnlyTransaction()) {
                    return(BPMRuntime.GetNextHumanActivity(heContext, tran, nextActIds, userId));
                }
            }

            return(BuiltInFunction.NullIdentifier());
        }
예제 #2
0
        public static void ActivitySchedule(HeContext heContext, int activityId, DateTime startDate)
        {
            string SSKey;
            string url;
            int    tenantId;

            bool   success;
            string failureMessage;

            int          processId;
            ActivityKind activityKind;
            string       activityName;

            BPMRuntime.GetActivityDataForWS(activityId, out processId, out activityKind, out activityName, out SSKey, out url, out tenantId, out string espaceSSKey);

            int userId = tenantId == heContext.Session.TenantId ? heContext.Session.UserId : 0;

            using (ActivityHandler activityHandler = new ActivityHandler(url, tenantId, userId, heContext.AppInfo.eSpaceUID, espaceSSKey)) {
                //ToDo: activityHandler.Timeout = (int)(1.2 * TimeoutInSec) * 1000;
                success = activityHandler.ExecuteActivitySchedule(SSKey, activityId, processId, startDate, tenantId, userId, BuiltInFunction.GetCurrentLocale(), out failureMessage);
                if (!success)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
            }
        }
        // BPM
        public static void ActivityOpen(HeContext heContext, int Id, out string handlingUrl)
        {
            bool   success;
            string failureMessage;

            InnerActivityOpen(heContext, Id, /*onlyGetUrl*/ false, out success, out failureMessage, out handlingUrl, kind => kind.CanBeOpened(), "ActivityOpen");
            if (!success)
            {
                ProcessBase.ThrowSpecificException(failureMessage);
            }
        }
예제 #4
0
        private static void SetProcessSuspension(HeContext heContext, int processId, bool suspend)
        {
            BPMRuntime.GetProcessDataForWS(processId, out string SSKey, out string url, out int tenantId, out string consumerKey);

            int userId = tenantId == heContext.Session.TenantId ? heContext.Session.UserId : 0;

            using (ActivityHandler activityHandler = new ActivityHandler(url, tenantId, userId, heContext.AppInfo.eSpaceUID, consumerKey)) {
                bool success = activityHandler.ExecuteSetProcessSuspension(SSKey, processId, suspend, tenantId, userId, out string failureMessage);
                if (!success)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
            }
        }
예제 #5
0
        public static int ProcessLaunch(HeContext heContext, ObjectKey SSKey, ObjectKey espaceSSKey, int parentActivityId, int parentProcessId, List <Pair <string, object> > inputs, out List <Pair <int, ActivityKind> > nextActIds)
        {
            string ssKey = ObjectKeyUtils.DatabaseValue(SSKey);

            BPMRuntime.GetProcessDataForWS(heContext, SSKey, espaceSSKey, out string url);

            using (ActivityHandler activityHandler = new ActivityHandler(url, heContext.Session.TenantId, heContext.Session.UserId, heContext.AppInfo.eSpaceUID, ObjectKeyUtils.DatabaseValue(espaceSSKey))) {
                int newProcessId = activityHandler.ExecuteProcessLaunch(ssKey, heContext.Session.TenantId, heContext.Session.UserId, parentActivityId, parentProcessId, inputs, out nextActIds, out string failureMessage);
                if (!failureMessage.IsEmpty() || newProcessId == 0)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
                return(newProcessId);
            }
        }
        private static void SetProcessSuspension(HeContext heContext, int processId, bool suspend)
        {
            string SSKey;
            string url;
            int    tenantId;

            bool   success;
            string failureMessage;

            BPMRuntime.GetProcessDataForWS(processId, out SSKey, out url, out tenantId);

            using (ActivityHandler activityHandler = new ActivityHandler(url)) {
                success = activityHandler.ExecuteSetProcessSuspension(SSKey, processId, suspend, tenantId, heContext.Session.UserId, out failureMessage);
                if (!success)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
            }
        }
        public static void ActivityReset(HeContext heContext, int activityId, bool resetActivityUser)
        {
            string SSKey;
            string url;
            int    tenantId;

            bool   success;
            string failureMessage;

            int          processId;
            ActivityKind activityKind;
            string       activityName;

            BPMRuntime.GetActivityDataForWS(activityId, out processId, out activityKind, out activityName, out SSKey, out url, out tenantId);

            using (ActivityHandler activityHandler = new ActivityHandler(url)) {
                //ToDo: activityHandler.Timeout = (int)(1.2 * TimeoutInSec) * 1000;
                success = activityHandler.ExecuteActivityReset(SSKey, activityId, processId, resetActivityUser, tenantId, heContext.Session.UserId, BuiltInFunction.GetCurrentLocale(), out failureMessage);
                if (!success)
                {
                    ProcessBase.ThrowSpecificException(failureMessage);
                }
            }
        }