Ejemplo n.º 1
0
        private void saveInfoCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            var package = this.GetBinding <PackageInformation>("Package");

            PackageCreatorFacade.SavePackageInformation(package);


            if (!string.IsNullOrEmpty(Payload))
            {
                var         type        = StringConversionServices.DeserializeValueString(StringConversionServices.ParseKeyValueCollection(Payload)["ActionToken"]);
                ActionToken actionToken = ActionTokenSerializer.Deserialize(type);
                ActionExecutorFacade.Execute(package.GetEntityToken(), actionToken, WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));
            }
            else
            {
                ActionExecutorFacade.Execute(
                    package.GetEntityToken(),
                    new SetActivePackageActionToken(),
                    WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));
            }

            SpecificTreeRefresher treeRefresher = this.CreateSpecificTreeRefresher();

            treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string pageIdString = this.Request.QueryString["pageId"];

            if (pageIdString == null)
            {
                throw new InvalidOperationException();
            }

            Guid pageId = new Guid(pageIdString);

            //var editWorkflowAttribute = teaser.DataSourceId.InterfaceType.GetCustomAttributes(true).OfType<EditWorkflowAttribute>().FirstOrDefault();
            //if (editWorkflowAttribute == null)
            //{
            //    editLink.Link = string.Empty;
            //    return editLink;
            //}


            var pagex        = PageManager.GetPageById(pageId);
            var _entityToken = new PageDataEntityToken(pagex);

            var serializedEntityToken = EntityTokenSerializer.Serialize(_entityToken, true);

            var editActionToken = new WorkflowActionToken(typeof(EditDataWorkflow));

            var token = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(typeof(EditPageWorkflow).FullName));


            var serializedActionToken = ActionTokenSerializer.Serialize(token, true);

            //var m = ActionTokenSerializer.Deserialize(k);
            var x = ActionTokenSerializer.Deserialize(serializedActionToken);

            providerName = pagex.DataSourceId.ProviderName;
            entityToken  = serializedEntityToken;
            actionToken  = serializedActionToken;
            piggybag     = string.Empty;
            piggybagHash = HashSigner.GetSignedHash(string.Empty).Serialize();

            using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))
            {
                IPage page = PageManager.GetPageById(pageId);

                this.MyPlaceHolder.Controls.Add(new LiteralControl("Title: " + page.Title + "<br />"));
            }
        }
Ejemplo n.º 3
0
        /// <exclude />
        public static void ExecuteElementAction(string providerName, string serializedEntityToken, string piggybag, string serializedActionToken, string consoleId)
        {
            using (DebugLoggingScope.MethodInfoScope)
            {
                EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);
                if (!entityToken.IsValid())
                {
                    ShowInvalidEntityMessage(consoleId);
                    return;
                }

                var elementHandle = new ElementHandle(providerName, entityToken, piggybag);

                ActionToken  actionToken  = ActionTokenSerializer.Deserialize(serializedActionToken, true);
                ActionHandle actionHandle = new ActionHandle(actionToken);

                ActionExecutionMediator.ExecuteElementAction(elementHandle, actionHandle, consoleId);
            }
        }
        public WorkflowInstance CreateNewWorkflow(Type workflowType, Dictionary <string, object> arguments)
        {
            GlobalInitializerFacade.EnsureSystemIsInitialized();
            DoInitialize(0);

            try
            {
                WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(workflowType, arguments);

                SetWorkflowPersistingType(workflowType, workflowInstance.InstanceId);

                if (arguments.TryGetValue("SerializedEntityToken", out var serializedEntityToken) &&
                    arguments.TryGetValue("SerializedActionToken", out var serializedActionToken))
                {
                    ActionToken actionToken = ActionTokenSerializer.Deserialize((string)serializedActionToken);

                    if (!actionToken.IgnoreEntityTokenLocking)
                    {
                        AcquireLockIfNeeded(workflowType, workflowInstance.InstanceId, (string)serializedEntityToken);
                    }
                }

                return(workflowInstance);
            }
            catch (WorkflowValidationFailedException exp)
            {
                var errors = new StringBuilder();
                foreach (ValidationError error in exp.Errors)
                {
                    errors.AppendLine(error.ToString());
                }

                Log.LogError(LogTitle, errors.ToString());
                throw;
            }
        }