コード例 #1
0
        public virtual object Execute(CommandContext commandContext)
        {
            var                     processEngineConfiguration = context.Impl.Context.ProcessEngineConfiguration;
            DeploymentCache         deploymentCache            = processEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition          = deploymentCache.FindDeployedProcessDefinitionById(ProcessDefinitionId);

            EnsureUtil.EnsureNotNull("Process Definition '" + ProcessDefinitionId + "' not found", "processDefinition", processDefinition);

            foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckReadProcessDefinition(processDefinition);
            }
            IStartFormHandler startFormHandler = processDefinition.StartFormHandler;

            if (startFormHandler == null)
            {
                return(null);
            }

            var formEngine = context.Impl.Context.ProcessEngineConfiguration.FormEngines[FormEngineName];

            EnsureUtil.EnsureNotNull("No formEngine '" + FormEngineName + "' defined process engine configuration",
                                     "formEngine", formEngine);

            IStartFormData startForm = startFormHandler.CreateStartFormData(processDefinition);

            return(formEngine.RenderStartForm(startForm));
        }
コード例 #2
0
ファイル: JuelFormEngine.cs プロジェクト: zf321/ESS.FW.Bpm
        public virtual object RenderStartForm(IStartFormData startForm)
        {
            if (ReferenceEquals(startForm.FormKey, null))
            {
                return(null);
            }
            var formTemplateString = GetFormTemplateString(startForm, startForm.FormKey);

            return(ExecuteScript(formTemplateString, null));
        }
コード例 #3
0
        public virtual void testGetStartFormData()
        {
            // given
            string processDefinitionId = selectProcessDefinitionByKey(FORM_KEY_PROCESS_KEY).Id;

            createGrantAuthorization(Resources.ProcessDefinition, FORM_KEY_PROCESS_KEY, userId, Permissions.Read);

            // when
            IStartFormData startFormData = formService.GetStartFormData(processDefinitionId);

            // then
            Assert.NotNull(startFormData);
            Assert.AreEqual("aStartFormKey", startFormData.FormKey);
        }
コード例 #4
0
        [Test]   public virtual void testGetStartFormWithDisabledTenantCheck()
        {
            testRule.DeployForTenant(TENANT_ONE, "resources/api/authorization/formKeyProcess.bpmn20.xml");

            IProcessInstance instance = runtimeService.StartProcessInstanceByKey(PROCESS_DEFINITION_KEY);

            identityService.SetAuthentication("aUserId", null);
            processEngineConfiguration.SetTenantCheckEnabled(false);

            IStartFormData startFormData = formService.GetStartFormData(instance.ProcessDefinitionId);

            // then
            Assert.NotNull(startFormData);
            Assert.AreEqual("aStartFormKey", startFormData.FormKey);
        }
コード例 #5
0
        [Test]   public virtual void testGetStartFormWithAuthenticatedTenant()
        {
            testRule.DeployForTenant(TENANT_ONE, "resources/api/authorization/formKeyProcess.bpmn20.xml");

            IProcessInstance instance = runtimeService.StartProcessInstanceByKey(PROCESS_DEFINITION_KEY);

            identityService.SetAuthentication("aUserId", null, new List <string>()
            {
                TENANT_ONE
            });

            IStartFormData startFormData = formService.GetStartFormData(instance.ProcessDefinitionId);

            // then
            Assert.NotNull(startFormData);
            Assert.AreEqual("aStartFormKey", startFormData.FormKey);
        }
コード例 #6
0
        public override IVariableMap Execute(CommandContext commandContext)
        {
            IStartFormData startFormData = commandContext.RunWithoutAuthorization(() => new GetStartFormCmd(ResourceId).Execute(commandContext));

            IProcessDefinition definition = startFormData.ProcessDefinition;

            CheckGetStartFormVariables((ProcessDefinitionEntity)definition, commandContext);

            IVariableMap result = new VariableMapImpl();

            foreach (IFormField formField in startFormData.FormFields)
            {
                if (FormVariableNames == null || FormVariableNames.Contains(formField.Id))
                {
                    result.PutValue(formField.Id, CreateVariable(formField, null));
                }
            }

            return(result);
        }
コード例 #7
0
        public virtual void testCustomStartFormHandlerExecutesQuery()
        {
            // given
            startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);

            string processDefinitionId = selectProcessDefinitionByKey(DEFAULT_PROCESS_KEY).Id;

            createGrantAuthorization(Resources.ProcessDefinition, DEFAULT_PROCESS_KEY, userId, Permissions.Read);

            // when
            IStartFormData startFormData = formService.GetStartFormData(processDefinitionId);

            // then
            Assert.NotNull(startFormData);

            Assert.NotNull(MyDelegationService.CURRENT_AUTHENTICATION);
            Assert.AreEqual(userId, MyDelegationService.CURRENT_AUTHENTICATION.UserId);

            Assert.AreEqual(Convert.ToInt64(5), MyDelegationService.INSTANCES_COUNT);
        }
コード例 #8
0
ファイル: HtmlFormEngine.cs プロジェクト: zf321/ESS.FW.Bpm
 public virtual object RenderStartForm(IStartFormData startForm)
 {
     return(RenderFormData(startForm));
 }