Beispiel #1
0
        /// <exclude />
        protected void SelectElement(EntityToken entityToken)
        {
            var container = GetFlowControllerServicesContainer();

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.SelectElement(EntityTokenSerializer.Serialize(entityToken, true));
        }
Beispiel #2
0
        /// <exclude />
        protected string GetCurrentConsoleId()
        {
            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            return(managementConsoleMessageService.CurrentConsoleId);
        }
Beispiel #3
0
        /// <exclude />
        protected void RebootConsole()
        {
            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.RebootConsole();
        }
Beispiel #4
0
        /// <exclude />
        protected void LockTheSystem()
        {
            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.LockSystem();
        }
Beispiel #5
0
        /// <exclude />
        protected string GetCurrentConsoleId()
        {
            var flowControllerServicesContainer = GetFlowControllerServicesContainer();

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            return(managementConsoleMessageService.CurrentConsoleId);
        }
Beispiel #6
0
        /// <exclude />
        protected void SelectElement(EntityToken entityToken)
        {
            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.SelectElement(EntityTokenSerializer.Serialize(entityToken, true));
        }
Beispiel #7
0
        /// <exclude />
        protected void LockTheSystem()
        {
            var flowControllerServicesContainer = GetFlowControllerServicesContainer();

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.LockSystem();
        }
Beispiel #8
0
        /// <exclude />
        protected void RebootConsole()
        {
            var container = GetFlowControllerServicesContainer();

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.RebootConsole();
        }
        /// <exclude />
        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.ShowMessage(this.DialogType, StringResourceSystemFacade.ParseString(this.Title), StringResourceSystemFacade.ParseString(this.Message));

            return(ActivityExecutionStatus.Closed);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            MessageBoxActionToken messageBoxActionToken = (MessageBoxActionToken)actionToken;

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.ShowMessage(messageBoxActionToken.DialogType, messageBoxActionToken.Title, messageBoxActionToken.Message);

            return(null);
        }
        private void sendMessageCodeActivity_SendMessage_ExecuteCode(object sender, EventArgs e)
        {
            this.CloseCurrentView();

            string title   = this.GetBinding <string>("Title");
            string message = this.GetBinding <string>("Message");

            FlowControllerServicesContainer  flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.ShowGlobalMessage(DialogType.Message, title, message);
        }
        /// <exclude />
        protected void ReportException(Exception ex)
        {
            Verify.ArgumentNotNull(ex, nameof(ex));

            this.ShowMessage(DialogType.Error, "An unfortunate error occurred", $"Sorry, but an error has occurred, preventing the opperation from completing as expected. The error has been documented in details so a technican may follow up on this issue.\n\nThe error message is: {ex.Message}");

            Log.LogCritical(this.GetType().Name, ex);

            var container = GetFlowControllerServicesContainer();
            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            service.ShowLogEntry(this.GetType(), ex);
        }
        /// <exclude />
        protected void ShowMessage(DialogType dialogType, string title, string message)
        {
            var container = GetFlowControllerServicesContainer();

            IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

            string localizedTitle   = StringResourceSystemFacade.ParseString(title);
            string localizedMessage = StringResourceSystemFacade.ParseString(message);

            service.ShowMessage(
                dialogType,
                localizedTitle,
                localizedMessage
                );
        }
        /// <exclude />

        public void PostRefreshMessages(EntityToken specificEntityToken)
        {
            Verify.ArgumentNotNull(specificEntityToken, "specificEntityToken");

            if (_postRefreshMessagesCalled)
            {
                throw new InvalidOperationException("Only one PostRefreshMessages call is allowed");
            }

            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            messageService.RefreshTreeSection(specificEntityToken);

            Log.LogVerbose(GetType().Name, "Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}", specificEntityToken.Type, specificEntityToken.Source, specificEntityToken.Id, specificEntityToken.GetType());
        }
Beispiel #15
0
        /// <exclude />
        protected void ReportException(Exception ex)
        {
            if (ex == null)
            {
                throw new ArgumentNullException("ex");
            }

            this.ShowMessage(DialogType.Error, "An unfortunate error occurred", string.Format("Sorry, but an error has occurred, preventing the opperation from completing as expected. The error has been documented in details so a technican may follow up on this issue.\n\nThe error message is: {0}", ex.Message));

            Log.LogCritical(this.GetType().Name, ex);

            FlowControllerServicesContainer  container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            IManagementConsoleMessageService service   = container.GetService <IManagementConsoleMessageService>();

            service.ShowLogEntry(this.GetType(), ex);
        }
Beispiel #16
0
        /// <exclude />
        public void PostRefreshMessages(bool skipBeforeDeleteEntityToken = false)
        {
            if (_postRefreshMessagesCalled)
            {
                throw new InvalidOperationException("Only one PostRefreshMessages call is allowed");
            }

            _postRefreshMessagesCalled = true;

            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            foreach (EntityToken entityToken in RefreshDeleteEntityTokenFinder.FindEntityTokens(_beforeGraph, skipBeforeDeleteEntityToken))
            {
                messageService.RefreshTreeSection(entityToken);
            }
        }
Beispiel #17
0
        /// <exclude />
        public void PostRefreshMesseges(EntityToken newChildEntityToken)
        {
            Verify.ArgumentNotNull(newChildEntityToken, "newChildEntityToken");
            Verify.That(!_postRefreshMessegesCalled, "Only one PostRefreshMesseges call is allowed");

            _postRefreshMessegesCalled = true;

            _afterGraph = new RelationshipGraph(newChildEntityToken, RelationshipGraphSearchOption.Both, false, false);

            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            foreach (EntityToken entityToken in RefreshBeforeAfterEntityTokenFinder.FindEntityTokens(_beforeGraph, _afterGraph))
            {
                messageService.RefreshTreeSection(entityToken);
                Log.LogVerbose("AddNewTreeRefresher", string.Format("Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}", entityToken.Type, entityToken.Source, entityToken.Id, entityToken.GetType()));
            }
        }
Beispiel #18
0
        /// <exclude />
        public void PostRefreshMessages(bool skipBeforeDeleteEntityToken = false)
        {
            if (_postRefreshMessagesCalled)
            {
                throw new InvalidOperationException("Only one PostRefreshMessages call is allowed");
            }

            _postRefreshMessagesCalled = true;

            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            foreach (EntityToken entityToken in RefreshDeleteEntityTokenFinder.FindEntityTokens(_beforeGraph, skipBeforeDeleteEntityToken))
            {
                messageService.RefreshTreeSection(entityToken);
                Log.LogVerbose(this.GetType().Name, "Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}", entityToken.Type, entityToken.Source, entityToken.Id, entityToken.GetType());
            }
        }
        /// <exclude />
        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            FormsWorkflow formsWorkflow = this.GetRoot <FormsWorkflow>();

            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);

            if (container != null)
            {
                IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>();

                if (service != null)
                {
                    service.CloseCurrentView();
                }
            }

            return(ActivityExecutionStatus.Closed);
        }
        /// <exclude />
        public void PostRefreshMessages(EntityToken afterUpdateEntityToken)
        {
            if (_postRefreshMessagesCalled)
            {
                throw new InvalidOperationException("Only one PostRefreshMessages call is allowed");
            }

            _postRefreshMessagesCalled = true;

            _afterGraph = new RelationshipGraph(afterUpdateEntityToken, RelationshipGraphSearchOption.Both, false, false);

            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            foreach (EntityToken entityToken in RefreshBeforeAfterEntityTokenFinder.FindEntityTokens(_beforeGraph, _afterGraph))
            {
                messageService.RefreshTreeSection(entityToken);
                Log.LogVerbose(this.GetType().Name, "Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}", entityToken.Type, entityToken.Source, entityToken.Id, entityToken.GetType());
            }
        }
Beispiel #21
0
        private void sendMessageCodeActivity_SendMessage_ExecuteCode(object sender, EventArgs e)
        {
            CloseCurrentView();

            var timeZoneStandardName = GetBinding <string>("TimeZonesSelected");

            var timezoneId = TimeZoneInfo.FindSystemTimeZoneById(timeZoneStandardName);

            var timezoneTransform = XDocument.Parse(String.Format(TimezoneXslt, timezoneId.Id));

            ConfigurationServices.TransformConfiguration(timezoneTransform, false);

            HostingEnvironment.InitiateShutdown();

            FlowControllerServicesContainer  flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>();

            managementConsoleMessageService.ShowGlobalMessage(DialogType.Message,
                                                              StringResourceSystemFacade.GetString("Composite.Management", "SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedTitle"),
                                                              StringResourceSystemFacade.GetString("Composite.Management", "SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedMessage"));

            managementConsoleMessageService.RebootConsole();
        }
        /// <exclude />
        public static FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer, TaskManagerEvent taskManagerEvent)
        {
            if (entityToken == null)
            {
                throw new ArgumentNullException("entityToken");
            }
            if (actionToken == null)
            {
                throw new ArgumentNullException("actionToken");
            }


            string username = UserValidationFacade.GetUsername();

#if NO_SECURITY
#else
            HookingFacade.EnsureInitialization();

            IEnumerable <UserPermissionDefinition>      userPermissionDefinitions      = PermissionTypeFacade.GetUserPermissionDefinitions(username);
            IEnumerable <UserGroupPermissionDefinition> userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(username);
            SecurityResult securityResult = SecurityResolver.Resolve(UserValidationFacade.GetUserToken(), actionToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions);
            if (securityResult != SecurityResult.Allowed && !(entityToken is SecurityViolationWorkflowEntityToken))
            {
                return(ExecuteSecurityViolation(actionToken, entityToken, flowControllerServicesContainer));
            }
#endif

            bool ignoreLocking = actionToken.IsIgnoreEntityTokenLocking();

            if (!ignoreLocking && ActionLockingFacade.IsLocked(entityToken))
            {
                return(ExecuteEntityTokenLocked(actionToken, entityToken, flowControllerServicesContainer));
            }

            IActionExecutor actionExecutor = ActionExecutorCache.GetActionExecutor(actionToken);

            ActionEventSystemFacade.FireOnBeforeActionExecution(entityToken, actionToken);

            FlowToken flowToken;
            using (TaskContainer taskContainer = TaskManagerFacade.CreateNewTasks(entityToken, actionToken, taskManagerEvent))
            {
                ITaskManagerFlowControllerService taskManagerService = null;
                if (flowControllerServicesContainer.GetService(typeof(ITaskManagerFlowControllerService)) == null)
                {
                    taskManagerService = new TaskManagerFlowControllerService(taskContainer);
                    flowControllerServicesContainer.AddService(taskManagerService);
                }

                try
                {
                    if (actionExecutor is IActionExecutorSerializedParameters)
                    {
                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);
                        string serializedActionToken = ActionTokenSerializer.Serialize(actionToken);

                        flowToken = Execute(actionExecutor as IActionExecutorSerializedParameters,
                                            serializedEntityToken, serializedActionToken, actionToken,
                                            flowControllerServicesContainer);
                    }
                    else
                    {
                        flowToken = Execute(actionExecutor, entityToken, actionToken,
                                            flowControllerServicesContainer);
                    }
                }
                finally
                {
                    if (taskManagerService != null)
                    {
                        flowControllerServicesContainer.RemoveService(taskManagerService);
                    }
                }

                taskContainer.SetOnIdleTaskManagerEvent(new FlowTaskManagerEvent(flowToken));
                taskContainer.UpdateTasksWithFlowToken(flowToken);

                taskContainer.SaveTasks();
            }

            ActionEventSystemFacade.FireOnAfterActionExecution(entityToken, actionToken, flowToken);

            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer
                                                                               .GetService <IManagementConsoleMessageService>();
            if (managementConsoleMessageService != null)
            {
                FlowControllerFacade.RegisterNewFlowInformation(flowToken, entityToken, actionToken,
                                                                managementConsoleMessageService.CurrentConsoleId);
            }
            else
            {
                Log.LogWarning(nameof(ActionExecutorFacade), "Missing ManagementConsoleMessageService, can not register the flow");
            }

            return(flowToken);
        }