public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var packageName = PackageCreatorFacade.ActivePackageName;

            if (entityToken is PackageCreatorEntityToken)
            {
                packageName = (entityToken as PackageCreatorEntityToken).Source;
            }
            if (string.IsNullOrEmpty(packageName))
            {
                flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"), PackageCreatorFacade.GetLocalization("NoPackages.Message"));
                return null;
            }
            if (actionToken is PackageCreatorActionToken)
            {
                var token = actionToken as PackageCreatorActionToken;

                foreach (var item in PackageCreatorActionFacade.GetPackageCreatorItems(entityToken))
                {
                    if (item.CategoryName == token.CategoryName)
                    {
                        //if diffent item for one category and entitytoken
                        var itemActionToken = item as IPackItemActionToken;
                        if (itemActionToken != null)
                        {
                            if (token.Name != itemActionToken.ActionTokenName)
                            {
                                continue;
                            }
                        }
                        if (item is IPackToggle)
                        {
                            if ((item as IPackToggle).CheckedStatus == ActionCheckedStatus.Checked)
                            {
                                 PackageCreatorFacade.RemoveItem(item, packageName);
                            }
                            else
                            {
                                PackageCreatorFacade.AddItem(item, packageName);
                            }
                            var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
                            parentTreeRefresher.PostRefreshMesseges(entityToken);
                        }
                        else
                        {
                            PackageCreatorFacade.AddItem(item, packageName);
                        }
                        break;
                    }
                }

            }

            SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            return null;
        }
示例#2
0
        public static IActionExecutor GetActionExecutor(ActionToken actionToken)
        {
            if (actionToken == null) throw new ArgumentNullException("actionToken");


            IActionExecutor actionExecutor;


            if (_actionExecutorCache.TryGetValue(actionToken.GetType(), out actionExecutor) == false)
            {
                object[] attributes = actionToken.GetType().GetCustomAttributes(typeof(ActionExecutorAttribute), true);

                if (attributes.Length == 0) throw new InvalidOperationException(string.Format("Missing {0} attribute on the flow token {1}", typeof(ActionExecutorAttribute), actionToken.GetType()));

                ActionExecutorAttribute attribute = (ActionExecutorAttribute)attributes[0];

                if (attribute.ActionExecutorType == null) throw new InvalidOperationException(string.Format("Action executor type can not be null on the action token {0}", actionToken.GetType()));
                if (typeof(IActionExecutor).IsAssignableFrom(attribute.ActionExecutorType) == false) throw new InvalidOperationException(string.Format("Action executor {0} should implement the interface {1}", attribute.ActionExecutorType, typeof(IActionExecutor)));

                actionExecutor = (IActionExecutor)Activator.CreateInstance(attribute.ActionExecutorType);

                _actionExecutorCache.Add(actionToken.GetType(), actionExecutor);
            }


            return actionExecutor;
        }
        public TaskContainer CreateNewTasks(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
        {
            List<Task> newTasks = new List<Task>();

            lock (_lock)
            {
                foreach (Func<EntityToken, ActionToken, Task> taskCreator in _taskCreators)
                {
                    try
                    {
                        Task task = taskCreator(entityToken, actionToken);
                        if (task == null) continue;

                        bool result = task.TaskManager.OnCreated(task.Id, taskManagerEvent);
                        if (result == false) continue;

                        _tasks.Add(task);
                        newTasks.Add(task);
                    }
                    catch (Exception ex)
                    {
                        Log.LogError("TaskManagerFacade", "Starting new task failed with following exception");
                        Log.LogError("TaskManagerFacade", ex);
                    }
                }
            }

            return new TaskContainer(newTasks, null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            //string documentTitle = "Unpublished Pages and Page Folder Data";
            //string description = "The list below display pages and page data which are currently being edited or are ready to be approved / published.";
            string documentTitle = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-title");
            string description = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-description");
            string emptyLabel = StringResourceSystemFacade.GetString("Composite.Plugins.GeneratedDataTypesElementProvider", "ViewUnpublishedItems-document-empty-label");
            string url = string.Format("{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}",
                UrlUtils.ResolveAdminUrl(string.Format("content/views/publishworkflowstatus/ViewUnpublishedItems.aspx")),
                HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),
                HttpUtility.UrlEncode(description, Encoding.UTF8),
                HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));

            IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
            OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId = "ViewUnpublishedPageItems",
                Label = documentTitle,
                Url = url,
                ViewType = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var packageName = PackageCreatorFacade.ActivePackageName;
            if (entityToken is PackageCreatorEntityToken)
            {
                packageName = (entityToken as PackageCreatorEntityToken).Source;
            }
            if (string.IsNullOrEmpty(packageName))
            {
                flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                var consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
                consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"),
                                            PackageCreatorFacade.GetLocalization("NoPackages.Message"));
                return null;
            }

            if (actionToken is AddLocalizationActionToken)
            {
                var token = actionToken as AddLocalizationActionToken;
                PackageCreatorFacade.AddItem(new PCLocalizations(token.CultureName), packageName);
            }

            var treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            return null;
        }
 public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
 {
     PackageCreatorFacade.DeletePackageInformation(entityToken.Source);
     SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
     treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
     return null;
 }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            if (actionToken.Serialize() == "ShowGraph")
            {
                string url = string.Format("{0}?EntityToken={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/Default.aspx"), System.Web.HttpUtility.UrlEncode(serializedEntityToken));

                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId);
            }
            else if (actionToken.Serialize() == "ShowOrientedGraph")
            {
                
                Guid id = Guid.NewGuid();
                string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.RelationshipGraph", id));
                C1File.WriteAllLines(filename, new string[] { serializedEntityToken });

                string url = string.Format("{0}?Id={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx"), id);

                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId);
            }

            return null;
        }
示例#8
0
        /// <exclude />
        public static SecurityResult Resolve(UserToken userToken, ActionToken actionToken, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinition)
        {
            if (userToken == null) throw new ArgumentNullException("userToken");
            if (actionToken == null) throw new ArgumentNullException("actionToken");


            return Resolve(userToken, actionToken.PermissionTypes, entityToken, userPermissionDefinitions, userGroupPermissionDefinition);
        }
示例#9
0
        public static bool IsIgnoreEntityTokenLocking(this ActionToken actionToken)
        {
            if (actionToken == null)
            {
                throw new ArgumentNullException(nameof(actionToken));
            }

            return(actionToken.IgnoreEntityTokenLocking);
        }
 public CreatePackageWorkflowActionToken(string name, ActionToken actionToken)
     : base(typeof(CreatePackageWorkflow), new PermissionType[] { PermissionType.Administrate })
 {
     StringBuilder sb = new StringBuilder();
     StringConversionServices.SerializeKeyValuePair(sb, "Name", name);
     StringConversionServices.SerializeKeyValuePair(sb, "GroupName", String.Join(".", name.Split('.').Take(2)));
     StringConversionServices.SerializeKeyValuePair(sb, "ReadMoreUrl", @"http://docs.composite.net/Composite.Localization.C1Console");
     StringConversionServices.SerializeKeyValuePair(sb, "ActionToken", ActionTokenSerializer.Serialize(actionToken));
     Payload = sb.ToString();
 }
示例#11
0
        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;
        }
示例#12
0
        /// <exclude />
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            PageAddActionToken pageAddActionToken = (PageAddActionToken)actionToken;

            var newPage = DataFacade.BuildNew<IPage>();
            newPage.PageTypeId = pageAddActionToken.PageTypeId;

            var action = DataActionTokenResolverFacade.Resolve(newPage, ((PageAddActionToken)actionToken).ActionIdentifier);

            return ActionExecutorFacade.Execute(EntityTokenSerializer.Deserialize(serializedEntityToken), action, flowControllerServicesContainer);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var generatedDataTypetoken = entityToken as GeneratedDataTypesElementProviderTypeEntityToken;
            string typeName = generatedDataTypetoken.SerializedTypeName;
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
            string url = DownloadUrl.FormatWith(typeName);

            ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);

            return null;
        }
        /// <exclude />
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            DataEntityToken dataEntityToken = (DataEntityToken)EntityTokenSerializer.Deserialize(serializedEntityToken);

            IData data = dataEntityToken.Data;

            Verify.IsNotNull(data, "Failed to get the data from an entity token");

            var action = DataActionTokenResolverFacade.Resolve(data, ((ProxyDataActionToken)actionToken).ActionIdentifier);

            return ActionExecutorFacade.Execute(dataEntityToken, action, flowControllerServicesContainer);
        }
示例#15
0
		public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
		{
			var currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
			var packageName = entityToken.Source;

			string url = UrlUtils.ResolveAdminUrl(
				string.Format(@"InstalledPackages/content/views/Composite.Forms.FormSubmitHandler/GetData.aspx?entityToken={0}", EntityTokenSerializer.Serialize(entityToken))
			);

			ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);
			return null;
		}
		public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
		{
			var token = entityToken as DataEntityToken;
			var apiKey = token.Data as ApiKey;

			IssuuApi.SetDefault(apiKey);

			var treeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
			treeRefresher.PostRefreshMesseges(token.Data.GetDataEntityToken());

			return null;
		}
        /// <exclude />
        public static string GetInlineElementActionScriptCode(EntityToken entityToken, ActionToken actionToken, Dictionary<string, string> piggyBag)
        {
            StringBuilder sb = new StringBuilder();

            StringConversionServices.SerializeKeyValuePair(sb, "EntityToken", EntityTokenSerializer.Serialize(entityToken, false));
            StringConversionServices.SerializeKeyValuePair(sb, "ActionToken", ActionTokenSerializer.Serialize(actionToken, true));
            StringConversionServices.SerializeKeyValuePair(sb, "PiggyBag", PiggybagSerializer.Serialize(piggyBag));

            string scriptAction = string.Format(@"SystemAction.invokeInlineAction(""{0}"");", Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString())));

            return scriptAction;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            Dictionary<string, string> viewArguments = new Dictionary<string, string>();
            viewArguments.Add("serializedEntityToken", serializedEntityToken);

            ConsoleMessageQueueFacade.Enqueue(new OpenHandledViewMessageQueueItem(EntityTokenSerializer.Serialize(entityToken, true), "Composite.Management.PermissionEditor", viewArguments), currentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            PackageCreatorFacade.ActivePackageName = entityToken.Source;
            Tree.Page.ClearCache();
            Tree.Media.ClearCache();
            var specificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
            specificTreeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
            specificTreeRefresher.PostRefreshMesseges(new PageElementProviderEntityToken("PageElementProvider"));
            parentTreeRefresher.PostRefreshMesseges(PCMediaFolder.GetRootEntityToken());

            return null;
        }
示例#20
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            UrlActionToken urlActionToken = (UrlActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string url = string.Format("{0}?EntityToken={1}", urlActionToken.Url, HttpUtility.UrlEncode(serializedEntityToken));

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = urlActionToken.Label }, currentConsoleId);

            return null;
        }
        /// <exclude />
        public static SecurityResult Resolve(UserToken userToken, ActionToken actionToken, EntityToken entityToken, IEnumerable <UserPermissionDefinition> userPermissionDefinitions, IEnumerable <UserGroupPermissionDefinition> userGroupPermissionDefinition)
        {
            if (userToken == null)
            {
                throw new ArgumentNullException("userToken");
            }
            if (actionToken == null)
            {
                throw new ArgumentNullException("actionToken");
            }


            return(Resolve(userToken, actionToken.PermissionTypes, entityToken, userPermissionDefinitions, userGroupPermissionDefinition));
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token = actionToken as DownloadPackageActionToken;
            if (token != null)
            {
                var currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
                var packageName = entityToken.Source;

                var url = UrlUtils.ResolveAdminUrl(
                    string.Format(@"InstalledPackages/services/Composite.Tools.PackageCreator/GetPackage.ashx?{0}={1}&consoleId={2}", token.Name, packageName, currentConsoleId));

                ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);
            }
            return null;
        }
示例#23
0
        /// <exclude />
        public static string Serialize(ActionToken actionToken, bool includeHashValue)
        {
            StringBuilder sb = new StringBuilder();

            StringConversionServices.SerializeKeyValuePair(sb, "actionTokenType", TypeManager.SerializeType(actionToken.GetType()));

            string serializedActionToken = actionToken.Serialize();

            StringConversionServices.SerializeKeyValuePair(sb, "actionToken", serializedActionToken);

            if (includeHashValue)
            {
                StringConversionServices.SerializeKeyValuePair(sb, "actionTokenHash", HashSigner.GetSignedHash(serializedActionToken).Serialize());
            }

            return(sb.ToString());
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string url = UrlUtils.ResolveAdminUrl("InstalledPackages/content/views/Composite.Tools.LinkChecker/ListBrokenLinks.aspx");

            var consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
            var openViewMsg = new OpenViewMessageQueueItem
            {
                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                ViewId = "LinkChecker",
                Label = GetResourceString("LinkCheckerActionToken.Label"),
                Url = url,
                ViewType = ViewType.Main
            };

            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);

            return null;
        }
示例#25
0
        public void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
        {
            FlowControllerServicesContainer flowServicesContainer = new FlowControllerServicesContainer();
            flowServicesContainer.AddService(new ManagementConsoleMessageService(this.ConsoleId));
            flowServicesContainer.AddService(new ElementDataExchangeService(this.ElementProviderName));
            flowServicesContainer.AddService(this);

            FlowToken flowToken = ActionExecutorFacade.Execute(entityToken, actionToken, flowServicesContainer, taskManagerEvent);

            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);

            ActionResult result = new ActionResult();

            if (typeof(FlowUiDefinitionBase).IsAssignableFrom(uiDefinition.GetType()))
            {
                string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);
                ViewTransitionHelper.HandleNew(this.ConsoleId, this.ElementProviderName, serializedEntityToken, flowToken, (FlowUiDefinitionBase)uiDefinition);
            }
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            FunctionInfoActionToken urlActionToken = (FunctionInfoActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string url = UrlUtils.ResolveAdminUrl(@"content/views/functioninfo/ShowFunctionInfo.aspx");
            url += "?Name=" + urlActionToken.FunctionName + "&IsWidget=" + urlActionToken.IsWidgetFunction;

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
            {
                Url = url,
                Label = urlActionToken.FunctionName,
                ViewId = Guid.NewGuid().ToString(),
                ViewType = ViewType.Main
            }, currentConsoleId);

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var item = PackageCreatorActionFacade.GetPackageCreatorItem(entityToken.Type, entityToken.Id);
            PackageCreatorFacade.RemoveItem(item, entityToken.Source);

            SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());

            var itemToggle = item as IPackToggle;
            if (itemToggle != null)
            {
                var itemEntityToken = itemToggle.GetEntityToken();
                if (itemEntityToken != null)
                {
                    var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
                    parentTreeRefresher.PostRefreshMesseges(itemEntityToken);
                }
            }

            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<Composite.C1Console.Events.IManagementConsoleMessageService>().CurrentConsoleId;

            DisplayLocalOrderingActionToken castedActionToken = (DisplayLocalOrderingActionToken)actionToken;

            string url = string.Format("{0}?ParentPageId={1}", BaseUrl, HttpUtility.UrlEncode(castedActionToken.ParentPageId.ToString()));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
                    {
                        EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                        Url = url,
                        ViewId = Guid.NewGuid().ToString(),
                        ViewType = ViewType.Main,
                        Label = "Pages local orderings"
                    },
                currentConsoleId);

            return null;
        }
示例#29
0
        public static bool IsIgnoreEntityTokenLocking(this ActionToken actionToken)
        {
            if (actionToken == null)
            {
                throw new ArgumentNullException("actionToken");
            }

            Type type = actionToken.GetType();

            lock (_lock)
            {
                bool ignoreLocking;
                if (_ignoreEntityTokenLockingCache.TryGetValue(type, out ignoreLocking) == false)
                {
                    ignoreLocking = type.GetCustomAttributesRecursively <IgnoreEntityTokenLocking>().Any();

                    _ignoreEntityTokenLockingCache.Add(type, ignoreLocking);
                }

                return(ignoreLocking | actionToken.IgnoreEntityTokenLocking);
            }
        }
示例#30
0
        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            WorkflowActionToken workflowActionToken = (WorkflowActionToken)actionToken;

            WorkflowInstance workflowInstance = WorkflowFacade.CreateNewWorkflow(
                    workflowActionToken.WorkflowType,
                    new Dictionary<string, object> { 
                            { "SerializedEntityToken", serializedEntityToken },
                            { "SerializedActionToken", serializedActionToken },
                            { "ParentWorkflowInstanceId", workflowActionToken.ParentWorkflowInstanceId }
                        }
                );

            workflowInstance.Start();

            WorkflowFacade.SetFlowControllerServicesContainer(workflowInstance.InstanceId, flowControllerServicesContainer);
            WorkflowFacade.RunWorkflow(workflowInstance);

            WorkflowFacade.SetEventHandlerFilter(workflowInstance.InstanceId, workflowActionToken.EventHandleFilterType);

            return new WorkflowFlowToken(workflowInstance.InstanceId);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string functionNamePrefix = "";
            if (entityToken.Id.IndexOf('.') > -1)
            {
                functionNamePrefix = entityToken.Id.Substring(entityToken.Id.IndexOf('.') + 1);
            }

            bool widgets = entityToken.Id.ToLower().Contains("widget");

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;
            string url = UrlUtils.ResolveAdminUrl(string.Format("content/views/functiondoc/FunctionDocumentation.aspx?functionPrefix={0}&widgets={1}", functionNamePrefix, widgets));

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem
                {
                    Url = url,
                    EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
                    ViewId = Guid.NewGuid().ToString(),
                    ViewType = ViewType.Main,
                    Label = "Documentation"
                }, currentConsoleId);

            return null;
        }
示例#32
0
 /// <exclude />
 public static string Serialize(ActionToken actionToken)
 {
     return(Serialize(actionToken, false));
 }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            SearchActionToken searchActionToken = (SearchActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string viewId = Guid.NewGuid().ToString();



            string url = UrlUtils.ResolveAdminUrl(string.Format("content/dialogs/treesearch/treeSearchForm.aspx?ProviderName={0}&EntityToken={1}&ViewId={2}&ConsoleId={3}", HttpUtility.UrlEncode(searchActionToken.ProviderName), HttpUtility.UrlEncode(serializedEntityToken), HttpUtility.UrlEncode(viewId), HttpUtility.UrlEncode(currentConsoleId)));

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
                {
                    Url = url,
                    ViewId = viewId,
                    ViewType = ViewType.ModalDialog,
                    Label = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElements"),
                    ToolTip = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElementsToolTip"),
                    IconResourceHandle = CommonElementIcons.Question
                }, currentConsoleId);


            return null;
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            StringBuilder sb = new StringBuilder();

            var elementInformationService = flowControllerServicesContainer.GetService<IElementInformationService>();

            if (elementInformationService != null)
            {
                Dictionary<string, string> piggybag = elementInformationService.Piggyback;

                foreach (var kvp in piggybag)
                {
                    Core.Serialization.StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value);
                }
            }

            Guid id = Guid.NewGuid();
            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.showinfo", id));

            C1File.WriteAllLines(filename, new string[] { serializedEntityToken, sb.ToString() });

            string url = string.Format("{0}?PiggyBagId={1}", UrlUtils.ResolveAdminUrl("content/views/showelementinformation/Default.aspx"), id);

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show Element Information..." }, currentConsoleId);

            return null;
        }
示例#35
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            CustomUrlActionNodeActionToken customUrlActionNodeActionToken = (CustomUrlActionNodeActionToken)actionToken;

            CustomUrlActionNode customUrlActionNode = (CustomUrlActionNode)ActionNode.Deserialize(customUrlActionNodeActionToken.SerializedActionNode);

            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;

            switch (customUrlActionNode.ViewType)
            {
                case CustomUrlActionNodeViewType.DocumentView:
                    {
                        string viewId = Guid.NewGuid().ToString();
                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

                        OpenViewMessageQueueItem openViewMessageQueueItem = new OpenViewMessageQueueItem()
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken,
                            Label = customUrlActionNodeActionToken.ViewLabel,
                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,
                            IconResourceHandle = customUrlActionNode.ViewIcon,
                            Url = customUrlActionNodeActionToken.Url,
                            UrlPostArguments = customUrlActionNode.PostParameters
                        };
                        ConsoleMessageQueueFacade.Enqueue(openViewMessageQueueItem, currentConsoleId);

                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken
                        };
                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);
                    }
                    break;

                case CustomUrlActionNodeViewType.ExternalView:
                    {
                        string viewId = Guid.NewGuid().ToString();
                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

                        OpenExternalViewQueueItem openExternalViewQueueItem = new OpenExternalViewQueueItem(entityToken)
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken,
                            Label = customUrlActionNodeActionToken.ViewLabel,
                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,
                            IconResourceHandle = customUrlActionNode.ViewIcon,
                            Url = customUrlActionNodeActionToken.Url,
                            ViewType = customUrlActionNodeActionToken.ViewType,
                            UrlPostArguments = customUrlActionNode.PostParameters
                        };
                        ConsoleMessageQueueFacade.Enqueue(openExternalViewQueueItem, currentConsoleId);

                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken
                        };
                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);
                    }
                    break;

                case CustomUrlActionNodeViewType.GenericView:
                    {
                        string viewId = Guid.NewGuid().ToString();
                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

                        OpenGenericViewQueueItem openGenericViewQueueItem = new OpenGenericViewQueueItem(entityToken)
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken,
                            Label = customUrlActionNodeActionToken.ViewLabel,
                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,
                            IconResourceHandle = customUrlActionNode.ViewIcon,
                            Url = customUrlActionNodeActionToken.Url,
                            UrlPostArguments = customUrlActionNode.PostParameters
                        };
                        ConsoleMessageQueueFacade.Enqueue(openGenericViewQueueItem, currentConsoleId);

                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()
                        {
                            ViewId = viewId,
                            EntityToken = serializedEntityToken
                        };
                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);
                    }
                    break;


                case CustomUrlActionNodeViewType.PageBrowser:
                    Dictionary<string, string> arguments = new Dictionary<string, string>();
                    arguments.Add("URL", customUrlActionNodeActionToken.Url);

                    OpenHandledViewMessageQueueItem openHandledViewMessageQueueItem = new OpenHandledViewMessageQueueItem(
                        EntityTokenSerializer.Serialize(entityToken, true), 
                        "Composite.Management.Browser", 
                        arguments
                    );

                    ConsoleMessageQueueFacade.Enqueue(openHandledViewMessageQueueItem, currentConsoleId);                    
                    break;


                case CustomUrlActionNodeViewType.FileDownload:
                    DownloadFileMessageQueueItem downloadFileMessageQueueItem = new DownloadFileMessageQueueItem(customUrlActionNodeActionToken.Url);

                    ConsoleMessageQueueFacade.Enqueue(downloadFileMessageQueueItem, currentConsoleId);                    
                    break;
            }


            return null;
        }