public virtual object execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration; DeploymentCache deploymentCache = processEngineConfiguration.DeploymentCache; ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); ensureNotNull("Process Definition '" + processDefinitionId + "' not found", "processDefinition", processDefinition); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkReadProcessDefinition(processDefinition); } StartFormHandler startFormHandler = processDefinition.StartFormHandler; if (startFormHandler == null) { return null; } FormEngine formEngine = Context.ProcessEngineConfiguration.FormEngines[formEngineName]; ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine); StartFormData startForm = startFormHandler.createStartFormData(processDefinition); object renderedStartForm = null; try { renderedStartForm = formEngine.renderStartForm(startForm); } catch (ScriptEvaluationException e) { LOG.exceptionWhenStartFormScriptEvaluation(processDefinitionId, e); } return renderedStartForm; }
private void OpenApplication(int index) { if (_childProcesses[index] != null && !_childProcesses[index].HasExited) { FormEngine.BringMainWindowToTop(_childProcesses[index]); } else { string applicationName = ADA_APPLICATIONS[index]; string arguments = "ADA"; try { _childProcesses[index] = Process.Start(this._appDir + applicationName, arguments); if (!IsBigMemory) { Close(); } } catch (Exception ex) { Debug.WriteLine(ex); } } }
public void DeserializeAFormFromABinaryFile() { string path = SetupBinary(EngineHelper.GetPathToBinFolder()); Form f = (Form)FormEngine.Load(path); Assert.IsNotNull(f); }
public void CreateANewForm() { // Act Form f1 = SetupForm(); Form f2 = FormEngine.CreateForm("B"); // Assert Assert.IsNotNull(f1); Assert.AreNotSame(f1, f2); }
protected override void Render(HtmlTextWriter writer) { var form = FormEngine.CreateInitialForm(EntryPointClass, Parameters); form.Id = ID; var formEngine = FormEngineFactory.Instance.GetFormEngine(HttpContext.Current, (ControllerContext)HttpContext.Current.Items[CurrentContextKey]); var htmlFragment = formEngine.RenderMainView(form); writer.Write(htmlFragment.Html); writer.Write(htmlFragment.Script.EncodeOnLoadAsHtml()); }
private void Run() { try { Engine.Run(); } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString(), "Engine failure", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); System.Diagnostics.Debug.WriteLine(string.Format("Engine failure: {0}", e)); } finally { Engine = null; _Injector = null; GC.Collect(); Stopped?.Invoke(this, EventArgs.Empty); } }
private string SetupBinary(string path) { AnswerSheet s = SetupSheet(); QBinary q1 = s.Form.Questions.AddANewQuestion <QBinary>("Test 1", true); QBinary q2 = s.Form.Questions.AddANewQuestion <QBinary>("Test 2", true); ABinary a1 = (ABinary)s.CreateAnswerFor(q1); a1.Answer = true; ABinary a2 = (ABinary)s.CreateAnswerFor(q2); a1.Answer = false; return(FormEngine.Save(path, s.Form)); }
public void CreateAFormWithQFreeText() { Form f = FormEngine.CreateForm("Test"); QComposite n1 = f.Questions.AddANewQuestion <QComposite>("Informations sur le programme", false); QFreeText q1 = n1.AddANewQuestion <QFreeText>("Qu'aimez-vous dans ce programme ?", true); QFreeText q2 = (QFreeText)n1.AddANewQuestion("DynamicForms.Components.QFreeText, DynamicForms.Components", "Qu'est-ce qui marche particulièrement bien ?", false); QFreeText q3 = (QFreeText)n1.AddANewQuestion("DynamicForms.Components.QFreeText, DynamicForms.Components", "Dans quelle application l'utiliserez-vous ?", true); QComposite n2 = f.Questions.AddANewQuestion <QComposite>("Informations sur l'utilisation", false); QFreeText q4 = n2.AddANewQuestion <QFreeText>("Qu'est-ce qui est simple à utiliser pour vous ?", true); QFreeText q5 = n2.AddANewQuestion <QFreeText>("Comment l'utilisez-vous ?", false); AnswerSheet toto = f.FindOrCreateAnswerSheetFor("Toto"); AFreeText a1 = (AFreeText)toto.CreateAnswerFor(q1); a1.AllowEmptyAnswer = false; a1.FreeTextAnswer = "Une réponse de test 1"; AFreeText a2 = (AFreeText)toto.CreateAnswerFor(q2); a2.AllowEmptyAnswer = true; a2.FreeTextAnswer = "Une réponse de test 2"; AFreeText a3 = (AFreeText)toto.CreateAnswerFor(q3); a3.AllowEmptyAnswer = false; a3.FreeTextAnswer = "Une réponse de test 3"; AFreeText a4 = (AFreeText)toto.CreateAnswerFor(q4); a4.AllowEmptyAnswer = true; a4.FreeTextAnswer = ""; AFreeText a5 = (AFreeText)toto.CreateAnswerFor(q5); a5.AllowEmptyAnswer = false; a5.FreeTextAnswer = "Une réponse de test 5"; AFreeText a6 = (AFreeText)toto.CreateAnswerFor(q5); a6.AllowEmptyAnswer = false; a6.FreeTextAnswer = " "; a6.Accept(new RequirementValidator()); Assert.AreEqual(3, n1.Children.Count); Assert.AreEqual(2, n2.Children.Count); Assert.AreSame(q2.Parent, n1); Assert.AreSame(q4.Parent, n2); Assert.AreSame(toto.Answers[q1], a1); Assert.AreSame(toto.Answers[q5], a6); Assert.Throws <NotSupportedException>(delegate { toto.CreateAnswerFor(n1); }); }
public void TestProcessWithError() { var parameterProvider = new TestParameterProvider(); var formEngine = new FormEngine(parameterProvider, null, new ClientSideFormPersister(), new SimpleErrorHandler(new DefaultMethodInvoker())); parameterProvider.Add("eventHandler", "ErroneousEvent"); var form = new MyForm { Id = "formId" }; parameterProvider.Add("state", Convert.ToBase64String(SerializationUtils.SerializeObject(form))); parameterProvider.Add("EVT.srcId", "formId.testSrcId"); parameterProvider.Add("EVT.someParameter", "testParameter"); var expr = formEngine.DoProcess(); Assert.IsTrue(expr.Encode().StartsWith("alert(\"some error\")")); }
public void TestProcess() { var parameterProvider = new TestParameterProvider(); parameterProvider.Add("eventHandler", "SuccessfulEvent"); var formEngine = new FormEngine(parameterProvider, null, new ClientSideFormPersister(), new DefaultMethodInvoker()); var form = new MyForm { Id = "formId" }; parameterProvider.Add("state", Convert.ToBase64String(SerializationUtils.SerializeObject(form))); parameterProvider.Add("EVT.srcId", "formId.testSrcId"); parameterProvider.Add("EVT.someParameter", "testParameter"); var expr = formEngine.DoProcess(); form.Output = "testSrcId/testParameter"; Assert.AreEqual("$$('formId').jasty(\"Form\", \"update\", [\"" + Convert.ToBase64String(SerializationUtils.SerializeObject(form)) + "\"]);", expr.Encode()); }
public ComponentInjector(FormEngine engine) { _Engine = engine; }
public EngineInstance(string title) { Engine = new FormEngine(title); Engine.Components.Add(_Injector = new ComponentInjector(Engine)); }
private Form SetupForm() { return(FormEngine.CreateForm("A")); }